linux環境中ab命令簡介及結果分析
ab(apache bench)是apache下的一個工具,主要用於對web站點做壓力測試,
基礎用法:
其中-c選項為一次傳送的請求數量,及併發量。
-n選項為請求次數。
實驗測試:
附錄:
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make
-t timelimit Seconds to max. wait for responses
-b windowsize Size of TCP send/receive buffer, in bytes #
-p postfile File containing data to POST. Remember also to set -T
-u putfile File containing data to PUT. Remember also to set -T
-T content-type Content-type header for POSTing, eg.
'application/x-www-form-urlencoded'
Default is 'text/plain'
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute Add cookie, eg. 'Apache=1234. (repeatable)
-H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
Inserted after all normal header lines. (repeatable)
-A attribute Add Basic WWW Authentication, the attributes
are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-X proxy:port Proxyserver and port number to use
-V Print version number and exit
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-r Don't exit on socket receive errors.
-h Display usage information (this message)
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)
基礎用法:
其中-c選項為一次傳送的請求數量,及併發量。
-n選項為請求次數。
實驗測試:
- [dev@web ~]$ ab -c 20 -n 50000 http://192.168.1.210/
- This is ApacheBench, Version 2.3
- Copyright 1996 Adam Twiss, Zeus Technology Ltd,
- Licensed to The Apache Software Foundation,
- Benchmarking 192.168.1.210 (be patient)
- Completed 5000 requests
- Completed 10000 requests
- Completed 15000 requests
- Completed 20000 requests
- Completed 25000 requests
- Completed 30000 requests
- Completed 35000 requests
- Completed 40000 requests
- Completed 45000 requests
- Completed 50000 requests
- Finished 50000 requests
- Server Software: nginx/1.6.2
- Server Hostname: 192.168.1.210
- Server Port: 80
- Document Path: /
- Document Length: 41005 bytes # 請求的頁面大小
- Concurrency Level: 20 # 併發量
- Time taken for tests: 1180.733 seconds # 測試總共耗時
- Complete requests: 50000 # 完成的請求
- Failed requests: 0 # 失敗的請求
- Write errors: 0 # 錯誤
- Total transferred: 2067550000 bytes # 總共傳輸資料量
- HTML transferred: 2050250000 bytes
- Requests per second: 42.35 [#/sec] (mean) # 每秒鐘的請求量。(僅僅是測試頁面的響應速度)
- Time per request: 472.293 [ms] (mean) # 等於 Time taken for tests/(complete requests/concurrency level) 即平均請求等待時間(使用者等待的時間)
- Time per request: 23.615 [ms] (mean, across all concurrent requests) # 等於 Time taken for tests/Complete requests 即伺服器平均請求響應時間 在併發量為1時 使用者等待時間相同
- Transfer rate: 1710.03 [Kbytes/sec] received # 平均每秒多少K,即頻寬速率
- Connection Times (ms)
- min mean[+/-sd] median max
- Connect: 0 1 18.5 0 1001
- Processing: 38 471 534.1 155 9269
- Waiting: 37 456 524.6 147 9259
- Total: 40 472 534.5 155 9269
- Percentage of the requests served within a certain time (ms)
- 50% 155
- 66% 571
- 75% 783
- 80% 871
- 90% 1211
- 95% 1603
- 98% 1839
- 99% 2003
- 100% 9269 (longest request)
附錄:
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make
-t timelimit Seconds to max. wait for responses
-b windowsize Size of TCP send/receive buffer, in bytes #
-p postfile File containing data to POST. Remember also to set -T
-u putfile File containing data to PUT. Remember also to set -T
-T content-type Content-type header for POSTing, eg.
'application/x-www-form-urlencoded'
Default is 'text/plain'
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute Add cookie, eg. 'Apache=1234. (repeatable)
-H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
Inserted after all normal header lines. (repeatable)
-A attribute Add Basic WWW Authentication, the attributes
are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-X proxy:port Proxyserver and port number to use
-V Print version number and exit
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-r Don't exit on socket receive errors.
-h Display usage information (this message)
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29773961/viewspace-1470071/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux netstat命令結果分析Linux
- Dapr-簡介及環境搭建
- Linux系統下ifconfig命令使用及結果分析Linux
- Linux中命令選項及引數簡介Linux
- MySQL NDB Cluster簡介及環境搭建MySql
- free命令結果分析
- JMeter結果分析介紹JMeter
- Redis系列(一):Redis簡介及環境安裝Redis
- 環境搭建及介紹
- Java在Linux環境下執行MySQL命令無法獲取結果的問題JavaLinuxMySql
- Linux系統ifconfig使用及結果分析Linux
- 簡單介紹Linux環境變數檔案Linux變數
- java簡介--環境安裝Java
- Flash開發環境簡介開發環境
- Redis實戰(一)Redis簡介及環境安裝(Windows)RedisWindows
- 【LINUX】free 命令結果完全剖析Linux
- linux執行環境&命令Linux
- linux c 環境變數函式 getenv putenv 簡介Linux變數函式
- Linux中修改環境變數及生效方法Linux變數
- Python爬蟲之scrapy框架簡介及環境安裝Python爬蟲框架
- 【美妙的Python之一】Python簡介及環境搭建Python
- linux tar命令簡介Linux
- Linux lsof 命令簡介Linux
- linux環境下的"螞蟻"-wget使用簡介 (轉)Linuxwget
- linux環境下的"螞蟻"-wget使用簡介(轉)Linuxwget
- linux 環境變數介紹Linux變數
- Appium 介紹及環境安裝APP
- 01 . Vue簡介,原理,環境安裝Vue
- ReactJs環境配置簡單介紹ReactJS
- React Native簡介和環境配置React Native
- Linux cgroups 命令簡介Linux
- Linux/UNIX命令dd簡介Linux
- Linux中修改環境變數及生效方法(永久、臨時)環境變數檢視Linux變數
- Flutter學習之路(一)Flutter簡介及Window下開發環境搭建Flutter開發環境
- 雲端計算管理平臺之OpenStack簡介及基礎環境搭建
- linux DISPLAY環境變數介紹Linux變數
- vi 命令使用--AIX環境下總結AI
- Angular環境搭建及簡單體驗Angular