|
格式: ./ab [options] [http://]hostname[:port]/path 參數(shù): -n requests Number of requests to perform //在測試會話中所執(zhí)行的請求個數(shù)。默認時,僅執(zhí)行一個請求 -c concurrency Number of multiple requests to make //一次產(chǎn)生的請求個數(shù)。默認是一次一個。 -t timelimit Seconds to max. wait for responses //測試所進行的最大秒數(shù)。其內(nèi)部隱含值是-n 50000。它可以使對服務(wù)器的測試限制在一個固定的總時間以內(nèi)。默認時,沒有時間限制。 -p postfile File containing data to POST //包含了需要POST的數(shù)據(jù)的文件. -T content-type Content-type header for POSTing //POST數(shù)據(jù)所使用的Content-type頭信息。 -v verbosity How much troubleshooting info to print //設(shè)置顯示信息的詳細程度 - 4或更大值會顯示頭信息, 3或更大值可以顯示響應(yīng)代碼(404, 200等), 2或更大值可以顯示警告和其他信息。 -V 顯示版本號并退出。 -w Print out results in HTML tables //以HTML表的格式輸出結(jié)果。默認時,它是白色背景的兩列寬度的一張表。 -i Use HEAD instead of GET // 執(zhí)行HEAD請求,而不是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) //-C cookie-name=value 對請求附加一個Cookie:行。 其典型形式是name=value的一個參數(shù)對。此參數(shù)可以重復。 -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. //-P proxy-auth-username:password 對一個中轉(zhuǎn)代理提供BASIC認證信任。用戶名和密碼由一個:隔開,并以base64編碼形式發(fā)送。無論服務(wù)器是否需要(即, 是否發(fā)送了401認證需求代碼),此字符串都會被發(fā)送。 -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 -h Display usage information (this message) //-attributes 設(shè)置 屬性的字符串. 缺陷程序中有各種靜態(tài)聲明的固定長度的緩沖區(qū)。另外,對命令行參數(shù)、服務(wù)器的響應(yīng)頭和其他外部輸入的解析也很簡單,這可能會有不良后果。它沒有完整地實現(xiàn)HTTP/1.x; 僅接受某些'預想'的響應(yīng)格式。 strstr(3)的頻繁使用可能會帶來性能問題,即, 你可能是在測試ab而不是服務(wù)器的性能。 參數(shù)很多,一般我們用 -c 和 -n 參數(shù)就可以了. 例如: ./ab -c 1000 -n 1000 http://127.0.0.1/index.php 這個表示同時處理1000個請求并運行1000次index.php文件. Benchmarking 127.0.0.1 (be patient)
Document Path: /index.html.zh-cn.gb2312 Concurrency Level: 1000 Connection Times (ms) Percentage of the requests served within a certain time (ms) 由于對于并發(fā)請求,cpu實際上并不是同時處理的,而是按照每個請求獲得的時間片逐個輪轉(zhuǎn)處理的,所以基本上第一個Time per request時間約等于第二個Time per request時間乘以并發(fā)請求數(shù) |
|
|