2017-04-05 106 views
1

我有一台带有php的Apache服务器。Apache TIME_WAIT连接,solaris上的php 11.2

  • S.O.在solaris 11.2
  • 阿帕奇2.2
  • PHP 28年3月5日

  • RAM 20G

  • 16个核

在阿帕奇我已经配置40个结构域,具有以下特征:

<VirtualHost *:80> 
    ServerName domain.com 
    LogFormat  "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" **%T/%D**" combined_t 
    ErrorLog  "|/usr/apache2/2.2/bin/rotatelogs /opt/avv2002_data/logs/domain_err.%Y%m%d 86400" 
    CustomLog  "|/usr/apache2/2.2/bin/rotatelogs /opt/avv2002_data/logs/domain_log.%Y%m%d 86400" combined_t 
    LogLevel info 
    DocumentRoot "/opt/www/apache/joomla/sites/" 
    DirectoryIndex index.htm index.html index.php 
    <Directory "/opt/www/apache/joomla/sites/"> 
     Options -Indexes FollowSymlinks Includes MultiViews 
AllowOverride All 
     RewriteEngine on 
     RewriteCond %{REQUEST_FILENAME} -s [OR] 
     RewriteCond %{REQUEST_FILENAME} -l [OR] 
     RewriteCond %{REQUEST_FILENAME} -d 
     RewriteRule ^.*$ - [NC,L] 
     RewriteRule ^.*$ index.html [NC,L] 
    </Directory> 
</VirtualHost> 

前几天开发上传编辑一个新的应用程序在PHP和我的服务器开始与RAM和CPU的问题,看起来有点我发现以下几点:

过程,儿童和TIME_WAIT太多。

例如:

使用swap。

与PMAP提取物交换

互换:212276个字节PID:23158

# ps auxww | grep 23158 

webservd 23158 0.1 0.121227628216 ?  S 11:49:57 0:06 /usr/apache2/2.2/bin/httpd -k start 

看到太多TIME_WAIT

netstat -aun | grep 23158 

serverip.80  serverip.61768 root  23158 httpd   44876  0 65160  0 TIME_WAIT 
serverip.80  serverip.31254 root  23158 httpd   7843  0 65160  0 TIME_WAIT 
serverip.80  serverip.55937 root  23158 httpd   7262  0 65160  0 TIME_WAIT 
serverip.80  serverip.52572 root  23158 httpd   4845  0 65160  0 TIME_WAIT 
serverip.80  serverip.49687 root  23158 httpd   7075  0 65160  0 TIME_WAIT 
serverip.80  serverip.29891 root  23158 httpd   29310  0 65160  0 TIME_WAIT 
serverip.80  serverip.57332 root  23158 httpd   9557  0 65160  0 TIME_WAIT 
serverip.80  serverip.20296 root  23158 httpd   7262  0 65160  0 TIME_WAIT 
serverip.80  serverip.16077 root  23158 httpd   61246  0 65160  0 TIME_WAIT 

....... 


netstat -aun | grep "ipserver.80" | wc -l 
2077 

ps auxww | grep "/usr/apache2/2.2/bin/httpd -k start" | wc -l 
507 

我的Apache服务器状态显示完整wwwwwwwwwwwww

pache Server Status for serverip 

Server Version: Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1h DAV/2 PHP/5.3.28 mod_fcgid/2.3.9 
Server Built: Jun 17 2014 11:19:37 
Current Time: Wednesday, 05-Apr-2017 13:50:10 CDT 
Restart Time: Wednesday, 05-Apr-2017 13:12:10 CDT 
Parent Server Generation: 0 
Server uptime: 38 minutes 
Total accesses: 125046 - Total Traffic: 3.6 GB 
CPU Usage: u404.25 s342.99 cu0 cs0 - 32.8% CPU load 
54.8 requests/sec - 1.6 MB/second - 30.4 kB/request 
29 requests currently being processed, 0 idle workers 

WWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 
WWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 
WWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 
WWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 
WWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 
WWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 
WWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 
WWWWWWwWWWWWW 

有没有什么方法可以查看哪个域是大量流量的域?通过这种方式,你可以确切地知道什么是什么样的发展的团队修改

我想PHP的探查,看看哪些领域所花费的时间

任何想法,我应该检查什么吗?

+0

交叉发表:http://unix.stackexchange.com/questions/356224/apache-time-wait-connections-w-sending-reply-and-php-on-solaris-11-2 –

回答

0

您已达到工作人员的最大数量,您需要增加它。我们发布了一个关于how to increase the max number of Apache workers on WHM的指南,对于您的情况,您需要在Apache的配置文件(将您的MaxClients更改为1024)中手动执行此操作。

现在的问题是,为什么你达到了最大数量的工人,是因为真正的交通还是因为别的东西?

我的建议是检查Apache日志(我不知道Solaris上的结构是什么,上次我在2004年开始工作),并查看哪个网站流量最大(这是具有最大日志的流量)。然后,您应该分析流量:这是真正的流量吗?它是否是bot流量?如果它是bot流量,那么它是否合法的bot流量(如果不是,那么你应该阻止所有这些非法漫游器)?

如果是真实的流量,那么你有很多的404s?如果是的话,那么你需要解决这些404s - 因为每个404将需要在Joomla实例中的另一名工作人员。

+1

我修改了设置,甚至每天下降一次(在每隔5分钟之前)。没有使用数据库,所以我认为它应该是一些PHP脚本,但我无法查看它是哪个域,因为我配置了许多域。这是我的Apache配置:StartServers的10周 的MinSpareServers 25个 MaxSpareServers的500米 了ServerLimit 1400米 的MaxClients 1400 MaxRequestsPerChild 1000 – ymk369

+0

你检查Apache日志,看看哪一个具有最大的日志大小? – itoctopus