I have Apache with two virtual hosts, each of which has a Django site connected using mod_wsgi, daemon mode, for example:
<VirtualHost 123.123.123.123:80> WSGIDaemonProcess a.com user=x group=x processes=5 threads=1 WSGIProcessGroup a.com WSGIApplicationGroup %{GLOBAL} </VirtualHost> <VirtualHost 123.123.123.123:80> WSGIDaemonProcess b.com user=x group=x processes=5 threads=1 WSGIProcessGroup b.com WSGIApplicationGroup %{GLOBAL} </VirtualHost>
I am using WSGIApplicationGroup %{GLOBAL} due to a known issue with Xapian .
Now, if I understand what is going on behind the scenes, mod_wsgi starts 5 daemon processes for each of my sites. I see this in the Apache log:
[info] mod_wsgi (pid=8106): Attach interpreter ''. [info] mod_wsgi (pid=8106): Adding '.../lib/python2.5/site-packages' to path. [info] mod_wsgi (pid=8106): Enable monitor thread in process 'a.com'. [info] mod_wsgi (pid=8106): Enable deadlock thread in process 'a.com'. [info] mod_wsgi (pid=8107): Attach interpreter ''. [info] mod_wsgi (pid=8107): Adding '.../lib/python2.5/site-packages' to path. [info] mod_wsgi (pid=8107): Enable monitor thread in process 'a.com'. [info] mod_wsgi (pid=8107): Enable deadlock thread in process 'a.com'. ...
What I donβt understand is the "Attach interpreter ''" lines that indicate that all these processes have the same Python interpreter or if there is one interpreter for each process. (By the way, I understand that the empty interpreter name '' is caused by passing %{GLOBAL} to WSGIApplicationGroup ).
I tried to check if sys.path entries were cumulated in subsequent processes, but they didnβt, which may indicate that there is a separate Python interpreter for each of the 5 daemon processes ... but I donβt quite understand all these things, so I ask here.
python apache mod-wsgi
Tomasz zielinski
source share