当入行压力测试时出现下列错误
[[email protected] ~]# ab -n 3000 -c 3000 http://192.168.0.2/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.0.2 (be patient)
socket: Too many open files (24)
解决方法:
查看当前要以打开的文件个数
[[email protected] ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 14802
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 14802
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
调整可以打开的文件数
[[email protected] ~]# ulimit -n 65535
重新执行该命令
[[email protected] ~]# ab -n 3000 -c 3000 http://192.168.0.2/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.0.2 (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: Apache/2.2.15
Server Hostname: 192.168.0.2
Server Port: 80
Document Path: /
Document Length: 3985 bytes
Concurrency Level: 3000
Time taken for tests: 4.034 seconds
Complete requests: 3000
Failed requests: 0
Write errors: 0
Non-2xx responses: 3001
Total transferred: 12554896 bytes
HTML transferred: 11957697 bytes
Requests per second: 743.75 [#/sec] (mean)
Time per request: 4033.602 [ms] (mean)
Time per request: 1.345 [ms] (mean, across all concurrent requests)
Transfer rate: 3039.63 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 553 995.8 2 3061
Processing: 23 284 308.2 159 3235
Waiting: 22 280 308.1 156 3235
Total: 95 837 1149.6 198 3809
Percentage of the requests served within a certain time (ms)
50% 198
66% 394
75% 1134
80% 1347
90% 3333
95% 3696
98% 3788
99% 3795
100% 3809 (longest request)
问题解决
在执行ab压力测试时出现socket: Too many open files (24)的解决方法,布布扣,bubuko.com