| 
 | 
 
# more nginx/error.log 
2010/08/18 14:42:19 [error] 18256#0: *264534 readv() failed (104:Connection reset by peer) while reading upstream, client:6.217.2 
36.22, server: wo.china.com, request: "GET /list/index/rcreated/HTTP/1.0", upstream: "fastcgi://127.0.0.1:10080", host:"www.hichi 
na.com" 
2010/08/18 14:46:55 [error] 18254#0: *272781 upstream prematurelyclosed connection while reading response header from upstream,cli 
ent: 6.217.236.22, server: wo.china.com, request: "GET /top/HTTP/1.0", upstream: "fastcgi://127.0.0.1:10080", host:"www.hichina. 
com" 
2010/08/18 14:46:55 [error] 18254#0: *272781 open()"/var/www/nginx-default/50x.html" failed (2: No such file ordirectory), client: 
 6.217.236.22, server: wo.china.com, request: "GET /top/HTTP/1.0", upstream: "fastcgi://127.0.0.1:10080", host:"www.hichina.com" 
# more kern.log 
Aug 18 14:42:18 w23 kernel: [2524799.982979] php-cgi[30124]:segfault at 45 ip 082da5bf sp bfd89c50 error 4 inphp5-cgi[8048000+4c 
c000] 
 
出现这种问题的原因:# ab -c 1000 -n 10000http://www.hichina.com/list/index/rcreated/ 
在用ab测试之前: 
root@web23:/var/log# netstat -anp 
Active Internet connections (servers and established) 
Proto Recv-Q Send-Q LocalAddress          Foreign Address        State       PID/Program name 
tcp       0      0127.0.0.1:10080        0.0.0.0:*              LISTEN     4145/php-cgi    
在用ab测试之后: 
root@web23:/var/log# netstat -anp|more 
Active Internet connections (servers and established) 
Proto Recv-Q Send-Q LocalAddress          Foreign Address        State       PID/Program name 
tcp       0      0127.0.0.1:10080        0.0.0.0:*              LISTEN     4145/php-cgi    
说明:在用ab测试后cgi的pid相同,说明不是网上说的“由于php-cgi重启或者cgi进程死掉造成的” 
$ ps aux|grep php-cgi|wc 
    514    5655   42144 
 
# ulimit -a 
core filesize          (blocks,-c) 0 
data segsize          (kbytes, -d) unlimited 
schedulingpriority            (-e) 0 
filesize              (blocks, -f) unlimited 
pendingsignals                (-i) 16382 
max locked memory       (kbytes, -l)64 
max memory size        (kbytes, -m) unlimited 
openfiles                     (-n) 1024 
pipesize           (512 bytes, -p) 8 
POSIX message queues     (bytes, -q) 819200 
real-timepriority             (-r) 0 
stacksize             (kbytes, -s) 8192 
cputime              (seconds, -t) unlimited 
max userprocesses             (-u) unlimited 
virtualmemory         (kbytes, -v) unlimited 
filelocks                     (-x) unlimited 
  
  
ab压力测试,问题及原因: 
# ab  -c 515 -n 1000 http://192.168.206.121/ 
2010/08/26 10:35:03 [alert] 13342#0: *8353 socket() failed (24: Toomany open files) while connecting to upstream, client:192.168.206.120, 
server: localhost, request: "GET / HTTP/1.0", upstream:"fastcgi://127.0.0.1:10080", host:"192.168.206.121"(超过了cgi进程的个数) 
  
2010/08/26 10:53:16 [alert] 15016#0: *4644 1024worker_connections are not enough while connecting to upstream,client: 192.168.206.120, server: 
localhost, request: "GET / HTTP/1.0", upstream:"fastcgi://127.0.0.1:10080", host:"192.168.206.121"(增加worker_connections的数量) 
  
2010/08/26 17:26:21 [error] 12936#0: *685388 connect() failed(111: Connection refused) while connecting to upstream, client:192.168.206.121, 
server: localhost, request: "GET /info.php HTTP/1.0", upstream:"fastcgi://127.0.0.1:10080", host: "192.168.206.121" |   
 
 
 
 |