我们正在运行 Apache 2.2.15 和 PHP 5.3.3
我们偶尔会遇到 Apache 过载的情况,进程卡在“W - 发送回复”状态。这种情况似乎是随机发生的,会持续大约一个小时左右。我们不对服务器做任何事情,问题就会消失。正如我所提到的,当问题发生时,运行“apachectl status”将显示大多数客户端卡在“W” - 发送回复状态。MySQL 还会显示一堆处于睡眠状态的连接。然后 New relic 将显示 redis 响应时间极高。我们正在使用 redis 作为 magento 缓存。
我们检查了 Apache 错误日志,其中没有任何异常。有人建议我们将 Apache 升级到 2.2.31,将 PHP 升级到 5.5,但我们不确定这是否能解决问题。
有什么想法吗?当问题发生时,我们对 PID 进行了 strace,结果如下。这只是不断重复:
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$32\r\nzc:k:e22_Zend"..., 60, MSG_DONTWAIT, NULL, 0) = 60
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$175\r\na:7:{s:3:\"sun\";s:6:\"Sunday"..., 8192, MSG_DONTWAIT, NULL, NULL) = 183
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$34\r\nzc:k:e22_Zend"..., 62, MSG_DONTWAIT, NULL, 0) = 62
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$216\r\na:12:{i:1;s:7:\"January\";i:"..., 8192, MSG_DONTWAIT, NULL, NULL) = 224
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$62\r\nzc:k:e22_Zend"..., 90, MSG_DONTWAIT, NULL, 0) = 90
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$178\r\na:12:{i:1;s:3:\"Jan\";i:2;s:"..., 8192, MSG_DONTWAIT, NULL, NULL) = 186
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/America/Chicago", {st_mode=S_IFREG|0644, st_size=3543, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/America/Chicago", {st_mode=S_IFREG|0644, st_size=3543, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "\343\0\0\0\3SELECT COUNT(DISTINCT e.ent"..., 231) = 231
read(26, "\1\0\0\1\0011\0\0\2\3def\0\0\0\33COUNT(DISTINCT "..., 16384) = 83
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "[\0\0\0\3SELECT `catalog_category_en"..., 95) = 95
read(26, "\1\0\0\1\n]\0\0\2\3def\7magento\27catalog_ca"..., 16384) = 1085
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "\n\7\0\0\3SELECT `attr_table`.* FROM "..., 1806) = 1806
read(26, "\1\0\0\1\6&\0\0\2\3def\0\0\0\10value_id\10value_"..., 16384) = 961
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$32\r\nzc:k:e22_Zend"..., 60, MSG_DONTWAIT, NULL, 0) = 60
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$175\r\na:7:{s:3:\"sun\";s:6:\"Sunday"..., 8192, MSG_DONTWAIT, NULL, NULL) = 183
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$34\r\nzc:k:e22_Zend"..., 62, MSG_DONTWAIT, NULL, 0) = 62
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$216\r\na:12:{i:1;s:7:\"January\";i:"..., 8192, MSG_DONTWAIT, NULL, NULL) = 224
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$62\r\nzc:k:e22_Zend"..., 90, MSG_DONTWAIT, NULL, 0) = 90
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$178\r\na:12:{i:1;s:3:\"Jan\";i:2;s:"..., 8192, MSG_DONTWAIT, NULL, NULL) = 186
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/America/Chicago", {st_mode=S_IFREG|0644, st_size=3543, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/America/Chicago", {st_mode=S_IFREG|0644, st_size=3543, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "\343\0\0\0\3SELECT COUNT(DISTINCT e.ent"..., 231) = 231
read(26, "\1\0\0\1\0011\0\0\2\3def\0\0\0\33COUNT(DISTINCT "..., 16384) = 83
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "\\\0\0\0\3SELECT `catalog_category_en"..., 96) = 96
read(26, "\1\0\0\1\n]\0\0\2\3def\7magento\27catalog_ca"..., 16384) = 1082
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "\20\7\0\0\3SELECT `attr_table`.* FROM "..., 1812) = 1812
read(26, "\1\0\0\1\6&\0\0\2\3def\0\0\0\10value_id\10value_"..., 16384) = 966
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$32\r\nzc:k:e22_Zend"..., 60, MSG_DONTWAIT, NULL, 0) = 60
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$175\r\na:7:{s:3:\"sun\";s:6:\"Sunday"..., 8192, MSG_DONTWAIT, NULL, NULL) = 183
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$34\r\nzc:k:e22_Zend"..., 62, MSG_DONTWAIT, NULL, 0) = 62
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$216\r\na:12:{i:1;s:7:\"January\";i:"..., 8192, MSG_DONTWAIT, NULL, NULL) = 224
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
sendto(25, "*3\r\n$4\r\nHGET\r\n$62\r\nzc:k:e22_Zend"..., 90, MSG_DONTWAIT, NULL, 0) = 90
poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=25, revents=POLLIN}])
recvfrom(25, "$178\r\na:12:{i:1;s:3:\"Jan\";i:2;s:"..., 8192, MSG_DONTWAIT, NULL, NULL) = 186
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/America/Chicago", {st_mode=S_IFREG|0644, st_size=3543, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
stat("/usr/share/zoneinfo/America/Chicago", {st_mode=S_IFREG|0644, st_size=3543, ...}) = 0
stat("/usr/share/zoneinfo/UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "\376\0\0\0\3SELECT COUNT(DISTINCT e.ent"..., 258) = 258
read(26, "\1\0\0\1\0011\0\0\2\3def\0\0\0\33COUNT(DISTINCT "..., 16384) = 83
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "[\0\0\0\3SELECT `catalog_category_en"..., 95) = 95
read(26, "\1\0\0\1\n]\0\0\2\3def\7magento\27catalog_ca"..., 16384) = 1087
poll([{fd=26, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
write(26, "\n\7\0\0\3SELECT `attr_table`.* FROM "..., 1806) = 1806
read(26, "\1\0\0\1\6&\0\0\2\3def\0\0\0\10value_id\10value_"..., 16384) = 956