背景

ab小型压力工具,对于在Linux中简单调试还是比较方便,轻巧灵活.

安装


  1. yum -y install httpd-tools

查看版本


  1. [root@7dgroup2 ~]# ab -V

  2. This is ApacheBench, Version 2.3 <$Revision: 1430300 $>

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

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

  5. 帮助

  6. [root@7dgroup2 ~]# ab help

  7. ab: invalid URL

  8. Usage: ab [options] [http[s]://]hostname[:port]/path

  9. Options are:

  10. -n requests Number of requests to perform

  11. -c concurrency Number of multiple requests to make at a time

  12. -t timelimit Seconds to max. to spend on benchmarking

  13. This implies -n 50000

  14. -s timeout Seconds to max. wait for each response

  15. Default is 30 seconds

  16. -b windowsize Size of TCP send/receive buffer, in bytes

  17. -B address Address to bind to when making outgoing connections

  18. -p postfile File containing data to POST. Remember also to set -T

  19. -u putfile File containing data to PUT. Remember also to set -T

  20. -T content-type Content-type header to use for POST/PUT data, eg.

  21. 'application/x-www-form-urlencoded'

  22. Default is 'text/plain'

  23. -v verbosity How much troubleshooting info to print

  24. -w Print out results in HTML tables

  25. -i Use HEAD instead of GET

  26. -x attributes String to insert as table attributes

  27. -y attributes String to insert as tr attributes

  28. -z attributes String to insert as td or th attributes

  29. -C attribute Add cookie, eg. 'Apache=1234'. (repeatable)

  30. -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'

  31. Inserted after all normal header lines. (repeatable)

  32. -A attribute Add Basic WWW Authentication, the attributes

  33. are a colon separated username and password.

  34. -P attribute Add Basic Proxy Authentication, the attributes

  35. are a colon separated username and password.

  36. -X proxy:port Proxyserver and port number to use

  37. -V Print version number and exit

  38. -k Use HTTP KeepAlive feature

  39. -d Do not show percentiles served table.

  40. -S Do not show confidence estimators and warnings.

  41. -q Do not show progress when doing more than 150 requests

  42. -g filename Output collected data to gnuplot format file.

  43. -e filename Output CSV file with percentages served

  44. -r Don't exit on socket receive errors.

  45. -h Display usage information (this message)

  46. -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)

  47. -f protocol Specify SSL/TLS protocol

  48. (SSL3, TLS1, TLS1.1, TLS1.2 or ALL)

  49. [root@7dgroup2 ~]#

  • -n在测试会话中所执行的请求个数。默认时,仅执行一个请求。

  • -c一次产生的请求个数。默认是一次一个。

  • -t测试所进行的最大秒数。其内部隐含值是-n 50000,它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。

快速上手


  1. [root@7dgroup2 ~]# ab -n10 -c 10 http://172.17.211.142:8089/

  2. This is ApacheBench, Version 2.3 <$Revision: 1430300 $>

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

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

  5. Benchmarking 172.17.211.142 (be patient).....done

  6. Server Software: #服务器软件

  7. Server Hostname: 172.17.211.142 #域名

  8. Server Port: 8089 #请求端口号

  9. Document Path: / #文件路径

  10. Document Length: 76443 bytes #页面字节数

  11. Concurrency Level: 10 #请求的并发数

  12. Time taken for tests: 0.064 seconds #总访问时间

  13. Complete requests: 10 #请求成功数量

  14. Failed requests: 0 #请求失败数量

  15. Write errors: 0

  16. Total transferred: 766030 bytes #请求总数据大小(包括header头信息)

  17. HTML transferred: 764430 bytes #html页面实际总字节数

  18. Requests per second: 157.09 [#/sec] (mean) #每秒多少请求,服务器的吞吐量

  19. Time per request: 63.656 [ms] (mean) #用户平均请求等待时间

  20. Time per request: 6.366 [ms] (mean, across all concurrent requests) # 服务器平均处理时间,也就是服务器吞吐量的倒数

  21. Transfer rate: 11751.86 [Kbytes/sec] received #每秒获取的数据长度

  22. Connection Times (ms)

  23. min mean[+/-sd] median max

  24. Connect: 0 0 0.0 0 0 #网络链接

  25. Processing: 8 36 17.1 41 60 #系统处理

  26. Waiting: 3 24 18.7 18 55 #等待

  27. Total: 9 37 17.1 42 60

  28. #Total并不等于前三行数据相加,因为前三行的数据并不是在同一个请求中采集到的,

  29. #可能某个请求的网络延迟最短,但是系统处理时间又是最长的呢。

  30. #所以Total是从整个请求所需要的时间的角度来统计的。

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

  32. 50% 42

  33. 66% 45

  34. 75% 51

  35. 80% 52

  36. 90% 60

  37. 95% 60

  38. 98% 60

  39. 99% 60

  40. 100% 60 (longest request)

性能工具之ab压力测试工具及ab命令详解相关推荐

  1. Apache ab压力测试工具

    查看apache是否安装 # rpm -qa httpd httpd-2.2.3-63.el5.centos (在apache 版本2以后,apache全部改名为httpd) ab压力测试工具是apa ...

  2. ab压力测试工具linux,【Linux】ApacheBench(ab)压力测试工具

    AB的简介 ab是apachebench命令的缩写. ab是apache自带的压力测试工具.ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试.比 ...

  3. 运维之道 | apachebench ab压力测试工具

    apachebench ab压力测试工具 一.ab的原理 ab是apachebench命令的缩写 ab的原理:ab命令会创建多个并发访问线程,模拟多个访问者同时对某一URL地址进行访问.它的测试目标是 ...

  4. ab测试工具 linux,超实用压力测试工具-ab工具

    写在前面 在学习ab工具之前,我们需了解几个关于压力测试的概念吞吐率(Requests per second) 概念:服务器并发处理能力的量化描述,单位是reqs/s,指的是某个并发用户数下单位时间内 ...

  5. 压力测试ab安装 linux,Centos8下安装ab压力测试工具及ab命令详解

    释放双眼,带上耳机,听听看~! 1.ab的简介 ab是apachebench命令的缩写. ab是apache自带的压力测试工具.ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以 ...

  6. apache ab压力测试工具-批量压测脚本

    概述 ab(Apache benchmark)是一款常用的压力测试工具.简单易用,ab的命令行一次只能支持一次测试.如果想要批量执行不同的测试方式,并自动对指标进行分析,那么单靠手工一条一条命令运行a ...

  7. 【Apache】Apache ab压力测试工具Window下载和用法详解

    ab是apache自带的网站压力测试工具.  使用起来非常的简单和方便.  不仅仅是可以apache服务器进行网站访问压力测试,还可以对其他类型的服务器进行压力测试.  比如nginx,tomcat, ...

  8. ab压力测试php脚本,ab压力测试工具-批量压测脚本

    ab(Apache benchmark)是一款经常使用的压力测试工具.简单易用,ab的命令行一次只能支持一次测试.若是想要批量执行不一样的测试方式,并自动对指标进行分析,那么单靠手工一条一条命令运行a ...

  9. 高并发ab压力测试工具

    Apache ab 介绍 : Apache Benchmark(简称ab) 是Apache安装包中自带的压力测试工具 注: centos6 默认安装 ab 安装命令 yum install y htt ...

  10. ab压力测试工具-批量压测脚本

    转自:https://www.cnblogs.com/exceptioneye/p/5179763.html ab(Apache benchmark)是一款常用的压力测试工具.简单易用,ab的命令行一 ...

最新文章

  1. 运行jsp时,报错404
  2. 强烈安利8个高质量的办公软件,提高你的办公效率
  3. 世界首批智能音箱AI IQ测试报告,小米、京东和阿里初步PK
  4. 谈谈读“SEO实战密码”的一些感悟
  5. hrtimer的简单使用 + 原理和实现【转】
  6. H2数据库的Spring Boot
  7. C++学习——C++中的四个智能指针
  8. 信息学奥赛一本通C++语言——1010:计算分数的浮点数值
  9. 智能会议系统(23)---移动端视频通话开源软件比较
  10. hnu小学期实训之数圈
  11. MyBatis基础入门--知识点总结
  12. 唐宇迪学习笔记12:sklearn构造决策树
  13. java 协同过滤算法_推荐系统中协同过滤算法实现分析
  14. UAC 管理员权限 程序 防止弹窗的四种解决办法
  15. 关于Virtual的英语含义
  16. 烤仔TVのCCW丨密码学通识(一)密码学基础及常见误区
  17. RF自动化测试系列-第三篇 测试数据
  18. Nginx 502的解决方法
  19. 二分查找(整数二分)
  20. 数据库连接池及C3P0数据库连接池技术

热门文章

  1. VMPlayer安装
  2. Kindle 电子书转换 azw3 mobi
  3. 什么是p12证书?ios p12证书怎么获取?
  4. linux下oracle完全卸载,linux环境下卸载oracle 11g
  5. 进销存excel_excel进销存仓库表格同步手机操作
  6. Windows平板 区分当前是鼠标点击还是触摸
  7. appium 学习教程
  8. 优化算法——差分进化算法(DE)
  9. C# 中intptr用法
  10. VSCode下载与安装及安装汉化包