今天用apache 自带的ab工具测试,当并发量达到1000多的时候报错如下:
[root@aa~]# This is ApacheBench, Version 2.3 <Revision:655654Revision: 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.1.176 (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
apr_socket_recv: Connection reset by peer (104)
Total of 1085 requests completed

查看应用服务器和数据库均未报错,连接被重置,bingyi了以下,apr_socket_recv这个是操作系统内核的一个参数,在高并发的情况下,内核会认为系统受到了SYN flood攻击,会发送cookies(possible SYN flooding on port 80. Sending cookies),这样会减慢影响请求的速度,所以在应用服务武器上设置下这个参数为0禁用系统保护就可以进行大并发测试了:

# vim /etc/sysctl.conf
net.ipv4.tcp_syncookies = 0
# sysctl -p

然后就可以超过1000个并发测试了。

另附其他系统内核参数说明:

net.ipv4.tcp_syncookies = 0
#此参数是为了防止洪水攻击的,但对于大并发系统,要禁用此设置net.ipv4.tcp_max_syn_backlog
#参数决定了SYN_RECV状态队列的数量,一般默认值为512或者1024,即超过这个数量,系统将不再接受新的TCP连接请求,一定程度上可以防止系统资源耗尽。可根据情况增加该值以接受更多的连接请求。net.ipv4.tcp_tw_recycle
#参数决定是否加速TIME_WAIT的sockets的回收,默认为0。net.ipv4.tcp_tw_reuse
#参数决定是否可将TIME_WAIT状态的sockets用于新的TCP连接,默认为0。net.ipv4.tcp_max_tw_buckets
#参数决定TIME_WAIT状态的sockets总数量,可根据连接数和系统资源需要进行设置。 

另外ab中自带参数
-r Don’t exit on socket receive errors.
可以避免并发过大出现错误,从而实现大并发测试,建议使用此方法。

ab 的各种参数

    -n requests     Number of requests to perform-c concurrency  Number of multiple requests to make at a time-t timelimit    Seconds to max. to spend on benchmarkingThis implies -n 50000-s timeout      Seconds to max. wait for each responseDefault is 30 seconds-b windowsize   Size of TCP send/receive buffer, in bytes-B address      Address to bind to when making outgoing connections-p postfile     File containing data to POST. Remember also to set -T-u putfile      File containing data to PUT. Remember also to set -T-T content-type Content-type header to use for POST/PUT data, eg.'application/x-www-form-urlencoded'Default is 'text/plain'-v verbosity    How much troubleshooting info to print-w              Print out results in HTML tables-i              Use HEAD instead of GET-x attributes   String to insert as table attributes-y attributes   String to insert as tr attributes-z attributes   String to insert as td or th attributes-C attribute    Add cookie, eg. 'Apache=1234'. (repeatable)-H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'Inserted after all normal header lines. (repeatable)-A attribute    Add Basic WWW Authentication, the attributesare a colon separated username and password.-P attribute    Add Basic Proxy Authentication, the attributesare a colon separated username and password.-X proxy:port   Proxyserver and port number to use-V              Print version number and exit-k              Use HTTP KeepAlive feature-d              Do not show percentiles served table.-S              Do not show confidence estimators and warnings.-q              Do not show progress when doing more than 150 requests-l              Accept variable document length (use this for dynamic pages)-g filename     Output collected data to gnuplot format file.-e filename     Output CSV file with percentages served-r              Don't exit on socket receive errors.-h              Display usage information (this message)-Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)-f protocol     Specify SSL/TLS protocol(SSL3, TLS1, TLS1.1, TLS1.2 or ALL)
- n请求执行的请求数
- c多次请求的并发数
- t限时秒到最大值。花在基准测试
这意味着- n 50000
- s超时秒到最大值。等待每个响应
默认值为30秒
- b窗口大小的TCP发送/接收缓冲区,以字节为单位
- b地址地址在发送连接时绑定
-p postfile文件,包含要发布的数据。记住也要设置- t
-u putfile文件中包含的数据。记住也要设置- t
- t内容类型的内容类型标题用于POST / PUT数据。
“应用程序/ x-www -表单- urlen编码”
默认是“text / plain”
-v verbosity有多少故障排除信息打印
- w打印结果在HTML表
我用HEAD代替GET
- x属性字符串作为表属性插入
- y属性字符串作为tr属性插入
- z属性字符串作为td或th属性插入
- c属性添加cookie。Apache = 1234。(重复)
- h属性添加任意标题行。“接受编码:gzip”
插入所有正常的标题行。(重复)
属性添加基本的WWW认证,属性
是一个冒号分隔的用户名和密码。
- p属性添加基本代理身份验证,属性
是一个冒号分隔的用户名和密码。
- x代理:使用端口Proxyserver和端口号
- v打印版本号,退出
- k使用HTTP KeepAlive功能
- d不显示百分比表。
- s不显示置信估计者和警告。
当超过150个请求时,q没有显示进展
- l接受可变文档长度(用于动态页面)
- g文件名输出数据到gnuplot格式文件。
- e文件名输出CSV文件的百分比
- r不退出套接字接收错误。
- h显示使用信息(此消息)
- z ciphersuite指定SSL / TLS密码套件(见openssl密码)
- f协议指定SSL / TLS协议
(SSL3,TLS1,TLS1.1,TLS1.2或全部)

apache ab压力测试报错相关推荐

  1. apache ab压力测试报错apr_socket_recv

    apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104)) apache 自带的ab工具测试,当并发量达到1000多的时候报错如下 ...

  2. ubuntu 解决ab压力测试报错apr_socket_recv: Connection reset by peer (104)问题

    今天用apache 自带的ab工具测试,当并发量达到1000多的时候报错如下: Completed 700 requests Completed 800 requests apr_socket_rec ...

  3. Apache AB 压力测试

    2019独角兽企业重金招聘Python工程师标准>>> Apache AB 压力测试  安装 // 安装工具 yum install httpd-tools 使用 // URL 是网 ...

  4. Apache ab压力测试工具

    查看apache是否安装 # rpm -qa httpd httpd-2.2.3-63.el5.centos (在apache 版本2以后,apache全部改名为httpd) ab压力测试工具是apa ...

  5. Apache ab压力测试说明

    转自: http://leepiao.blog.163.com/blog/static/485031302010234352282/ 压力测试是一种基本的质量保证行为,它是每个重要软件测试工 作的一部 ...

  6. 【Apache】Apache ab压力测试工具Window下载和用法详解

    ab是apache自带的网站压力测试工具.  使用起来非常的简单和方便.  不仅仅是可以apache服务器进行网站访问压力测试,还可以对其他类型的服务器进行压力测试.  比如nginx,tomcat, ...

  7. apache ab压力测试工具-批量压测脚本

    概述 ab(Apache benchmark)是一款常用的压力测试工具.简单易用,ab的命令行一次只能支持一次测试.如果想要批量执行不同的测试方式,并自动对指标进行分析,那么单靠手工一条一条命令运行a ...

  8. apache ab压力测试学习

    转载自  https://segmentfault.com/a/1190000012765485 1.介绍 网站性能压力测试是服务器网站性能调优过程中必不可缺少的一环.只有让服务器处在高压情况下,才能 ...

  9. Apache ab 压力测试工具

    Apache Bin目录下的 ab.exe(ApacheBench) 程序是专门用在做压力测试用的软件. ApacheBench(ab) 用来测试 apache 执行效率,专门用来执行网站服务器的运行 ...

最新文章

  1. 【大话数据结构算法】直接选择排序
  2. python实例化类执行顺序_Python实例化class的执行顺序
  3. eager_EAGER的获取是代码的味道
  4. apply和call用法
  5. 【MySQL】Java对SQL时间类型的操作(获得当前、昨天、前年。。时间)
  6. 执行 redis-dump 报错:ERROR (Errno::ENOENT): No such file or directory - ps -o rss= -p xxxxx
  7. php中设置文件权限的写法,php图片上传,如何设置文件权限
  8. 入门系列之在Ubuntu 16.04使用Buildbot建立持续集成系统
  9. Gated Convolution
  10. mqtt c语言 单片机,MQTT--单片机实现即时通讯
  11. python是哪个专业学的-专业python培训学校
  12. Dynamics 365Online Server-Side OAuth身份认证二(S2S)
  13. 中国不是不能开发出自己的浏览器,而是没必要
  14. Java练习之坦克大战!!!复制可以直接用!!!文章最后有飞机大战代码!!!
  15. websocket实现消息群发
  16. JScrollPane的使用
  17. 开源mysql数据库审计工具_Yearning基于Inception的开源SQL审核平台(数据库审计)
  18. 学校学生计算机教室解决方案,学校学生计算机教室解决方案设计.docx
  19. 2018年第九届蓝桥杯【C++省赛B组】【第三题:乘积尾零】——附解题代码
  20. elementUI:el-upload分片上传大视频到七牛云

热门文章

  1. python中的tkinter_基于python中tkinter的计算机实现
  2. java对mysql读写权限设置_Java学习笔记——MySQL开放3306接口与设置用户权限
  3. 2003文件共享服务器搭建,用Windows Server 2003搭建安全文件服务器(2)
  4. linux上修改html,linux进程名修改
  5. go 跨平台编译linux,golang 跨平台编译
  6. 内存条上面参数详解_为什么买内存条要看时序?别以为内存频率高性能就好
  7. markdown格式_第1篇:如何将Markdown笔记转入ANKI复习? | 学习骇客
  8. 对象工厂PHP,php – 域对象工厂是什么样的?
  9. 通信线路工程验收规范 gb51171-2016_老杨一建通信学堂通信线路工程施工技术
  10. php 多数据库联合查询,php如何同时连接多个数据库_PHP教程