博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
socket: Too many open files
阅读量:5735 次
发布时间:2019-06-18

本文共 2398 字,大约阅读时间需要 7 分钟。

hot3.png

当入行压力测试时出现下列错误

[root@zabbix ~]# 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)

解决方法:

查看当前要以打开的文件个数

[root@zabbix ~]# 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

调整可以打开的文件数

[root@zabbix ~]# ulimit -n 65535

重新执行该命令

[root@zabbix ~]# 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)

问题解决

转载于:https://my.oschina.net/ydsakyclguozi/blog/626359

你可能感兴趣的文章
IntelliJ IDEA 连接数据库详细过程
查看>>
thymeleaf 学习笔记-基础篇
查看>>
分享话题列表
查看>>
PHP-X开发扩展
查看>>
android学习笔记——onSaveInstanceState的使用
查看>>
Windows Server 2003下cwRsyncServer服务端与cwRsync客户端数据
查看>>
iOS 打包上传没有用到日历,但是提示需要在info.plist文件中加入NSCalendarsUsageDescription...
查看>>
工作中如何做好技术积累
查看>>
怎么用sysLinux做U盘双PE+DOS??
查看>>
Spring Transactional
查看>>
shell脚本实例
查看>>
我的友情链接
查看>>
Windows Phone 7 隔离存储空间资源管理器
查看>>
Oracle树形结构的sql语句
查看>>
Microsoft Excel 2000/2003修复工具
查看>>
apache安装报错undefined reference ssl
查看>>
关于爱情只有一句忠告
查看>>
CentOS LVM 新加硬盘,扩容逻辑卷步骤
查看>>
CentOS 7下安装部署Oracle11g图文教程
查看>>
F#初学笔记06
查看>>