美文网首页
Linux ab test

Linux ab test

作者: 阿o醒 | 来源:发表于2017-12-21 13:00 被阅读34次
ab(选项)(参数)

选项 
-A:指定连接服务器的基本的认证凭据;
-c:指定一次向服务器发出请求数;
-C:添加cookie; 
-g:将测试结果输出为“gnuolot”文件; 
-h:显示帮助信息;
-H:为请求追加一个额外的头; 
-i:使用“head”请求方式; 
-k:激活HTTP中的“keepAlive”特性; 
-n:指定测试会话使用的请求数; 
-p:指定包含数据的文件; 
-q:不显示进度百分比; 
-T:使用POST数据时,设置内容类型头;
-v:设置详细模式等级;
-w:以HTML表格方式打印结果; 
-x:以表格方式输出时,设置表格的属性; 
-X:使用指定的代理服务器发送请求;
-y:以表格方式输出时,设置表格属性。

参数 主机:被测试主机。

例子

ab -n1000 -c10 http://localhost/index.html

注意我们在启动ab时,传入3个命令行参数,它们正是代表了前面提到的前提条件:
-n1000 表示总请求数位1000
-c 表示并发用户数为10
http://localhost/index.html 表示这些请求的目标URL。
测试结果一目了然,我们看到吞吐率显示为2204.64reqs/s。

POST 请求
ab -c 200 -n 1000 -T 'application/x-www-form-urlencoded' -p postdata.txt http://domain/test.php

返回请求:

##首先是apache的版本信息
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 vm1.jianfeng.com (be patient)
Server Software: Apache/2.2.19 ##apache版本
Server Hostname: vm1.jianfeng.com ##服务器主机名
Server Port: 80 ##服务器端口
Document Path: /a.html
Document Length: 25 bytes ##页面大小
Concurrency Level: 100 ##并发数
Time taken for tests: 0.273 seconds ##整个测试持续的时间
Complete requests: 1000 ##完成的请求数量
Failed requests: 0 ##失败请求
Write errors: 0
Total transferred: 275000 bytes ##总共传输字节数,包含http的头信息等
HTML transferred: 25000 bytes ##html字节数,实际的页面传递字节数
Requests per second: 3661.60 [#/sec] (mean) ##最关心的指标之一:相当于 LR 中的 每秒事务数/吞吐量——每秒多少请求,这个是非常重要的参数数值,服务器的吞吐量
Time per request: 27.310 [ms] (mean) ##最关心的指标之二:用户平均请求等待时间(平均事务响应时间)
Time per request: 0.273 [ms] (mean, across all concurrent requests) ##最关心的指标之三:服务器平均处理时间,也就是服务器吞吐量的倒数(每个请求实际运行时间的平均值)
Transfer rate: 983.34 [Kbytes/sec] received ##平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题
Connection Times (ms)##网络上消耗的时间的分解
 min mean[+/-sd] median max
Connect: 0 1 2.3 0 16
Processing: 6 25 3.2 25 32
Waiting: 5 24 3.2 25 32
Total: 6 25 4.0 25 48
##由于对于并发请求,cpu实际上并不是同时处理的,而是按照每个请求获得的时间片逐个轮转处理的,所以基本上第一个Time per request时间约等于第二个Time per request时间乘以并发请求数。
Percentage of the requests served within a certain time (ms)
 50% 25 ## 50%的请求在25ms内返回
 66% 26 ## 60%的请求在26ms内返回
 75% 26
 80% 26
 90% 27
 95% 31
 98% 38
 99% 43
 100% 48 (longest request)

相关文章

  • Linux ab test

    例子 注意我们在启动ab时,传入3个命令行参数,它们正是代表了前面提到的前提条件:-n1000 表示总请求数位10...

  • test

    test ab

  • 关于产品改版

    AB test

  • ab test

    深度推荐系统与CTR预估2019年上半年值得精读的论文 https://mp.weixin.qq.com/s?__...

  • AB Test 评估准则

    本文记录 AB Test 评估准则,用于指导 AB Test设计 度量选择 变异性 规模 完整性检验 效应量检验 ...

  • 【译文】AB test

    八 AB test (一)定义 又名 split test、bucket test,以提高转化率为目的,用数据结果...

  • AB-TEST

    背景 无法衡量就无法优化,对于互联网产品而言,不仅是推荐系统,整个app系统的更新迭代必然需要建立一套度衡量,来把...

  • 定性调研与定量调研

    AB test(用户量较大的公司) 网站首页和产品页的某按钮转化率特别低,因此考虑用AB test来提高某按钮的转...

  • ab test with json data

    post.json

  • 什么是AB Test?AB Test如何找到运营最优方案?

    什么是AB Test?这非常类似于我们上学期间做的科学实验,设置实验组和对照组。A/B测试会将用户流量分成A组和B...

网友评论

      本文标题:Linux ab test

      本文链接:https://www.haomeiwen.com/subject/vpbowxtx.html