Python subprocess.Popen在uWSGI下运行缓慢
我在Fedora 14上搭建了一个开发服务器,使用Cherokee作为服务器,并通过uWSGI来连接我的WSGI应用程序。
当第一次请求到达应用程序时,我会像这样启动一个进程:
from subprocess import Popen
Popen(['bash']) # bash is just an example; the problem happens with all programs
第一次请求需要10到15秒才能完成(后续的请求只需要不到一秒)。如果不创建Popen对象,第一次请求大约只需2到3秒就能完成。当我在Python命令行中执行相同的Popen请求时,反应是瞬间的。
这是什么原因造成的呢?我是不是漏掉了什么明显的东西?