网站并发测试,网站服务使用的是apache2.4 因此使用ab来测试网站性能。

windows使用cms 打开apache/bin 运行ab.exe (......../apache/bin/ab),提示出很多参数,大家可以去查看,我就看了n和c其余没注意,

...... ab -n 200-c 100 http://localhost/test.php >>d:**** 测试结果会保持到****文件里。

第一次测试 200请求数 100并发  结果OK

第二次测试 500请求数 500并发 结果 近2000次fail

很是费解,查资料 需要配置apache的什么“多处理模块” 也就是conf目录下extra下的httpd-mpm.conf文件配置

默认:

<IfModule mpm_prefork_module>
 StartServers 5
 MinSpareServers 5
 MaxSpareServers 10
 MaxRequestWorkers 250
 MaxConnectionsPerChild 0
</IfModule>

修改后

<IfModule mpm_prefork_module>
ServerLimit 1000
StartServers 30
MinSpareServers 30
MaxSpareServers 40
MaxRequestWorkers 1000
MaxConnectionsPerChild 4000
</IfModule>

StartServers:当Apache被启动时,Apache会自动创建StartServers个进程,
MinSpareServers :将空闲进程数保持在MinSpareServers和MaxSpareServers之间。
MaxSpareServers :将空闲进程数保持在MinSpareServers和MaxSpareServers之间。

如果空闲进程小于MinSpareServers,Apache将会以大约每秒1个的速度新建进程。
如果空闲进程大于MaxSpareServers,Apache将会删除多余的空闲进程,释放服务器资源。
进程数的最大值由MaxRequestWorkers 控制,在Apache1.3中最大只能设置为256,但在Apache2.0中,可以通过在配置开头增加ServerLimit项目来突破256的限制,此时必须MaxClients ≤ ServerLimit ≤ 20000
MaxConnectionsPerChild 用来控制每个进程在处理了多少次请求之后自动销毁,这个参数可以设置为0表示无限(即不销毁进程)。

重启apache

继续测试

现在结果好多了

This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.site1.com (be patient)

Server Software: Apache/2.4.4
Server Hostname: www.site1.com
Server Port: 80

Document Path: /search/pf/1.html
Document Length: 28355 bytes

Concurrency Level: 1000
Time taken for tests: 298.971 seconds
Complete requests: 5000
Failed requests: 10
(Connect: 3, Receive: 0, Length: 7, Exceptions: 0)
Write errors: 0
Total transferred: 143335307 bytes
HTML transferred: 141760307 bytes
Requests per second: 16.72 [#/sec] (mean)
Time per request: 59794.294 [ms] (mean)
Time per request: 59.794 [ms] (mean, across all concurrent requests)
Transfer rate: 468.19 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 55 165.9 0 1089
Processing: 13703 54289 13103.4 57385 70505
Waiting: 12896 36895 12487.2 37135 69721
Total: 13703 54344 13104.2 57412 70593

Percentage of the requests served within a certain time (ms)
50% 57412
66% 60102
75% 61825
80% 64498
90% 67807
95% 69000
98% 69520
99% 69998
100% 70593 (longest request)

apache ab测试的更多相关文章

  1. Apache ab 测试工具使用(一)

    简述: 试用apache ab测试工具 下载点 http://httpd.apache.org/download.cgi 参考: http://jingyan.baidu.com/article/e3 ...

  2. apache ab测试介绍

    apache ab测试介绍 安装ab命令 环境为ubuntu16.04.2 LTS,安装的命令为: sudo apt-get install apache2-utils 使用说明 格式为:ab [op ...

  3. Apache ab测试工具使用方法(无参、get传参、post传参)(转)

    转自Apache ab测试工具使用方法(无参.get传参.post传参) Ab测试工具是apache自带的测试工具,具有简单易上手的特性,下面我总结一下我的使用方法,首先去官方下载apache程序包, ...

  4. Apache ab测试工具使用方法(无参、get传参、post传参)

    Ab测试工具是apache自带的测试工具,具有简单易上手的特性,下面我总结一下我的使用方法,首先去官方下载apache程序包,我下的最新版本apache2.4.23,下载地址http://httpd. ...

  5. MAC系统上安装Apache ab测试工具

    第一步:下载 Apache HTTP Server http://httpd.apache.org/download.cgi#apache24 第二步:安装brew工具 https://brew.sh ...

  6. Apache ab 测试结果的分析

    以前安装好APACHE总是不知道该如何测试APACHE的性能,现在总算找到一个测试工具了.就是APACHE自带的测试工具AB(apache benchmark).在APACHE的bin目录下.格式: ...

  7. 【原创】Apache ab测试时出现:apr_socket_recv "connection reset by peer" 104

    今天在用Apache自带的ab工具做以下简单的压测,本来是随便填几个参数,发现ab在1000并发以上报错:apr_socket_recv "connection reset by peer& ...

  8. apache ab 测试 apr_socket_connect(): 由于目标机器积极拒绝 无法连接

    遇到这种情况一般是你开的并行数量太多了...例如:ab -c 1000 -n 10000 http://localhost/index.html 如此大的请求就会挂掉,不过还是有补救措施的,可以通过增 ...

  9. Apache 的ab测试

    <!-- 博主所有文章仅是作为自己的笔记 如有不足 请见谅--> Apache的ab测试  和  ab测试 不是一个东西(百度 ab测试可以了解) 网站性能压力测试是服务器网站性能调优过程 ...

随机推荐

  1. 流畅的python第三章字典和集合学习记录

    什么是可散列的数据类型 如果一个对象是可散列的,那么在这个对象的生命周期中,他的散列值是不变的,而且这个对象需要实现__hash__()方法.另外可散列对象还要有__qe__()方法.这样才能跟其他键 ...

  2. NDK下IPC问题

    由于AllJoyn的join session timeout问题一直无法解决,我们怀疑AllJoyn有些内部变量没有清理干净,因此考虑将AllJoyn相关功能放到一个单独的进程中,一旦join ses ...

  3. [HTML5] Build Flexible HTML with HTMLTemplates using Slots and Web Components

    HTMLTemplates are part of the web components specification. In this lesson we will learn what are HT ...

  4. 如何在网页中嵌入QQ 阿里旺旺等代码

    1 登陆以下网址: http://wp.qq.com/login.html?target=1 2 复制代码到HTML中即可 3 将对方和自己的QQ都登陆测试(注意自己QQ必须是2010以上版本,否则会 ...

  5. SpringMVC响应Restful风格请求404

    在学习Springmvc时,使用Restful风格的url,页面提示404错误.为找到原因,编写一个简单的Restful测试用例如下: jsp页面: <a href="user/tes ...

  6. 解决64位操作系统下运行psql的问题

    我的机器环境是 win7 64位.正常情况下,只需要安装plsql 和 oracle client,配置好 tnsname.ora 就能正常访问数据库.实际上遇到了几个问题. 1. 在tnsnames ...

  7. 【DB2】在使用EXISTS时,查询结果中包含聚合函数,一个不注意就会犯错的坑

    需求描述 现在需要通过EXISTS中的语句来控制查询结果是否存在 第一次实现SQL SELECT 1 AS ID,SUM(1) FROM (SELECT ID,NAME FROM (VALUES(1, ...

  8. ubuntu卸载第三方库

    下面以pcl和opencv为例进行说明. 参考资料: https://www.cnblogs.com/txg198955/p/5990295.html  ubuntu卸载opencv并重装opencv ...

  9. LR11.5 安卓模拟器性能测试

    LR11.5 安卓模拟器性能测试 上一篇 / 下一篇  2013-07-04 08:07:19 / 个人分类:相关知识 查看( 1172 ) / 评论( 1 ) / 评分( 0 / 0 ) 1.首先下 ...

  10. 0基础的小白怎么学习Java?

    自身零基础,那么我们应该先学好Java,首先我们来了解下Java的特性: Java语言是简单的 Java语言的语法与C语言和C++语言很接近,使得大多数程序员很容易学习和使用Java.另一方面,Jav ...