3 ms·
Somewhat related, although this is for a huge scale: Adaptive process and memory management for Python web servers https://instagram-engineering.com/adaptive-p
by chubot 6y ago
Somewhat related, although this is for a huge scale:
Adaptive process and memory management for Python web servers https://instagram-engineering.com/adaptive-process-and-memory-management-for-python-web-servers-15b0c410a043 https://instagram-engineering.com/adaptive-process-and-memor...
Previously we used two per-worker thresholds to control respawn: reload-on-rss and evil-reload-on-rss.
...
However, since worker respawn is expensive (i.e. there are warm-up costs, LRU cache repopulation, etc..)
For a smaller scale, I always wondered if FastCGI being the "default" would have saved a lot of headaches. Your workers just get recycled automatically all the time.
If you can make your startup fast enough (and I think most apps can), then you can just let the OS do its job. Although it's true that Python can be really slow to start if you import many modules...
https://news.ycombinator.com/item?id=24683304 https://news.ycombinator.com/item?id=24683304