ubuntu,centor 安装apache bench

ab全称为:apache bench。

是apache自带的压力测试工具。ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试。比如nginx、tomcat、IIS等。

    ubuntu 安装:

    sudo apt-get install apache2-utils



centos 安装:
yum install apr-util

# 安装依赖 yum-utils中的yumdownload 工具
# 如果没有找到 yumdownload 命令可以
yum install yum-utils



zhubin@zhubin:/$ ab -n 1000 -c 100 http://local.wo.com/api.com/Index/getBanner
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking local.wo.com (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:        nginx
Server Hostname:        local.wo.com
Server Port:            80

Document Path:          /api.com/Index/getBanner
Document Length:        162 bytes

Concurrency Level:      100
Time taken for tests:   0.074 seconds
Complete requests:      1000
Failed requests:        0
Non-2xx responses:      1000
Total transferred:      305000 bytes
HTML transferred:       162000 bytes
Requests per second:    13576.44 [#/sec] (mean)
Time per request:       7.366 [ms] (mean)
Time per request:       0.074 [ms] (mean, across all concurrent requests)
Transfer rate:          4043.76 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1    3   0.6      3       5
Processing:     1    4   1.1      4       8
Waiting:        1    3   1.1      3       8
Total:          4    7   0.8      7      10

Percentage of the requests served within a certain time (ms)
  50%      7
  66%      7
  75%      7
  80%      7
  90%      8
  95%      8
  98%      9
  99%     10
 100%     10 (longest request)

  




原文地址:https://www.cnblogs.com/pansidong/p/10662286.html