2 ms·
> If you're using a standard framework like Django or Flask then this works really well and without much effort. I dug into it ~year ago, Django loads almost
by rossmohax 7y ago
> If you're using a standard framework like Django or Flask then this works really well and without much effort.
I dug into it ~year ago, Django loads almost everything lazily, so simple --preload did next to nothing. I had to write code to load app for real at import time, exact thing article and common wisdom tells us not to do.
- orf 7y agoDjango loads some things lazily but not almost everything. Nearly all your imports should be loaded by the preloaded application and shared across forks (COW semantics aside), and this usually takes up a non-trivial amount of memory. The things that are lazy are usually lazy for a reason - database connections, caching etc. I believe the i18n system is also lazily loaded and depending on the languages you configure it can take up a fair bit of memory.