性能工具之ab压力测试工具及ab命令详解
背景
ab小型压力工具,对于在Linux中简单调试还是比较方便,轻巧灵活.
安装
yum -y install httpd-tools
查看版本
[root@7dgroup2 ~]# ab -V
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
帮助
[root@7dgroup2 ~]# ab help
ab: invalid URL
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make at a time
-t timelimit Seconds to max. to spend on benchmarking
This implies -n 50000
-s timeout Seconds to max. wait for each response
Default is 30 seconds
-b windowsize Size of TCP send/receive buffer, in bytes
-B address Address to bind to when making outgoing connections
-p postfile File containing data to POST. Remember also to set -T
-u putfile File containing data to PUT. Remember also to set -T
-T content-type Content-type header to use for POST/PUT data, eg.
'application/x-www-form-urlencoded'
Default is 'text/plain'
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute Add cookie, eg. 'Apache=1234'. (repeatable)
-H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
Inserted after all normal header lines. (repeatable)
-A attribute Add Basic WWW Authentication, the attributes
are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-X proxy:port Proxyserver and port number to use
-V Print version number and exit
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-q Do not show progress when doing more than 150 requests
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-r Don't exit on socket receive errors.
-h Display usage information (this message)
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol Specify SSL/TLS protocol
(SSL3, TLS1, TLS1.1, TLS1.2 or ALL)
[root@7dgroup2 ~]#
-n在测试会话中所执行的请求个数。默认时,仅执行一个请求。
-c一次产生的请求个数。默认是一次一个。
-t测试所进行的最大秒数。其内部隐含值是-n 50000,它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。
快速上手
[root@7dgroup2 ~]# ab -n10 -c 10 http://172.17.211.142:8089/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 172.17.211.142 (be patient).....done
Server Software: #服务器软件
Server Hostname: 172.17.211.142 #域名
Server Port: 8089 #请求端口号
Document Path: / #文件路径
Document Length: 76443 bytes #页面字节数
Concurrency Level: 10 #请求的并发数
Time taken for tests: 0.064 seconds #总访问时间
Complete requests: 10 #请求成功数量
Failed requests: 0 #请求失败数量
Write errors: 0
Total transferred: 766030 bytes #请求总数据大小(包括header头信息)
HTML transferred: 764430 bytes #html页面实际总字节数
Requests per second: 157.09 [#/sec] (mean) #每秒多少请求,服务器的吞吐量
Time per request: 63.656 [ms] (mean) #用户平均请求等待时间
Time per request: 6.366 [ms] (mean, across all concurrent requests) # 服务器平均处理时间,也就是服务器吞吐量的倒数
Transfer rate: 11751.86 [Kbytes/sec] received #每秒获取的数据长度
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0 #网络链接
Processing: 8 36 17.1 41 60 #系统处理
Waiting: 3 24 18.7 18 55 #等待
Total: 9 37 17.1 42 60
#Total并不等于前三行数据相加,因为前三行的数据并不是在同一个请求中采集到的,
#可能某个请求的网络延迟最短,但是系统处理时间又是最长的呢。
#所以Total是从整个请求所需要的时间的角度来统计的。
Percentage of the requests served within a certain time (ms)
50% 42
66% 45
75% 51
80% 52
90% 60
95% 60
98% 60
99% 60
100% 60 (longest request)
性能工具之ab压力测试工具及ab命令详解相关推荐
- Apache ab压力测试工具
查看apache是否安装 # rpm -qa httpd httpd-2.2.3-63.el5.centos (在apache 版本2以后,apache全部改名为httpd) ab压力测试工具是apa ...
- ab压力测试工具linux,【Linux】ApacheBench(ab)压力测试工具
AB的简介 ab是apachebench命令的缩写. ab是apache自带的压力测试工具.ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试.比 ...
- 运维之道 | apachebench ab压力测试工具
apachebench ab压力测试工具 一.ab的原理 ab是apachebench命令的缩写 ab的原理:ab命令会创建多个并发访问线程,模拟多个访问者同时对某一URL地址进行访问.它的测试目标是 ...
- ab测试工具 linux,超实用压力测试工具-ab工具
写在前面 在学习ab工具之前,我们需了解几个关于压力测试的概念吞吐率(Requests per second) 概念:服务器并发处理能力的量化描述,单位是reqs/s,指的是某个并发用户数下单位时间内 ...
- 压力测试ab安装 linux,Centos8下安装ab压力测试工具及ab命令详解
释放双眼,带上耳机,听听看~! 1.ab的简介 ab是apachebench命令的缩写. ab是apache自带的压力测试工具.ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以 ...
- apache ab压力测试工具-批量压测脚本
概述 ab(Apache benchmark)是一款常用的压力测试工具.简单易用,ab的命令行一次只能支持一次测试.如果想要批量执行不同的测试方式,并自动对指标进行分析,那么单靠手工一条一条命令运行a ...
- 【Apache】Apache ab压力测试工具Window下载和用法详解
ab是apache自带的网站压力测试工具. 使用起来非常的简单和方便. 不仅仅是可以apache服务器进行网站访问压力测试,还可以对其他类型的服务器进行压力测试. 比如nginx,tomcat, ...
- ab压力测试php脚本,ab压力测试工具-批量压测脚本
ab(Apache benchmark)是一款经常使用的压力测试工具.简单易用,ab的命令行一次只能支持一次测试.若是想要批量执行不一样的测试方式,并自动对指标进行分析,那么单靠手工一条一条命令运行a ...
- 高并发ab压力测试工具
Apache ab 介绍 : Apache Benchmark(简称ab) 是Apache安装包中自带的压力测试工具 注: centos6 默认安装 ab 安装命令 yum install y htt ...
- ab压力测试工具-批量压测脚本
转自:https://www.cnblogs.com/exceptioneye/p/5179763.html ab(Apache benchmark)是一款常用的压力测试工具.简单易用,ab的命令行一 ...
最新文章
- 运行jsp时,报错404
- 强烈安利8个高质量的办公软件,提高你的办公效率
- 世界首批智能音箱AI IQ测试报告,小米、京东和阿里初步PK
- 谈谈读“SEO实战密码”的一些感悟
- hrtimer的简单使用 + 原理和实现【转】
- H2数据库的Spring Boot
- C++学习——C++中的四个智能指针
- 信息学奥赛一本通C++语言——1010:计算分数的浮点数值
- 智能会议系统(23)---移动端视频通话开源软件比较
- hnu小学期实训之数圈
- MyBatis基础入门--知识点总结
- 唐宇迪学习笔记12:sklearn构造决策树
- java 协同过滤算法_推荐系统中协同过滤算法实现分析
- UAC 管理员权限 程序 防止弹窗的四种解决办法
- 关于Virtual的英语含义
- 烤仔TVのCCW丨密码学通识(一)密码学基础及常见误区
- RF自动化测试系列-第三篇 测试数据
- Nginx 502的解决方法
- 二分查找(整数二分)
- 数据库连接池及C3P0数据库连接池技术