Apache AB 压力测试

Apache AB 压力测试 

安装

// 安装工具 yum install httpd-tools

使用

// URL 是网站请求路径 ab -c 1000 -n 2000 “http://shop-app-envelope.mall.fenfenriji.com/envelope/data?enkey=d0hyf1or&uid=4040400&expires=1437460116&token=0f2aef4192f5374f85f844134ad14df5”

c并发量

n请求数

结果示例:

This is ApacheBench, Version 2.3 <$Revision: 655654 $>  

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/  

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking shop-app-envelope.mall.fenfenriji.com (be patient)  

Completed 200 requests  

Completed 400 requests  

Completed 600 requests  

Completed 800 requests  

Completed 1000 requests  

Completed 1200 requests  

Completed 1400 requests  

Completed 1600 requests  

Completed 1800 requests  

Completed 2000 requests  

Finished 2000 requests

Server Software:        nginx  

Server Hostname:        shop-app-envelope.mall.fenfenriji.com  

Server Port:            80

Document Path:          /envelope/data?enkey=d0hyf1or&uid=4040400&expires=1437460116&token=0f2aef4192f5374f85f844134ad14df5  #URL中的根绝对路径  

Document Length:        138 bytes  #HTTP响应数据的正文长度

Concurrency Level:      1000   #并发用户数  

Time taken for tests:   9.087 seconds  #所有这些请求被处理完成所花费的总时间  

Complete requests:      2000 #总请求数量,这是我们设置的参数之一  

Failed requests:        0  #失败的请求数量  

Write errors:           0  

Total transferred:      776000 bytes   #所有请求的响应数据长度总和  

HTML transferred:       276000 bytes   #所有请求的响应数据中正文数据的总和  

Requests per second:    220.10 [#/sec] (mean)     #吞吐率,计算公式:Complete requests / Time taken for tests  

Time per request:       4543.349 [ms] (mean)      #用户平均请求等待时间,计算公式:Time token for tests/(Complete requests/Concurrency Level)  

Time per request:       4.543 [ms] (mean, across all concurrent requests)  #服务器平均请求等待时间,计算公式:Time taken for tests/Complete requests,正好是吞吐率的倒数。也可以这么统计:Time per request/Concurrency Level  

Transfer rate:          83.40 [Kbytes/sec] received   #表示这些请求在单位时间内从服务器获取的数据长度,计算公式:Total trnasferred/ Time taken for tests,这个统计很好的说明服务器的处理能力达到极限时,其出口宽带的需求量。

Connection Times (ms)  

              min  mean[+/-sd] median   max

Connect:        2   44  54.9     16     186  

Processing:  2069 3977 1830.1   4365    6841  

Waiting:     2069 3977 1830.1   4365    6841  

Total:       2071 4020 1879.2   4383    6982

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

  50%   4383

  66%   5397

  75%   5878

  80%   6163

  90%   6578

  95%   6785

  98%   6903

  99%   6949

 100%   6982 (longest request)

#整个场景中所有请求的响应情况。在场景中每个请求都有一个响应时间,其中50%的用户响应时间小于4383毫秒,60% 的用户响应时间小于5397毫秒,最大的响应时间小于6982毫秒

Jason.wang

When you find your talent can't afford to be ambitious, be quiet and study !

You may also like...