• HTTP压力测试工具apache的ab的使用方法


    老文了,看而不语,呵呵。 

    其实要和大家说AB的强大之处不仅仅在与他可以压力测试,既然可以模仿访问网页,那。、。。呵呵。、

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

    安装apache后可以在bin目录下找到这个文件。

    下面对这个文件的用法做一个简单介绍,方便以后用他来测试性能。

    我们执行以下命令:

    [root@localhost bin]# ./ab -n 10 -c 10 http://lab.wehefei.com/

    意思是这样的:

    -n表示发送多少个请求,

    -c表示一次发送多少个(实际上就是把-n分批发送),

    后面跟地址,注意后的斜杠。

    返回信息如下(红色部分为我的注释):

    This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Copyright 2006 The Apache Software Foundation, http://www.apache.org/

    Benchmarking http://www.yi1.com.cm/ (be patient)…..done
    Server Software:        Apache/2.2.4
    Server Hostname:        http://lab.wehefei.com/
    Server Port:            80

    Document Path:          /
    Document Length:        31848 bytes

    Concurrency Level:      10
    Time taken for tests:   1.722254 seconds/*测试持续时间*/
    Complete requests:      10/*完成请求数量*/
    Failed requests:        0/*失败请求数量*/
    Write errors:           0
    Total transferred:      323490 bytes/*总流量*/
    HTML transferred:       318480 bytes/*HTML传输量*/
    Requests per second:    5.81 [#/sec] (mean)/*每秒事务数*/
    Time per request:       1722.254 [ms] (mean)/*平均响应时间*/
    Time per request:       172.225 [ms] (mean, across all concurrent requests)/*每个请求响应时间(平均)*/
    Transfer rate:          182.90 [Kbytes/sec] received/*传输效率*/

    Connection Times (ms)
    min  mean[+/-sd] median   max
    Connect:      165  166   1.2    167     168
    Processing:  1300 1418  91.5   1427    1554
    Waiting:      803  925  92.9    929    1064
    Total:       1465 1585  92.2   1595    1721

    Percentage of the requests served within a certain time (ms)
    50%   1595/*50%的请求响应时间小于1595*/
    66%   1620/*66%的请求响应时间小于1620*/
    75%   1668
    80%   1706
    90%   1721
    95%   1721
    98%   1721
    99%   1721
    100%   1721 (longest request)/*最长响应时间1721*/

    废话一堆,就下面这个比较有用点,当然还有一些参数

    ab -n 1000 -c 64 http://10.206.20.41:7001/projectname /

    更多相关文章,欢迎关注我们。

     
  • 相关阅读:
    Netty(一、初步了解)
    nginx(三、keepalived高可用)
    nginx(二、配置文件)
    nginx(一、安装与启动)
    ElasticSeach(六、springboot集成ES high level client)
    ElasticSeach(五、命令操作)
    ElasticSeach(四、mapping)
    ElasticSeach(三、IK分词器配置)
    ElasticSeach(二、部署运行)
    ElasticSeach(一、基本概念)
  • 原文地址:https://www.cnblogs.com/jincon/p/2004509.html
Copyright © 2020-2023  润新知