lsc153 发表于 2013-11-02 22:44

centos6.4 apache并发上不去 出现Connection timed out


系统 Centos6.4 64bit 2个双核16线程16G内存
apache2.2 php5.3

apache 并发修改
StartServers       20
MinSpareServers    20
MaxSpareServers   50
ServerLimit      10000
MaxClients       10000
内核优化
fs.file-max = 1048576
net.ipv4.ip_forward = 0
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 12000
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog =32768
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
文件 进程数
# End of file
*                     soft   nofile             60000
*                     hard   nofile             65535
*                     soft   nproc            65535
*                     hard   nproc            65535

pr_socket_recv: Connection timed out (110)
apr_socket_recv: Connection timed out (110)
apr_socket_recv: Connection timed out (110)
apr_socket_recv: Connection timed out (110)
apr_socket_recv: Connection timed out (110)
apr_socket_recv: Connection timed out (110)
Completed 5000 requests
Finished 5000 requests

修改过源码的ab 在局域网的另一台机器上测试 (测试机同样优化了)
../ab/ab-standalone/ab -c 1500 -n 5000 http://www.cnintest.com/
Server Software:      Apache/2.2.15
Server Hostname:      www.cnintest.com
Server Port:            80

Document Path:          /
Document Length:      16169 bytes

Concurrency Level:      1500
Time taken for tests:   14.532 seconds
Complete requests:      5000
Failed requests:      2739
   (Connect: 0, Receive: 913, Length: 913, Exceptions: 913)
Write errors:         0
Total transferred:      67521955 bytes
HTML transferred:       66147379 bytes
Requests per second:    344.07 [#/sec] (mean)
Time per request:       4359.523 (mean)
Time per request:       2.906 (mean, across all concurrent requests)
Transfer rate:          4537.61 received


并发数上不去出现 Connection timed out
改nginx + php-fpm 情况也一样(可能我配置不熟)
请教各位大神。。

页: [1]
查看完整版本: centos6.4 apache并发上不去 出现Connection timed out