阿帕奇产卵僵尸进程当PHP被称为 [英] Apache spawning zombie processes when php is called

查看:171
本文介绍了阿帕奇产卵僵尸进程当PHP被称为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有已建成的镆铘并在其命中负载使用了所有的CPU处理能力和顶部呈现出许多倒闭的PHP僵尸进程消耗这一点。

I have a site which has been built in modx and when its hit with load uses up all cpu processing power and top is showing a lot of defunct php zombie processes consuming this.

下面是系统规格...结果
PHP 5.2.14结果
运行PHP作为suPHP结果
MySQL的51年1月5日结果
阿帕奇2.0.63结果
镆铘1.0.4

Here's the system specs...
PHP 5.2.14
php running as suPHP
Mysql 5.1.51
Apache 2.0.63
modx 1.0.4

有关测试使用ApacheBench IM和模拟100个并发连接500个连接

For testing im using ApacheBench and simulating 500 connections with 100 concurrent connections

我现在已经2种方法测试了这一点...

I've tested this out 2 ways now...

关闭的.htaccess和压力测试一个简单的PHP页面,只是呼应世界,你好。结果
在上面这表明PHP将解散并变成一个僵尸,但他们很快就消失pretty

Turning off .htaccess and stress testing a simple php page that just echoes 'Hello world'.
In top this shows php going defunct and turning into a zombie but they go away pretty quickly

通过调用镆铘,其中PHP是做了很多更提供一个页面,滋生更多的僵尸是吃更多的CPU和他们中的一些不走快。

Calling a page served by modx, where php is doing a lot more, spawns more zombies that eat more cpu and some of them dont go away quickly.

什么会导致此?难道是我们的code错误 - 在这种情况下为什么用简单的Hello World脚本产卵僵尸

What would be causing this? Would it be a mistake in our code - in which case why does the simple Hello World script spawn zombies?

时它的一些问题,服务器配置或者把服务器上的负载太大?

Is it some problem with server config or with putting too much load on the server?

抓我的头这一切现在希望一些指针为下一步该怎么做。

Scratching my head about this all now and hoping for some pointers as to what to do next.

推荐答案

一个过程是僵尸(在顶部显示为Z)退出后(通常与否)它的进程ID停留在进程表直到它的家长在等待(或收割)吧。
在正常情况下,当父进程设置用于SIGCHLD一个信号处理器,以便当被发送的信号(在一个子过程的出口处),父进程然后收获它在其方便

A process is "zombie" (which in top appears as Z) immediately after it exits (normally or not) Its process ID stays in the process table until its parent waits on (or "reaps") it. Under normal circumstances, when the parent process sets up a signal handler for SIGCHLD so that, when the signal is sent (upon a child process's exit), the parent process then reaps it at its convenience.

如果父进程已挂起由于某种原因,比如如果它挂起或太忙,或者是僵持不下,那么子进程的出口将不被收割(直到父进程再次恢复)。

If the parent process has hung for some reason, such as if it's suspended, or is too busy, or is deadlocked, then child processes that exit will not be reaped (until the parent process resumes again).

一般情况下,主要的Apache进程将获得所有工人的那个出口。然而,负载很重的服务器像你描述的,其主要过程可能没有足够的空间给它的时间来做到这一点收割。 Unreaped(僵尸)的进程显示为在顶部。

Usually, the main Apache process will reap any of its workers that exit. However, on a heavily-loaded server like you describe, the main process may not have enough time available to it to do this reaping. Unreaped ("zombie") processes show up as in top.

在这种情况下,过程是正常的,并关注没有,除非有许多,许多unreaped过程

In this case, the processes are normal and are not of concern, unless there are many, many unreaped processes.

在您的测试结束后,做了僵尸进程很短的时间后消失?如果是这样,你有什么可担心的一切都是正常的。

When your test is over, do the zombie processes disappear after a short time? if so, you have nothing to worry about everything is normal.

在默认情况下,Apache是​​建立了工作进程处理请求的数量有限,后退出。这样设计是为了不让内存泄漏失控。您可能会发现调整此设置可以帮助你。

By default, apache is set up for worker processes to exit after handling a limited number of requests. This is designed to not allow memory leaks to get out of hand. You might find tweaking this setting might help you.

这篇关于阿帕奇产卵僵尸进程当PHP被称为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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