I have Apache with 2 virtual hosts, each having a Django site attached using mod_wsgi, daemon mode, like this:
<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 use WSGIApplicationGroup %{GLOBAL}
because of a known problem with Xapian .
Now, if I understand what's going on behind the scenes, mod_wsgi launches 5 daemon processes for each of my sites. I can see this in 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 if those "Attach interpreter ''"
lines indicate that all of those processes share the same Python interpreter, or if there is one interpreter per process. (BTW I realize that the empty interpreter name '' is caused by passing %{GLOBAL}
to WSGIApplicationGroup
).
I tried checking if maybe sys.path
entries cumulated in subsequent processes, but they didn't - which could indicate that there's a separate Python interpreter for each of the 5 daemon processes... but I don't quite understand all these things so I'm asking here.
The 'pid' value is different. They are in different processes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.