利用Apache Bench进行网站服务器压力测试实例
来源:互联网 发布:惠州乐知英语 编辑:程序博客网 时间:2024/05/29 04:20
最近需要寻找一些压力测试的小工具,对刚刚对外开放的网站进行压力测试,主要数据要求是自定义请求个数(n)和并行数下的吞吐率和用户平均响应时间:
为此专门找了许多免费的压力测试工具,对有好感的部分进行初步了解,最终选出Apache Bench,原因有二:一是在Windows下方便操作,二是信息获取比较齐全。
步骤:
一、下载软件:
下载地址:https://www.apachelounge.com/download/
下载路径:建议选择在C:/盘下根目录下新建文件夹:apache
下载完成后解压,会看到一下文件夹:
二、命令行操作:
打开Windows的操作命令行,输入:
cd C:\apache\Apache24\bin
ab -n 1000 -c 100 http://baidu.com/
第一行在进入对应文件夹
第二行n代表总用户请求数量,c代表每个用户并行数,后面网址任意更改
三、得出数据:
完成上述两个步骤已经可以得出一下结果:
这些信息看着前面的名称很容易懂,但是为了方便阅读,我还是做出一个比较直接的图:
Document Path:测试页面Document Length: 页面大小Concurrency Level: 测试的并发数Time taken for tests:整个测试持续的时间Complete requests:完成的请求数量Failed requests: 失败的请求数量Write errors: 0Total transferred: 整个过程中的网络传输量HTML transferred: 整个过程中的HTML内容传输量Requests per second: 最重要的指标之一,相当于LR中的每秒事务数,后面括号中的mean表示这是一个平均值Time per request: 最重要的指标之二,相当于LR中的平均事务响应时间,后面括号中的mean表示这是一个平均值Time per request: 每个连接请求实际运行时间的平均值Transfer rate: 平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题
四、更多功能:格式:ab [options] [http://]hostname[:port]/path-n requests Number of requests to perform //本次测试发起的总请求数-c concurrency Number of multiple requests to make //一次产生的请求数(或并发数)-t timelimit Seconds to max. wait for responses //测试所进行的最大秒数,默认没有时间限制。-r Don't exit on socket receive errors. // 抛出异常继续执行测试任务 -p postfile File containing data to POST //包含了需要POST的数据的文件,文件格式如“p1=1&p2=2”.使用方法是 -p 111.txt-T content-type Content-type header for POSTing//POST数据所使用的Content-type头信息,如 -T “application/x-www-form-urlencoded” (配合-p)-v verbosity How much troubleshooting info to print//设置显示信息的详细程度 – 4或更大值会显示头信息, 3或更大值可以显示响应代码(404, 200等), 2或更大值可以显示警告和其他信息。 -V 显示版本号并退出。-C attribute Add cookie, eg. -C “c1=1234,c2=2,c3=3” (repeatable)//-C cookie-name=value 对请求附加一个Cookie:行 。典型形式是name=value的一个参数对。此参数可以重复,用逗号分割。提示:可以借助session实现原理传递 JSESSIONID参数, 实现保持会话的功能,如-C ” c1=1234,c2=2,c3=3, JSESSIONID=FF056CD16DA9D71CB131C1D56F0319F8″ 。-w Print out results in HTML tables //以HTML表的格式输出结果。默认时,它是白色背景的两列宽度的一张表。-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-H attribute Add Arbitrary header line, eg. ‘Accept-Encoding: gzip’ Inserted after all normal header lines. (repeatable)-A attribute Add Basic WWW Authentication, the attributesare 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.-g filename Output collected data to gnuplot format file.-e filename Output CSV file with percentages served-h Display usage information (this message)
阅读全文
0 0
- 利用Apache Bench进行网站服务器压力测试实例
- 用 Apache Bench 进行网站性能测试
- 使用Apache Bench对网站性能进行测试
- apache bench web压力测试简介
- apache bench做web压力测试详解
- [笔记]Apache Bench:Apache自带服务器压力测试工具简单使用
- centos接口压力测试apache bench(ab)压力测试
- windows下使用apache bench(ab)进行带多个header信息的post请求压力测试
- 利用apache的ab工具对apache,nginx或者IIS服务器进行压力测试
- 利用Apache Bench测试Web引擎性能
- 利用Apache Bench测试Web引擎性能
- 利用Apache Bench测试Web引擎性能
- 1 网站压力测试工具 WEB性能测试 Web Bench
- 在window下如何利用apache web服务器的ab命令进行压力测试?
- apache网站压力测试
- Apache服务器压力测试
- apache自带ab工具对网站进行压力测试
- Apache服务器下使用 ab 命令进行压力测试
- 搜索 P
- 一道关于扔球的DP问题
- linux线程2
- java中正则表达式以及Pattern和Matcher
- 神经网络笔记
- 利用Apache Bench进行网站服务器压力测试实例
- 1006. 换个格式输出整数 (15)
- 会计科目的共同类指的是什么
- android getevent用法
- java定时器时间配置
- angular2实战笔记--组件开发
- vs"链接器工具错误 LNK2026 XXX模块对于SAFESEH 映像是不安全的"
- 反射:类的加载机制
- Python爬取百度贴吧帖子