by TekMol · 3y ago · 0 comments
it's not very realistic
It is totally realistic. I have multiple projects running that do not use any external code. With millions of users.Those projects are PHP though. PHP has a lot of bells and whistles on board. Unfortunately with PHP 8, they started introducing a lot of breaking changes. So they lost my trust and I will use Python for new projects.
Not sure yet if I will use Django (As you said, it seems pretty stable) or do the good old CGI approach. If I do the latter, I will probably write a new CGI library for it, because in the Python ecosystem it is all about long running processes nowadays and I think that is the wrong approach.
Years ago I had to deploy on a network file system which was very slow for file stats. (It was designed for HPC and bandwidth.)
Python startup (by default) requires a large number of stat calls. It took our CGI app over a second just to start.
I was able to improve it by packaging the Python std lib as a zipfile, and our app as another, since zipimports avoid a lot of stat calls.
TurboGears had just come out. I did a prototype using it. Its was so much faster!
For organizational reasons were were not able to switch. IT took over and, after several years, replaced it all with a Java version.
PHP starts up from scratch on every request, yet it blows Python out of the water performance wise.
Particularly async runtimes have become more popular - where you can have a single process handling concurrent requests and awaiting/yielding in between their api/db calls. Instead of having many processes that don't share resources that might be waiting 10ms/100ms for api/db calls.
For applications that make large numbers of api/db calls - especially slower ones, may prefer async runtimes over individual processes per request.
I'm not at all saying CGI is a bad option, just that there are real benefits to reusing, pooling and caching resources.