說明:
ab工具已經在Apache中包含,如果不想安裝Apache,那么可以使用下面方法單獨安裝。
安裝:
Ubuntu:
sudo apt-get install apache2-utils
CentOS:
sudo yum -y install httpd-tools
官網:
http://httpd.apache.org/(Apache服務器)
http://httpd.apache.org/docs/2.0/programs/(Apache工具文檔大全)
http://httpd.apache.org/docs/2.0/programs/ab.html(文檔教程)
http://httpd.apache.org/docs/current/programs/ab.html(文檔教程)
簡單使用:
運行
ab -n 100 -c 10 http://www.baidu.com/
#注意網址最后要帶斜杠
對http://www.baidu.com/進行100次請求,10個並發請求壓力測試結果。