Eu tenho nginx como um proxy de front end e apache com mod_fcgid.
Esta caixa tem 24 GB de RAM e 16 núcleos. Eu não deveria estar gargalhando.
Parece haver um gargalo. Depois de atingir 7000 solicitações, ele trava antes de continuar.
EDIT 3:
Alguém pode explicar PHP_FCGI_CHILDREN
? Eu configurei para 1 e o material parece funcionar melhor. Definindo melhor melhor? Ele realmente se estende a muitos processos, como loucos, é mais alto.
EDITAR:
log de erro sábio:
(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
EDIT - QUESTION 2
Porque eu estou usando o nginx como um proxy frontend. É possível que eu esteja maximizando todas as minhas portas, portanto, não posso mais enviar para o backend (apache)? Eu também notei que os procs PHP morrem rápido
16409 USER 20 0 0 0 0 Z 27.2 0.0 0:00.82 [php] <defunct>
Mesmo com algo assim, ele falha:
/usr/local/apache/bin/ab -n 1000000 -c 10 http://IP/index.php
apr_poll: The timeout specified has expired (70007)
Total of 23998 requests completed
Meus resultados:
/usr/local/apache/bin/ab -n 10000 -c 100 http:///index.php
Document Path: /index.php
Document Length: 55764 bytes
Concurrency Level: 100
Time taken for tests: 52.076 seconds
Complete requests: 10000
Failed requests: 17
(Connect: 0, Receive: 0, Length: 17, Exceptions: 0)
Write errors: 0
Non-2xx responses: 17
Total transferred: 558563436 bytes
HTML transferred: 556703249 bytes
Requests per second: 192.03 [#/sec] (mean)
Time per request: 520.764 [ms] (mean)
Time per request: 5.208 [ms] (mean, across all concurrent requests)
Transfer rate: 10474.46 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 6
Processing: 3 436 3978.0 3 52069
Waiting: 2 436 3978.0 3 52069
Total: 3 436 3978.1 3 52073
Percentage of the requests served within a certain time (ms)
50% 3
66% 4
75% 4
80% 4
90% 5
95% 5
98% 1018
99% 29055
100% 52073 (longest request)
/etc/sysctl.conf
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.tcp_fin_timeout = 25
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.tcp_reordering = 5
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_max_syn_backlog = 2048
net.core.netdev_max_backlog = 1024
net.core.hot_list_length = 256
net.ipv4.tcp_max_tw_buckets = 360000
net.core.rmem_default = 65535
net.core.rmem_max = 8388608
net.ipv4.tcp_rmem = 4096 87380 8388608
net.core.wmem_default = 65535
net.core.wmem_max = 8388608
net.ipv4.tcp_wmem = 4096 65535 8388608
net.ipv4.tcp_mem = 8388608 8388608 8388608
net.core.optmem_max = 40960
net.ipv4.netfilter.ip_conntrack_max = 32768
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_orphan_retries = 1
net.ipv4.tcp_fin_timeout = 25
net.ipv4.tcp_max_orphans = 8192
net.ipv4.ip_local_port_range = 2768 61000
fs.file-max = 209708
/ usr / local / cpanel / cgi-sys / php5
export PHP_FCGI_CHILDREN=0
exec /usr/bin/php
/usr/local/apache/conf/php.conf
LoadModule fcgid_module modules/mod_fcgid.so
MaxRequestsPerProcess 1000
FcgidMaxProcesses 200
FcgidProcessLifeTime 3600
MaxProcessCount 200
FcgidIOTimeout 2000
FcgidIdleTimeout 60
FcgidIdleScanInterval 30
FcgidBusyTimeout 300
FcgidBusyScanInterval 80
ErrorScanInterval 3
ZombieScanInterval 3
FcgidMinProcessesPerClass 5
FcgidMaxProcessesPerClass 150
DefaultMinClassProcessCount 5
DefaultMaxClassProcessCount 150
IPCCommTimeout 40
IPCConnectTimeout 10
MaxRequestLen 1073741824
AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml
Apache
Timeout 5
TraceEnable Off
ServerSignature Off
ServerTokens ProductOnly
FileETag None
StartServers 15
<IfModule prefork.c>
MinSpareServers 5
MaxSpareServers 10
</IfModule>
ServerLimit 256
MaxClients 150
MaxRequestsPerChild 1000
KeepAlive Off
KeepAliveTimeout 1
MaxKeepAliveRequests 1
link
Server version: Apache/2.2.23 (Unix)
Server built: Jan 29 2013 11:18:48
Cpanel::Easy::Apache v3.16.7 rev9999
Server's Module Magic Number: 20051115:31
Server loaded: APR 1.4.6, APR-Util 1.4.1
Compiled using: APR 1.4.6, APR-Util 1.4.1
Architecture: 64-bit
Server MPM: Event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/experimental/event"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/usr/local/apache"
-D SUEXEC_BIN="/usr/local/apache/bin/suexec"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
log de erros do nginx
2013/02/06 18:12:50 [notice] 15123#0: signal 17 (SIGCHLD) received
2013/02/06 18:12:50 [notice] 15123#0: worker process 15127 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: worker process 15128 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: worker process 15129 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: worker process 15131 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: worker process 15137 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: worker process 15139 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: signal 29 (SIGIO) received
2013/02/06 18:12:50 [notice] 15123#0: signal 17 (SIGCHLD) received
2013/02/06 18:12:50 [notice] 15123#0: worker process 15124 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: signal 29 (SIGIO) received
2013/02/06 18:12:50 [notice] 15123#0: signal 17 (SIGCHLD) received
2013/02/06 18:12:50 [notice] 15123#0: worker process 15136 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: signal 29 (SIGIO) received
2013/02/06 18:12:50 [notice] 15123#0: signal 17 (SIGCHLD) received
2013/02/06 18:12:50 [notice] 15123#0: worker process 15125 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: signal 29 (SIGIO) received
2013/02/06 18:12:50 [notice] 15123#0: signal 17 (SIGCHLD) received
2013/02/06 18:12:50 [notice] 15123#0: worker process 15130 exited with code 0
2013/02/06 18:12:50 [notice] 15123#0: signal 29 (SIGIO) received