简体   繁体   English

uwsgi会产生很多奇怪的过程,就像已经消失的过程一样

[英]uwsgi produce a lot of strange process,just like defunct process

I have a web project,use nginx ,uwsgi ,web.py ,nginx is used for load balancing,uwsgi is used as a web server,web.py is a web frameworks 我有一个Web项目,使用Nginx,uwsgi,web.py,nginx用于负载平衡,uwsgi用作Web服务器,web.py是Web框架

I start it with this commond "/usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800" 我从这个通用的“ / usr / local / bin / uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main开始-t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800“

this commond means it will produce twenty process to receive request, and each process receive 800 requests as most 这个共同点意味着它将产生二十个进程来接收请求,并且每个进程最多接收800个请求

as show below is normal process 如下所示是正常过程

sheng     12414 15051 21 10:04 ?        00:01:45 /usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800

15051 is parent pid 15051是父PID

usually it works normal ,but it will produce strange process when server is very busy and many requests take a long time, as shown below is strange process: 通常它可以正常工作,但是当服务器很忙并且许多请求花费很长时间时,它将产生一个奇怪的过程,如下所示是一个奇怪的过程:

sheng     23370     1  0 09:08 ?        00:00:00 /usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800

you will notice,this process's pid is 23370,but it's parent pid is 1,it like a defunct process.However, in fact,this process take up memory and will not receive any request 您会注意到,该进程的pid为23370,但它的父pid为1,就像一个已失效的进程。但是,实际上,此进程占用内存并且不会收到任何请求

I had hoped to produce 20 normal process to receive request,but now ,it process more then 80 starnge process,who can tell me why and what can I do to solve this problem 我原本希望产生20个正常流程来接收请求,但是现在,它处理的数量超过了80个stardge流程,谁可以告诉我原因以及如何解决此问题

I have found out the reason 我找到了原因

In my python project , sometimes python will use R to make a scientific calculation 在我的python项目中,有时python将使用R进行科学计算

R is slow ,so a colleague of mine use parallel technology,R will fork some child process to calculate R很慢,所以我的一个同事使用并行技术,R会派生一些子进程来计算

Unfortunately,if a request take more than 20 seconds ,uwsgi will kill the python process,but due to unknown reasons, those child process which R forked will not be killed ,they are just strange process what I see 不幸的是,如果一个请求花费了20秒钟以上的时间,uwsgi将杀死python进程,但是由于未知原因,那些由R分叉的子进程将不会被杀死,它们只是我所看到的奇怪进程

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

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