I'm not asking this to start a troll, but it starts with an observation. Every programming languages have their own server that increase their performances.
Ruby have Mongrel, Thin. Python have many frame开发者_StackOverflow中文版works with integrated servers (ready for production or not), like in Django, Tornado, etc. And don't mention java!
For now, PHP code is served via servers like Apache or NGinx but what I mean is like a "pre-environment": If we take example on Tornado Web Server, the idea could be used, for example, to load an entire "meta" framework when the server starts : DB connection created once and only once, the URL interpreter with all the url regular expression, the core framework, loaded only once in order to save the server's cpu. Then, the "executed regarding the request" code would be executed at the request.
The core reason of this idea is to keep the PHP code loaded once, in order to reduce the server load for every request and improve the response time.
Of course, many (if not all) actual PHP could wouldn't work and a garbage collector equivalent would be necessary to unload all the unused code.
Writing it in PHP is the base idea since it would be (kind of) linked to the loaded component (a web framework) but the server could be written in any other language. The principal purpose being to load the whole PHP code only one time, when the server starts.
Do you find any good reason to not do it? Am I forgot something? Maybe there is already something equivalent I wasn't aware about?
精彩评论