ab -n 100 -c 10 http://www.baidu.com/
option參數 | 說明 |
---|---|
-n | 請求數 |
-c | 併發數 |
-k | 設置ab命令允許1個http會話響應多個請求 keep-alive |
-t | 設置ab命令模擬請求的時間,單位:秒 |
-h | 顯示ab可選參數列表 |
-s | 使用 https 協議發送請求,默認使用 http |
url | 目標壓測地址 |
注意兩個參數
- Requests per second:每秒接受請求數
24
- Time per request:每個請求響應時間
41ms
PS
- apache服務開啓與關閉
sudo apachectl start
sudo apachectl stop
sudo apachectl restart
- 配置文件位置
vim /etc/apache2/httpd.conf
- 修改端口代碼
#Listen 12.34.56.78:80
<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>
Listen 8080
</IfDefine>
<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>
Listen 81
</IfDefine>