一般的服务器都会自带apache服务器,不需要单独安装
sudo apt-get install apache2-utils
sudo yum install httpd-tools
ab的命令参数比较多,但是最常用的就3个
ab -c 10000 -n 100000 http://www.baidu.com
-c 表示并发用户数
-n 表示请求总数
-t 持续多少秒压测
结果
Server Software: nginx
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /
Document Length: 178 bytes
Concurrency Level: 10000
Time taken for tests: 7.926 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Non-2xx responses: 100000
Total transferred: 36800000 bytes
HTML transferred: 17800000 bytes
Requests per second: 12615.91 [
Time per request: 792.650 [ms] (mean)
Time per request: 0.079 [ms] (mean, across all concurrent requests)
Transfer rate: 4533.84 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 510 1056.6 3 7026
Processing: 3 28 89.9 8 1889
Waiting: 0 25 89.4 6 1887
Total: 7 538 1079.8 12 7240
Percentage of the requests served within a certain time (ms)
50% 12
66% 22
75% 1016
80% 1022
90% 1231
95% 3027
98% 3232
99% 3828
100% 7240 (longest request)
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步