Handy mod_wsgi process names

Tags: django

One of the reasons I started experimenting with gunicorn instead of mod_wsgi was that it would help me identify the sites when looking at cpu/memory usage with top. With standard apache+mod_wsgi, you only get line upon line of /usr/sbin/apache2 -k start with no indication of which site it actually is.

Turns out mod_wsgi can do that just fine, too! I got a comment on my gunicorn blogpost from Diederik v/d Boor that told me about mod_wsgi’s display-name option. It was right there in mod_wsgi’s WSGIDaemonProcess documentation but I completely overlooked it.

What I did was to add a display-name like this:

WSGIDaemonProcess mysite display-name=mysite_wsgi user=xyz group=xyz

In top you might have to press c to view the full commandline for every top line. (Tip: press W to write the top config to disk to persist the change).

See this picture. It shows a couple of not-yet converted wsgi sites with the unhelpful /user/sbin/apache2 name and a couple with the sitename with _wsgi in it.

top output