简体   繁体   English

mod_wsgi守护进程模式,WSGIApplicationGroup和Python解释器分离

[英]mod_wsgi daemon mode, WSGIApplicationGroup and Python interpreter separation

I have Apache with 2 virtual hosts, each having a Django site attached using mod_wsgi, daemon mode, like this: 我有2个虚拟主机的Apache,每个主机都有一个使用mod_wsgi,守护进程模式连接的Django站点,如下所示:

<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 . 我使用WSGIApplicationGroup %{GLOBAL}是因为Xapian存在已知问题

Now, if I understand what's going on behind the scenes, mod_wsgi launches 5 daemon processes for each of my sites. 现在,如果我了解幕后发生了什么,mod_wsgi会为我的每个站点启动5个守护进程。 I can see this in Apache log: 我可以在Apache日志中看到这个:

[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. 我不明白的是,如果那些"Attach interpreter ''"行表明所有这些进程共享相同的Python解释器,或者每个进程有一个解释器。 (BTW I realize that the empty interpreter name '' is caused by passing %{GLOBAL} to WSGIApplicationGroup ). (顺便说一下,我意识到空解释器名称''是由%{GLOBAL}传递给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. 我试着检查是否可能在后续进程中累积sys.path条目,但是他们没有 - 这可能表明5个守护进程中的每一个都有一个单独的Python解释器......但我不太了解所有这些事情所以我问这里。

The 'pid' value is different. 'pid'值不同。 They are in different processes. 它们处于不同的过程中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM