3 ms·
Although it's not stated, the point is that pretty much every framework that is not based on Twisted uses BaseHTTPServer which is known only to run in single-pr
by prolepunk 15y ago
Although it's not stated, the point is that pretty much every framework that is not based on Twisted uses BaseHTTPServer which is known only to run in single-process mode, meaning that you should NEVER use it anywhere near production environment.
- BarkMore 15y agoI am not sure what you mean by "single-process mode", but I am guessing that you are referring to the ability to serve more than one request at a time. If this is the issue, then BaseHTTPServer works just fine in production environments if a thread pool is used or if multiple instances of the application are run behind a reverse proxy.
- prolepunk 15y agoSorry I wasn't clear, I meant serving more than one request at a time, and apparently this is even possible without using multiple instances, use multiple inheritance with a threading mixin. This is not going to be properly concurent due to GIL limitations but it should be good enough -- http://blog.doughellmann.com/2007/12/pymotw-basehttpserver.html http://blog.doughellmann.com/2007/12/pymotw-basehttpserver.h... However this setup can lead to socket lockup (see picked answer) -- http://stackoverflow.com/questions/5693741/whats-difference-between-a-simple-webserver-and-apache-server http://stackoverflow.com/questions/5693741/whats-difference-...
- BarkMore 15y agoI am not sure what you mean by "properly concurrent", but I am guessing that you are referring to the fact that Python code cannot use more than one core because of the GIL. This limitation also applies to Twisted applications. For high volume apps, it often makes sense to run multiple instances of the app behind a reverse proxy. That's the only way to make full use the CPU when running Python. What is "socket lockup"? The word "lockup" is nowhere to be found on the page you references.