On May 7, 7:45 am, David Zhou <
da...@nodnod.net> wrote:
> It works for me. Here's the body of that post:
>
> * Support formod_wsgi: Setting up a default Django app withmod_wsgi
> is now an option in our one-click installer. So if you prefermod_wsgi
> over mod_python you will no longer have to install it manually. I just
> ran a simple benchmark using "ab -n 5000 -c 2" against a default
> Django site usingmod_wsgiand the same using mod_python. Both were
> using 2 Apache worker processes.mod_wsgiwas slightly faster (1400
> req/sec vs 1250 req/sec) and was using slightly less memory (10MB per
> Apache worker process vs 12MB). Note that you can also setup a
> standalonemod_wsgiapplication in our control panel (without Django).
In terms of performance, although mod_wsgi performs a lot better than
mod_python:
http://code.google.com/p/modwsgi/wiki/PerformanceEstimates
that isn't where your bottlenecks will be. As such, any gain is still
swallowed up in the overall request times.
Thus how much improvement you see in performance will really depend on
your application.
Similarly, although mod_wsgi itself has a smaller memory footprint
than mod_python, that again isn't going to be that noticeable in the
context of a Python web application which is 40MB or more in size. In
other words, what is a few hundred kilobytes to a megabyte between
friends.
In the past mod_python has got a really bad rap for causing really
bloated processed. This is actually mostly a load of garbage. True
there were memory leaks in some older versions, and you incurred a
couple MB penalty if your Python didn't provide a shared library
linked into the correct place (also an issue with mod_wsgi), but the
problem of fat processes when using mod_python has always simply been
that most Python applications are fat. It all just seemed to be a
bigger problem than it was because people ran Apache with single
threaded prefork MPM and as such Apache had to create a lot more of
those fat processes, causing overall system memory to be gobbled up
quite quickly.
As I understand Webfaction, they are using mod_wsgi in embedded mode,
so for WSGI applications, it just acts as a slightly newer (arguably
better) version of mod_python. The only difference with mod_wsgi is
that if running multiple WSGI applications it defaults to allocating a
separate Python sub interpreter within the process for each, whereas
mod_python has one Python sub interpreter per virtual host and so if
multiple applications they all run together unless you do something to
change that. This would be an issue with Django if you wanted to run
multiple instances on the one site. That is, with mod_python you would
need to fiddle with PythonInterpreter directive to isolate them,
whereas with mod_wsgi they would be isolated by default.
The features of mod_wsgi which many would I am sure say are the most
useful, ie., its fastcgi like daemon mode with ability to run daemons
as separate user and to restart WSGI applications by touching the WSGI
script and thereby not restarting the whole of Apache, most likely
aren't even being used in the WebFaction setup. This is because the
Apache instance already runs as the user and you also have control
over Apache anyway to restart it when you want. In other words, most
of the reasons for running mod_wsgi in daemon mode aren't an issue to
begin with.
The only thing that mod_wsgi would still give you through its daemon
mode is the ability to isolate WSGI applications into their own
processes so they do not interfere with each other. As I understand it
though, WebFaction has limits on the number of persistent processes
you have, thus am not sure you can effectively use daemon mode in
their environment without hitting these limits.
Thus, if what I understand about WebFaction is correct, there possibly
isn't much different between using mod_python and mod_wsgi in their
environment, except if using mod_wsgi you can say you are trendy
because it is newer and shinier. :-)
Graham