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
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):