Httpd/mysql 持续占用 500% 的 CPU

Httpd/mysql 持续占用 500% 的 CPU

我们使用的是 CentOS 5 的 VPS,带有 cPanel + WHM 11 最新版本

我们昨晚开始注意到 httpd 和偶尔的 mysql 的 CPU 使用率持续达到 500% 的峰值,以至于我们的主机因此一直暂停我们的帐户。

我们派出两个服务器团队来调查此事,但都无法确定为什么会发生这种情况。

我们没有遇到任何流量涌入,并且代码方面也没有发生任何重大变化。

我们在 Apache 错误日志中看到很多这样的情况

[Mon Nov 16 21:53:24 2009] [error] [client 65.55.207.22] Request exceeded the limit of 200 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

我在代码中找不到任何重定向循环,到目前为止我们的 .htaccess 配置还没有引起任何问题:

DirectoryIndex home.html index.htm index.html index.php


RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteCond %{HTTPS}s<>%1 ^(on(s)|offs)<>(.*)
RewriteRule ^(.*) http%2://%3/$1 [L,R=permanent]

RewriteRule ^c/([0-9]+)$ /main/?p=$1 [R=301,L]


Addhandler application/x-httpd-php5 .html .inc
AddHandler application/x-httpd-php5 .inc .html

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

我意识到这并不是很多信息,如果不深入研究就很难说,但如果有什么事情引起任何警告,或者您对我们可以进一步调查的地方有任何建议,我就想把这个提出来。

答案1

首先,查看该客户端的访问日志,看看它请求了什么。这至少应该能让你知道是什么导致了重定向。

接下来,尝试使用 Perl 的 lwp-request 获取该 URL:

lwp-request -esSd http://the/offending/url

这应该能帮你找出问题所在,而且成功率高达 90%。

相关内容