问题描述
我的Apache 2个虚拟主机,每一个都具有Django的网站使用的mod_wsgi,守护进程模式,这样附:
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>
我用 WSGIApplicationGroup%{GLOBAL}
的一个已知的问题的Xapian 。
现在,如果我明白这是怎么回事幕后,mod_wsgi的推出我的每个站点5守护进程。我可以在Apache日志看到这一点:
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'.
...
我不明白的是,如果这些附加间preTER''
行表示,所有这些过程都有着相同的Python间preTER,或者如果有每个进程一个跨preTER。 (顺便说一句我意识到空间preTER名称''是通过传递%{GLOBAL}
到 WSGIApplicationGroup
)。
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
).
我想检查是否也许的sys.path
项累积在随后的进程,但他们并没有 - 这可能表明有一个单独的Python间preTER每5个守护进程的......但我不太懂这些东西,所以我问在这里。
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.
推荐答案
在'PID的价值是不同的。它们是在不同的过程。
The 'pid' value is different. They are in different processes.
这篇关于的mod_wsgi daemon模式,WSGIApplicationGroup和Python间preTER分离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!