网站并发测试,网站服务使用的是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. 从外部重置一个运行中consumer group的消费进度

    对于0.10.1以上版本的kafka, 如何从外部重置一个运行中的consumer group的进度呢?比如有一个控制台,可以主动重置任意消费组的消费进度重置到12小时之前, 而用户的程序可以保持运行 ...

  2. java--生成实体类方法

    由于工作中使用eclipse开发,没有安装hibernate插件,所以无法使用自动生成实体类的功能,为了方便在网上找了段别人写的自动生成实体类方法,稍加修改,直接运行就可以生成对应表的实体类. 注意使 ...

  3. 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)如何修改标准驱动器编码器分辨率

    在某个轴的Enc上双击,可以修改Scaling Factor Numerator     更多教学视频和资料下载,欢迎关注以下信息: 我的优酷空间: http://i.youku.com/acetao ...

  4. selenium 问题:加了显性等待后,操作元素依然出错

    背景: 用WebDriverWait时,一开始用的是presence_of_element_located,我对它的想法就是他就是用来等待元素出现.结果屡屡出问题.元素默认是隐藏的,导致等待过早的就结 ...

  5. 获取ping的最短、最长、平均时间

    # -*- coding: utf-8 -*- import osimport rep = os.popen('ping 120.26.77.101') out = p.read()regex = r ...

  6. 【PHP】组合条件搜索SQL

    前端html多个搜索条件组合 后台一个sql语句,很方便和简洁:仅提供思路. 也可以配合着进行分页操作,非常赞~

  7. iTunes 无法添加 iPhone 自定义铃声

    本篇文章由:http://xinpure.com/itunes-unable-to-add-iphone-custom-ringtones/ 新版本 iTunes 需要在 菜单栏 -> 文件 中 ...

  8. Oracle SQL Developer出现错误 【ora-28002:the password will expire within 7 days】的解决办法

    启动 Oracle SQL Developer的时候,点击用户system进行连接并输入密码后(下图左),会出现(下图右)提示信息: 即:[ora-28002:the password will ex ...

  9. C# 异或校验算法

    C# 的异或校验算法 直接上代码 public partial class FormCRC : Form { public FormCRC() { InitializeComponent(); } p ...

  10. 基于委托的C#异步编程的一个小例子 带有回调函数的例子

    我创建的是一个winform测试项目:界面如下: 设置: 下面是代码: using System; using System.Collections.Generic; using System.Com ...