4 ms·
gunicorn uses multiple processes
by iterateoften 3y ago
gunicorn uses multiple processes
- aeyes 3y agoYou can still share most of the memory if you load everything before the fork so why is having multiple processes a problem?
- rtpg 3y agoIve found in practice that memory sharing doesn’t work as much as one would want, and multiple processes cost hundreds of megs (annoying!)
- skrause 3y agoOne operating system I have to deploy on (Windows) has neither fork() nor gunicorn.
- dontlaugh 3y agoReference counting prevents that from working well. Very little sharing actually happens by default.
- sitkack 3y agoIf the counts were kept somewhere else, they wouldn't pollute, or if you could turn off ref counts for everything allocated before the call to fork, then you would also be good. The other option is you could allocate all the shared data off of the Python heap prior to the fork call.
- dontlaugh 3y agoInstagram have a system for making some objects immortal before the fork, but it’s not the default behaviour in Python. It’s also not easy to set up in some cases.
- aeyes 3y agoPEP683 finally landed in Python 3.12: https://peps.python.org/pep-0683/ https://peps.python.org/pep-0683/ It's been in Pyston for a while.