3 ms·
I thought the whole point of mod_python was performance. Since it runs inside the apache process it doesn't have to spawn a new python interpreter for every pa
by clintavo 18y ago
I thought the whole point of mod_python was performance. Since it runs inside the apache process it doesn't have to spawn a new python interpreter for every page request. Am I mistaken? Does fastcgi and/or mod_wsgi solve the same issue?
- rcoder 18y agoAll three work if your goal is simply to avoid forking a new Python interpreter for each incoming request, ala CGI. The difference is in where they hook into the request-handling workflow within Apache. Both FastCGI and WSGI apps only receive the request after Apache (or lighttpd, nginx, et. al.) have finished doing access control checks, URL rewriting, header parsing, etc. Code inside the mod_python interpreter, on the other hand, can hook in to any of those earlier stages of request processing, which allows it to do things like block a request, alter the Apache log format, or look up a vhost docroot in a database, all before any content is generated. The downside is that each and every Apache process on your server has a full copy of the Python interpreter embedded inside, which can cost you a pretty serious chunk of RAM when you start dealing with servers running 25-50 (or more) httpd processes.