为什么我看不到mod_wsgi的进程 [英] why I don't see processes of mod_wsgi

查看:72
本文介绍了为什么我看不到mod_wsgi的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个配置如下的wsgi应用程序:

I have a wsgi application configured as follows:

WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess myapp user=myuser threads=10 maximum-requests=10000
WSGIScriptAlias / /usr/local/myapp/wsgi.py
WSGIProcessGroup myapp

我希望看到我的应用程序正在运行的进程...但是使用ps auxpstree时,我看不到任何子进程:

I expected to see running processes for my app... but with ps aux or pstree I see no child processes:

init─┬─apache2─┬─apache2
     │         ├─2*[apache2───26*[{apache2}]]
     │         ├─apache2───14*[{apache2}]
     │         ├─apache2───12*[{apache2}]
     │         └─apache2───16*[{apache2}]

我的wsgi是否在守护程序模式下执行?如何检查python进程的运行状况?

Is my wsgi executing in daemon mode? How can I inspect the health of my python process?

我正在尝试调试我的wsgi python应用程序,该应用程序在同时请求大量连接时(例如:从单个网页发出30个连续的ajax请求)而挂起(有时会出现内存错误).

I'm trying to debug my wsgi python application which hangs (sometimes with a memory fault) when a lot of connections are requested at the same time (say: 30 consecutive ajax requests from a single web page).

推荐答案

为了完整起见,我在扩展Mikko Ohtamaa的评论.

For the sake of completeness I am expanding on the comment by Mikko Ohtamaa.

mod_wsgi进程名称确实采用了父进程的名称,例如. /usr/sbin/apache2 -k start取决于发行版等.

The mod_wsgi process name indeed takes the name of the parent process, something like eg. /usr/sbin/apache2 -k start depending on distros etc.

使用display-name选项使我们可以设置其他进程名称:

Using the display-name option allows us to set a different process name:

为使用ps命令列出进程的守护进程定义一个不同的名称.如果值为%{GROUP},则名称将为(wsgi:group),其中组用守护进程组的名称替换.

Defines a different name to show for the daemon process when using the ps command to list processes. If the value is %{GROUP} then the name will be (wsgi:group) where group is replaced with the name of the daemon process group.

请注意,只能显示执行值的argv0最初占用的字符数.超出此限制的任何内容都将被截断.

Note that only as many characters of the supplied value can be displayed as were originally taken up by argv0 of the executing process. Anything in excess of this will be truncated.

此功能可能无法在所有平台上都起作用.通常,它还需要具有BSD传统的ps程序.因此,在某些版本的Solaris UNIX上,/usr/bin/ps程序不起作用,而/usr/ucb/ps则起作用.其他可以显示此值的程序包括htop.

This feature may not work as described on all platforms. Typically it also requires a ps program with BSD heritage. Thus on some versions of Solaris UNIX the /usr/bin/ps program doesn’t work, but /usr/ucb/ps does. Other programs which can display this value include htop.

参考.

示例:

WSGIDaemonProcess myapp user=myuser threads=10 maximum-requests=10000 display-name=django-myapp
WSGIScriptAlias / /usr/local/myapp/wsgi.py
WSGIProcessGroup myapp

然后:

ps aux | grep django-myapp

这篇关于为什么我看不到mod_wsgi的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆