- 论坛徽章:
- 0
|
可能又是一个老生常谈的问题了,以前流量不大的时候显现不出来,现在流量上去了,总是会出现页面突然打不开或者只打开一半的问题。现在把问题简单的阐述一下。
系统: Redhat 9.0 + Apache 2.0.52 + PHP 4.3.9 + Vsftpd 2.0.1
模块:
# apachectl -l
Compiled in modules:
core.c
mod_access.c
mod_auth.c
mod_include.c
mod_log_config.c
mod_env.c
mod_setenvif.c
mod_ssl.c
worker.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_cgid.c
mod_negotiation.c
mod_dir.c
mod_imap.c
mod_actions.c
mod_speling.c
mod_userdir.c
mod_alias.c
mod_rewrite.c
mod_so.c
PHP 的 configure 行中已经把 --with-mpm 编入: --with-mpm=worker
流量:
- 参观人次 网页数 文件数
- 平均数 3379.52 30662.35 30768.43
复制代码
httpd.conf 的相关配置已经解释
Timeout 300
KeepAlive On
MaxKeepAliveRequests 600
KeepAliveTimeout 15
<IfModule worker.c>;
# These two lines must be written before any other configurations.
ThreadLimit 200
ServerLimit 16
StartServers 3
MinSpareThreads 75
MaxSpareThreads 350
# Problem:
# WARNING: ThreadsPerChild of 75 exceeds ThreadLimit value of 64
# threads, lowering ThreadsPerChild to 64. To increase, please see the
# ThreadLimit directive.
#
# The default value for ThreadLimit is 1920 when used with mpm_winnt
# and 64 when used with the others.
ThreadsPerChild 100
MaxClients 600
# MaxClients <= ServerLimit * ThreadsPerChild 350 < 16*100 = 1600
MaxRequestsPerChild 10000
</IfModule>;
硬件:
Dell poweredge 2650 Xeon 2.0 * 4 + 1G memory
我朋友说内存小了点.... 但是..
# top
213 processes: 212 sleeping, 1 running, 0 zombie, 0 stopped
CPU0 states: 0.0% user 6.0% system 0.0% nice 0.0% iowait 93.0% idle
CPU1 states: 1.0% user 0.0% system 0.0% nice 0.0% iowait 98.0% idle
CPU2 states: 25.0% user 0.1% system 0.0% nice 0.0% iowait 73.0% idle
CPU3 states: 10.0% user 2.0% system 0.0% nice 0.0% iowait 86.0% idle
Mem: 1032044k av, 1015332k used, 16712k free, 0k shrd, 13544k buff
416956k active, 541048k inactive
Swap: 2048248k av, 12924k used, 2035324k free 723204k cached
真正 active 的内存才一半左右, swap 几乎没有用。
# ps -ax | grep httpd | wc -l
5
# ps -ax | grep vsftpd | wc -l
108 有点高.....
vsftpd 的配置: virtual user + 脱离xinted的独立形式.
-----------------------------------
好了,烦了这么多了,看看头痛的现象吧。 以下是 #top -d 1 | grep httpd 的记录:
- [root@dalouis root]# top -d 1 | grep httpd
- 14774 root 16 0 5744 5744 5568 S 99.9 0.5 0:00 1 httpd
- 14774 root 16 0 5744 5744 5540 S 19.1 0.5 0:00 0 httpd
- 14774 root 16 0 5744 5744 4860 S 99.9 0.5 0:00 0 httpd
- 15212 apache 16 0 0 0 0 Z 33.3 0.0 0:00 0 httpd <defunct>;
- 14774 root 16 0 5744 5744 5540 S 37.1 0.5 0:00 1 httpd
- 14774 root 16 0 5744 5744 5584 S 29.7 0.5 0:01 1 httpd
- 14774 root 16 0 5744 5744 5568 S 14.1 0.5 0:01 1 httpd
- 14774 root 16 0 5744 5744 4860 S 99.9 0.5 0:00 3 httpd
- 15444 apache 17 0 0 0 0 Z 76.4 0.0 0:00 1 httpd <defunct>;
- 15559 apache 17 0 0 0 0 Z 34.3 0.0 0:00 1 httpd <defunct>;
- 15555 apache 16 0 0 0 0 Z 16.2 0.0 0:00 1 httpd <defunct>;
- 14774 root 16 0 5744 5744 5532 S 93.2 0.5 0:01 1 httpd
- 14774 root 16 0 5744 5744 5532 S 1.9 0.5 0:01 1 httpd
- 14774 root 16 0 5744 5744 5532 S 8.5 0.5 0:01 1 httpd
- 14774 root 16 0 5744 5744 5532 S 26.4 0.5 0:01 0 httpd
- 14774 root 16 0 5744 5744 4860 S 99.9 0.5 0:00 1 httpd
- 14774 root 16 0 5744 5744 5540 S 17.0 0.5 0:00 0 httpd
- 14774 root 16 0 5744 5744 5540 S 41.8 0.5 0:00 0 httpd
- 14774 root 16 0 5744 5744 5540 S 1.9 0.5 0:00 0 httpd
- 14774 root 16 0 5744 5744 5540 S 69.5 0.5 0:01 1 httpd
- 14774 root 16 0 5744 5744 4860 S 99.9 0.5 0:00 1 httpd
- 14774 root 16 0 5744 5744 5540 S 48.4 0.5 0:00 0 httpd
- 14774 root 16 0 5744 5744 5540 S 5.7 0.5 0:00 0 httpd
- 14774 root 16 0 5744 5744 4860 S 99.9 0.5 0:00 0 httpd
- 16049 apache 17 0 0 0 0 Z 65.8 0.0 0:00 2 httpd <defunct>;
- 14774 root 16 0 5744 5744 5540 S 32.2 0.5 0:00 0 httpd
- 14774 root 16 0 5744 5744 5540 S 23.8 0.5 0:00 1 httpd
- 14774 root 16 0 5744 5744 5540 S 21.5 0.5 0:00 1 httpd
- 14774 root 16 0 5744 5744 5540 S 3.8 0.5 0:01 0 httpd
- 14774 root 16 0 5744 5744 5540 S 36.4 0.5 0:01 0 httpd
- 14774 root 16 0 5744 5744 5568 S 19.0 0.5 0:01 3 httpd
- 14774 root 16 0 5744 5744 4860 S 99.9 0.5 0:00 2 httpd
- 16177 apache 17 0 0 0 0 Z 99.9 0.0 0:01 0 httpd <defunct>;
- 16303 apache 17 0 0 0 0 Z 31.4 0.0 0:00 0 httpd <defunct>;
- 16429 apache 17 0 0 0 0 Z 16.1 0.0 0:00 0 httpd <defunct>;
- 14774 root 16 0 5744 5744 5540 S 56.0 0.5 0:00 1 httpd
- 14774 root 16 0 5744 5744 5588 S 40.8 0.5 0:01 0 httpd
- 14774 root 16 0 5744 5744 5568 S 32.3 0.5 0:01 0 httpd
- 14774 root 16 0 5744 5744 5540 S 30.5 0.5 0:01 0 httpd
- 14774 root 16 0 5744 5744 5540 S 2.8 0.5 0:02 3 httpd
- 14774 root 16 0 5744 5744 4860 S 99.9 0.5 0:00 3 httpd
- 14774 root 16 0 5744 5744 5540 S 12.3 0.5 0:00 3 httpd
- 14774 root 16 0 5744 5744 5540 S 28.6 0.5 0:00 3 httpd
复制代码
所以怎么样才能真正杜绝这个头痛的 <defunct>; 呢? 请各位不吝赐教! 谢谢!  |
|