Temos um servidor apache que interrompe as solicitações constantemente devido ao seguinte erro:
(70007)The timeout specified has expired: [client xxx.xxx.xxx.xxx:33740] AH01075: Error dispatching request to : (polling), referer: https://www.google.com/
[proxy_fcgi:error] [pid 12363:tid 139906999342848] [client xxx.xxx.xxx.xxx:6318] AH01067: Failed to read FastCGI header
Parece que não importa o que fazemos, isso continua acontecendo, eu tentei definir o tempo limite no arquivo php.conf:
#
# Cause the PHP interpreter to handle files with a .php extension.
#
RequestReadTimeout header=180 body=180
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php-fpm/php5-fpm.sock|fcgi://127.0.0.1 timeout=1800 connectiontimeout=1800"
</FilesMatch>
<Proxy "unix:/var/run/php-fpm/php5-fpm.sock|fcgi://127.0.0.1" timeout=1800 connectiontimeout=1800>
ProxySet timeout=1800 connectiontimeout=1800
</Proxy>
<Proxy "fcgi://127.0.0.1">
ProxySet timeout=1800 connectiontimeout=1800
</Proxy>
#<FilesMatch \.php$>
# SetHandler application/x-httpd-php
#</FilesMatch>
#
# Allow php to handle Multiviews
#
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#
#<FilesMatch \.phps$>
# SetHandler application/x-httpd-php-source
#</FilesMatch>
Do nosso arquivo mpm-worker.conf:
<IfModule worker.c>
ThreadLimit 60
StartServers 5
MaxClients 60
ServerLimit 60
MinSpareThreads 10
MaxSpareThreads 250
ThreadsPerChild 60
MaxRequestsPerChild 500
MaxRequestWorkers 300
</IfModule>
Do nosso arquivo vhosts:
<VirtualHost *:80>
LimitRequestBody 0
RewriteEngine On
RewriteOptions InheritBefore
DocumentRoot "/var/www/html"
ServerName xxxxx.com
</VirtualHost>
PHP_FPM www.conf:
[www]
listen = /var/run/php-fpm/php5-fpm.sock
listen.allowed_clients = 127.0.0.1
listen.backlog = 10240
listen.owner = apache
listen.group = apache
listen.mode = 0666
user = apache
group = apache
pm = dynamic
pm.max_children = 60
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 60
pm.max_requests = 500
;pm.status_path = /status
;ping.path = /ping
;ping.response = pong
rlimit_files = 10240
rlimit_core = unlimited
request_terminate_timeout = 180s
php_admin_value[post_max_size] = 64M
O tempo limite é definido como 180 para o Apache. php.ini tem default_socket_timeout = 180
Uso da memória: php_fpm:
ps -ylC php-fpm | awk '{x += $8;y += 1} END {print "PHP-FPM Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
PHP-FPM Memory Usage (MB): 5121.8
Average Proccess Size (MB): 62.4609
Apache:
ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
Apache Memory Usage (MB): 319.66
Average Proccess Size (MB): 39.9575
Memória:
total used free shared buffers cached
Mem: 7483 6141 1342 6 44 945
-/+ buffers/cache: 5150 2332
Swap: 0 0 0
Eu li um artigo sobre um patch, mas ele não se aplica à nossa versão do Apache em relação ao problema de tempo limite.
MySQL e Memcached estão sendo executados em outros servidores.
Alguma idéia?