web服务器压测工具也挺多,这里只介绍我用过的这两种--siege(for linux)、ab(for windows)。

一、siege

1、简介:

Siege是一款开源的压力测试工具,设计用于评估WEB应用在压力下的承受能力。可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。siege可以从您选择的预置列表中请求随机的URL。所以siege可用于仿真用户请求负载,而ab则不能。但不要使用siege来执行最高性能基准调校测试,这方面ab就准确很多。

2、安装:

官方:http://www.joedog.org/
Siege下载:http://www.joedog.org/pub/siege/siege-latest.tar.gz
解压:
# tar -zxf siege-latest.tar.gz
进入解压目录:
# cd siege-latest.tar.gz/
安装:
#./configure ; make
#make install

3、参数详解:

4、使用:

siege -c 100 -r 10 "https://www.baidu.com/"

-c 100表示并发模拟100个用户并发,-r 10表示重复运行10次

** SIEGE 3.0.8
** Preparing 100 concurrent users for battle.
The server is now under siege.. done.

Transactions: 909 hits    #完成909次处理
Availability: 90.90 %    #成功率
Elapsed time: 71.83 secs    #总共耗时
Data transferred: 0.15 MB    #总共传输数据量
Response time: 1.66 secs    #响应时间
Transaction rate: 12.65 trans/sec  #平均每秒处理数
Throughput: 0.00 MB/sec    #平均每秒传输数据量
Concurrency: 20.98    #实际最大并发数
Successful transactions: 909    #成功处理数
Failed transactions: 91    #失败处理数
Longest transaction: 63.17  #单次最长耗时
Shortest transaction: 0.02    #单次最短耗时

FILE: /var/log/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive 'show-logfile' to false.


二、ab

1、简介

ab的全称是ApacheBench,是 Apache 附带的一个小工具,专门用于 HTTP Server 的benchmark testing,可以同时模拟多个并发请求

2、下载

http://apache.mirrors.pair.com/httpd/

或安装Apache自带

3、使用:

向 www.google.com 发送10个请求(-n 10) ,并每次发送10个请求(-c 10)——也就是说一次都发过去了。

C:\Users\admin>ab -n 10 -c 10 http://www.google.com/

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

Benchmarking www.google.com (be patient).....done

Server Software: gws
Server Hostname: www.google.com
Server Port: 80

Document Path: /
Document Length: 390 bytes

Concurrency Level: 10
Time taken for tests: 0.274 seconds
Complete requests: 10
Failed requests: 0
Non-2xx responses: 10
Total transferred: 11330 bytes
HTML transferred: 3900 bytes
Requests per second: 36.47 [#/sec] (mean)
Time per request: 274.207 [ms] (mean)
Time per request: 27.421 [ms] (mean, across all concurrent requests)
Transfer rate: 40.35 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 24 24 0.4 24 25
Processing: 31 113 67.4 121 218
Waiting: 31 113 67.4 121 218
Total: 55 138 67.5 145 243

Percentage of the requests served within a certain time (ms)
50% 145
66% 170
75% 194
80% 218
90% 243
95% 243
98% 243
99% 243
100% 243 (longest request)

/*整个测试持续的时间*/

Time taken for tests:   3.234651 seconds

/*完成的请求数量*/

Complete requests:      10

/*失败的请求数量*/

Failed requests:        0

Write errors:           0

Non-2xx responses:      10

Keep-Alive requests:    10

/*整个场景中的网络传输量*/

Total transferred:      6020 bytes

/*整个场景中的HTML内容传输量*/

HTML transferred:       2300 bytes

/*大家最关心的指标之一,相当于 LR 中的 每秒事务数 ,后面括号中的 mean 表示这是一个平均值*/

Requests per second:    3.09 [#/sec] (mean)

/*大家最关心的指标之二,相当于 LR 中的 平均事务响应时间 ,后面括号中的 mean 表示这是一个平均值*/这个是用户平均请求等待时间。

Time per request:       3234.651 [ms] (mean)

/*这个是服务器平均请求处理时间*/

Time per request:       323.465 [ms] (mean, across all concurrent requests)

/*平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题*/

Transfer rate:          1.55 [Kbytes/sec] received

/*网络上消耗的时间的分解,各项数据的具体算法还不是很清楚*/

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:       20  318 926.1     30    2954

Processing:    40 2160 1462.0   3034    3154

Waiting:       40 2160 1462.0   3034    3154

Total:         60 2479 1276.4   3064    3184

/*下面的内容为整个场景中所有请求的响应情况。在场景中每个请求都有一个响应时间,其中 50% 的用户响应时间小于 3064 毫秒,60 % 的用户响应时间小于 3094 毫秒,最大的响应时间小于 3184 毫秒*/

Percentage of the requests served within a certain time (ms)

50%   3064

66%   3094

75%   3124

80%   3154

90%   3184

95%   3184

98%   3184

99%   3184

100%   3184 (longest request)

由于对于并发请求,cpu实际上并不是同时处理的,而是按照每个请求获得的时间片逐个轮转处理的,所以基本上第一个Time per request时间约等于第二个Time per request时间乘以并发请求数

参考:

1、http://www.cnblogs.com/yangxia-test/archive/2012/12/06/2804801.html

2、http://www.ha97.com/4663.html

web服务器压测工具siege、ab的更多相关文章

  1. 压测工具siege和wrk

    siege压测工具 安装: wget http://download.joedog.org/siege/siege-3.0.8.tar.gz cd siege-3.0.8 ./configure ma ...

  2. 网站(Web)压测工具Webbench源码分析

    一.我与webbench二三事 Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能.Webbench ...

  3. 利器: 用Siege做Web服务器压测

    用「Web压测」关键词检索,能找到好多进行压测的工具,比如ab.Http_load.Webbench.Siege这些,不过今天并不是要对这些工具做对比,毕竟我们只是想得到一个结果.本文主要介绍Sieg ...

  4. 压测工具Siege

    一.下载 http://www.joedog.org/ http://www.joedog.org/pub/siege/siege-2.70.tar.gz 二.测试 siege -c200 -r10 ...

  5. web压测工具http_load原理分析

    一.前言 http_load是一款测试web服务器性能的开源工具,从下面的网址可以下载到最新版本的http_load: http://www.acme.com/software/http_load/ ...

  6. 压测工具ab的简单使用

    apache benchmark(ab)是一种常见的压测工具,不仅可以对apache进行压测,也可以对nginx,tomcat,IIS等进行压测 安装 如果安装了apache,那么ab已经自带了,不需 ...

  7. ab压测工具的一些个人见解

    ab压测工具(linux版)由于网上教程一大把,今天也按照教程好好研究了一番,下面写一下对此工具的一些个人见解,如有不妥,希望一起探讨.   优点: 1.小巧. 2.理论支持655350并发数.实际3 ...

  8. SuperBenchmarker一个用.NET编写的压测工具

    0x01 前言 在这之前想必大家对ab(http)与abs(https)也有一些了解,我们今天不去看ab和abs,SuperBenchmarker(sb.exe)是一个压测工具,他是一个受Apache ...

  9. 压测工具使用(vegeta)

    一.压测工具vegeta 1.介绍 Vegeta 是一个用 Go 语言编写的多功能的 HTTP 负载测试工具,它提供了命令行工具和一个开发库. 官方地址:https://github.com/tsen ...

随机推荐

  1. 封装Excls数据导出功能 返回一个下载链接地址

    /// <summary> /// 获取本地存储地址 /// </summary> /// <param name="dt"></para ...

  2. Spring的定时任务(任务调度)<task:scheduled-tasks>

    Spring内部有一个task是Spring自带的一个设定时间自动任务调度,提供了两种方式进行配置,一种是注解的方式,而另外一种就是XML配置方式了.注解方式比较简洁,XML配置方式相对而言有些繁琐, ...

  3. 在生产环境中部署asp.net core应用

    设备:阿里云ECS云主机 操作系统:centos 7 操作步骤: 1 安装.net core sdk: # 添加dotnet product feed sudo rpm --import https: ...

  4. Github协作图想

    首先 git pull 从远程拉下代码,并在本地与本地代码自动合并 在本地解决冲突后,可将本地代码进行远程推送 版本库的Repository中存储的是版本树状链,每一根链接线代表每一次的修改,每一个节 ...

  5. asp.net mvc5 模式的现象思考

    .net mv5简化了一些应用逻辑,与其说是mvc架构模式,不如说应用.net Entity更好. 现在你只需要去随便创建一个类 相关数据 然后用一个类去继承 DbContext 定义一个 DbSet ...

  6. parity 注记词

    spousal tint untold around rosy daintily unrated sheep choice showpiece chirping gala

  7. struts2 result type属性说明

    首先看一下在struts-default.xml中对于result-type的定义: <result-types><result-type name="chain" ...

  8. c# 生成的没用文件

    1.pdb 2.vhost 3.application 4.含有更新功能(更新文件夹)

  9. MyBatis传入参数为list、数组、map写法(转载)

    MyBatis传入参数为list.数组.map写法 1.foreach简单介绍: foreach的主要用在构建in条件中,它可以在SQL语句中进行迭代一个集合. foreach元素的属性主要有item ...

  10. Android 网络编程 API笔记 - java.net 包相关 接口 api

    Android 网络编程相关的包 : 9 包, 20 接口, 103 类, 6 枚举, 14异常; -- Java包 : java.net 包 (6接口, 34类, 2枚举, 12异常); -- An ...