
文章插圖
文章插圖
ab 是apache對 http服務器進行壓力測試的工具,它可以測試出服務器每秒可以處理多少請求 。本文記錄mac版本安裝 ab 的步驟以及遇到的坑 。下載進入 apache ab官網 下載頁面 。

文章插圖

文章插圖
安裝brew 安裝因為筆者的操作系統是mac系統,所以需要先安裝brew 。進入brew網站 。執行下方命令
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"執行命令后報錯:Failed to connect to raw.githubusercontent.com port 443: Connection refused解決方案:打開 https://www.ipaddress.com/ 查詢 raw.githubusercontent.com 對應的 ip 地址 。
文章插圖

文章插圖
添加ip到 /etc/hosts,添加以下配置:
185.199.108.133 raw.githubusercontent.com185.199.109.133 raw.githubusercontent.com185.199.110.133 raw.githubusercontent.com185.199.111.133 raw.githubusercontent.com再執行/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"執行成功后,使用brew安裝apr、apr-util和prcebrew install aprbrew install apr-utilbrew inatll prceapache ab安裝解壓下載后壓縮包,進入 httpd-2.4.51 目錄 。執行以下命令:./configuremakemake install執行 ./configure 命令時報錯:jeremy@jeremydeMacBook-Pro httpd-2.4.51 % ./configurechecking for chosen layout... Apachechecking for working mkdir -p... yeschecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking build system type... x86_64-apple-darwin20.2.0checking host system type... x86_64-apple-darwin20.2.0checking target system type... x86_64-apple-darwin20.2.0configure:configure: Configuring Apache Portable Runtime library...configure:checking for APR... noconfigure: error: APR not found.Please read the documentation.APR not found 沒找到./configure 改成 ./configure --with-apr=/usr/local/opt/apr --with-apr-util=/usr/local/opt/apr-util --with-pcre=/usr/local/Cellar/pcre/8.45其中 pcre 的路徑可能不同,需要在 /usr/local/Cellar/pcre 里面確定路徑 。上述命令執行成功后,如果沒有報錯,表明安裝成功,執行ab
ab: wrong number of argumentsUsage: ab [options] [http[s]://]hostname[:port]/pathOptions are:-n requestsNumber of requests to perform-c concurrencyNumber of multiple requests to make at a time-t timelimitSeconds to max. to spend on benchmarkingThis implies -n 50000-s timeoutSeconds to max. wait for each responseDefault is 30 seconds-b windowsizeSize of TCP send/receive buffer, in bytes-B addressAddress to bind to when making outgoing connections-p postfileFile containing data to POST. Remember also to set -T-u putfileFile containing data to PUT. Remember also to set -T-T content-type Content-type header to use for POST/PUT data, eg.'application/x-www-form-urlencoded'Default is 'text/plain'-v verbosityHow much troubleshooting info to print-wPrint out results in HTML tables-iUse HEAD instead of GET出現以上界面,說明 ab 已經安裝成功 。運行 ab主要參數-n 請求樹-c 并發數(訪問人數)-t 請求時間最大數
ab -n 1000 -c 100 http://www.baidu.com表示請求baidu.com 使用100請求數,請求1000次 。總結【在線ddos免費測壓平臺 ab壓力測試命令】需要在配置brew和檢測configure上花了比較多的時間 。其余的按照步驟即可 。
- 環網柜系統溫升在線裝置結構如何設計?
- 微信每日簽到領取免費流量 很簡單技巧
- 咖喱蓋澆飯的做法
- 怎樣免費申請和注冊電子郵箱
- 如何設置DDOS防火墻各項參數
- 橢圓正規畫法 橢圓怎么畫
- 六種自動化在線檢測設備 提高軋材幾何尺寸質量
- 來看看測徑儀是如何在惡劣環境下進行在線檢測的!
- 圖像法螺紋鋼測徑儀應用于帶肋軋材的在線檢測
- 新加坡十大免費游玩景點 新加坡必去景點排名
