1、安装
yum -y install httpd-tools
2、检测版本
ab -V
3、常用
ab -c 10 -n 100 127.0.0.1/index.php #同时处理100个请求并运行10次index.php #-c10表示并发用户数为10 #-n100表示请求总数为100
4、解释
[root@zhy html]# ab -n100 -c10 127.0.0.1/index.php
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 127.0.0.1 (be patient).....done
Server Software: Apache #测试服务器的名字
Server Hostname: 127.0.0.1 #请求的URL主机名
Server Port: 80 #web服务器监听的端口
Document Path: /index.php #请求的URL中的根绝对路径
Document Length: 211 bytes #HTTP响应数据的正文长度
Concurrency Level: 10 # 并发用户数,即-c10
Time taken for tests: 0.010 seconds #所有这些请求被处理完成所花费的总时间 单位秒
Complete requests: 100 # 总请求数量,即-n