對于想快速進行壓力測驗的同學來說,apache ab是一個簡單好用的工具,下面簡單介紹一下它的使用方法,
官網: https://httpd.apache.org/docs/2.0/programs/ab.html
- ab的原理
ab命令會創建多個并發訪問執行緒,模擬多個訪問者同時對某一URL地址進行訪問,它的測驗目標是基于URL的,因此,它既可以用來測驗apache的負載壓力,也可以測驗nginx、lighthttp、tomcat、IIS等其它Web服務器的壓力,
- ab的安裝
# 安裝
#yum -y install httpd-tools
sudo apt-get install httpd-tools
# 檢查是否成功
ab -v
- ab引數
# ab常用引數的介紹:
-n :總共的請求執行數,預設是1;
-c: 并發數,預設是1;
-t:測驗所進行的總時間,秒為單位,預設50000s
-p:POST時的資料檔案
-w: 以HTML表的格式輸出結果
- ab測驗案例
ab -n 5000 -c 200 http://localhost/index.php
ab -n 1000 -c 100 -w http://localhost/index.php >>d:miss.html
ab -n 1000 -c 100 -p request_json.txt -T 'application/json' 'http://192.168.0.101:8088/api/event/annotationEvent'
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/379524.html
標籤:其他
上一篇:安裝第三方庫的基本方法與操作
