ab是apache自带的一个很好用的压力测试工具,安装完apache就可以使用
| yum install httpd |
|---|
比如可以模拟100个并发用户,对一个页面发送1000个请求。其中-n代表请求数,-c代表并发数,10.158.116.200是lvs服务器的虚地址。
| ab -n 1000 -c 100 10.158.116.200/index.html |
|---|
得到测试结果:
| Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 10.158.116.200 (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Apache/2.4.6 Server Hostname: 10.158.116.200 Server Port: 80 Document Path: /index.html Document Length: 9 bytes Concurrency Level: 100 Time taken for tests: 0.097 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 267000 bytes HTML transferred: 9000 bytes Requests per second: 10353.57 [#/sec] (mean) ##每秒多少请求,这个是非常重要的参数数值,服务器的吞吐量 Time per request: 9.659 [ms] (mean) ##用户平均请求等待时间 Time per request: 0.097 [ms] (mean, across all concurrent requests) ##服务器平均处理时间,也就是服务器吞吐量的倒数 Transfer rate: 2699.61 [Kbytes/sec] received ##每秒获取的数据长度 Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 0.9 0 11 Processing: 1 9 4.3 6 24 Waiting: 0 8 4.3 6 24 Total: 4 9 4.7 7 25 WARNING: The median and mean for the initial connection time are not within a normal deviation These results are probably not that reliable. Percentage of the requests served within a certain time (ms) 50% 7 ## 50%的请求在7ms内返回 66% 10 ## 60%的请求在10ms内返回 75% 11 80% 11 90% 19 95% 21 98% 24 99% 24 100% 25 (longest request) |
|---|
版权声明:本文为alexmiaomiao原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。