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. 北京Uber优步司机奖励政策(3月9日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  2. SLAM前沿问题梳理

    鲁棒性问题:数据关联是影响系统鲁棒性的主要原因 特征提取.线特征 短期内的数据关联是最容易处理的,新的研究方向包括特征提取.线特征等. 回环检测 对于前端的环闭合检测,检测当前测量中的特征并试图将它们 ...

  3. python中- \r用法

    # \r 默认表示将输出的内容返回到第一个指针,这样的话,后面的内容会覆盖前面的内容 def main(): for i in range(65,91): s="\r{name:s}&quo ...

  4. Matlab2018年最新视频教程视频讲义(包含代码)

    2018年Matlab最新视频教程视频讲义(包含代码),适合初学者入门进阶学习,下载地址:百度网盘, https://pan.baidu.com/s/1w4h297ua6ctzfturQ1791g 内 ...

  5. 前后端分离.net core + vuejs + element

    查找一些资料,比较了elementui以及Iview,最终还是选择了elementui搭建前后端分离框架,废话少说了,开始搭建环境: 1.基础软件环境 vue开发环境安装: ①nodejs (我安装的 ...

  6. Iview 表单提交: Cannot read property 'validate' of undefined

    提交表单时,提示报这个错,找了半天,然后也百度了很久,一直没找到答案,代码如下: <link href="~/lib/iview3.1.4/styles/iview.css" ...

  7. Java开发工程师(Web方向) - 04.Spring框架 - 第1章.Spring概述

    第1章.Spring概述 Spring概述 The Spring Framework is a lightweight solution and a potential one-stop-shop f ...

  8. servlet和Jsp的复习整理

    servlet 1.生命周期 a.构造方法.生成一个servlet b.init()方法.当开启服务器时,servlet第一次被装载,servlet引擎调用这个servlet的init()的方法,只调 ...

  9. lintcode671 循环单词

    循环单词   The words are same rotate words if rotate the word to the right by loop, and get another. Cou ...

  10. linux 命令行基础

    命令行基础 一些名词 「图形界面」 「命令行」 「终端」 「shell」 「bash」 安装使用 Windws: 安装git, 打开 gitbash Linux 打开终端 Mac 打开终端 基本命令 ...