Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | Github | OSChina 博客 | 云社区 | 云栖社区 | Facebook | Linkedin | 知乎专栏 | 视频教程 | About

第 21 章 ApacheBench

目录

21.1. Post数据

按照Apache Bench

yum install -y httpd-tools		
		
ab -n 20000 -c 20000 http://172.16.0.8/
ab -n 2000000 -c 20000 -t 30 -H 'Accept-Encoding: gzip' -k http://172.16.0.2/
		

循环请求

		
while true; do ab -n 10000 -c 10000 -t 30 -H 'Accept-Encoding: gzip' -k http://172.16.0.2/ && sleep 5; done
        
		

21.1. Post数据

有些时候我们需要测试用户登录性能,而一般登录程序都采用POST方式提交数据。

准备POST 文件 /home/neo/post.txt

			
$ cat /home/neo/post.txt

username=neo&password=chen
			
			

使用-p引用文件

			
ab -n 2048 -c 2048 -p post.txt http://www.example.com/login.php