程式壓力測試軟體

2021-06-16 05:15:54 字數 3926 閱讀 2864

由於一些原因要進行一些程式**的壓力測試,

webbench  和  apache自帶的一款外掛程式ab

webbench可以測試get,head等請求,但不支援post請求,由於我正好是post請求測試,所以只好捨棄它了,改用了apache自帶的外掛程式ab(apache-benchmark)。這個外掛程式支援post請求程式測試。

所以我們要使用這個外掛程式,必須先要安裝apache,然後就可以使用了

如果你不想安裝apache,單獨安裝ab也可以,對於ubuntu,安裝命令如下:

//在測試會話中所執行的請求個數。預設時。僅執行乙個請求

-c concurrency  number of multiple requests to make

//一次產生的請求個數。即併發個數,預設是一次乙個

-t timelimit    seconds to max. wait for responses

//等待response響應的最大秒時間

-b windowsize   size of tcp send/receive buffer, in bytes

-p postfile     file containing data to post. remember also to set -t

//post請求時,post需要傳輸資料的檔案路徑和名稱

。同時別忘了設定-t資訊

//post資料所使用的content-type頭資訊。

小測試了一下:

server software:        gws

/*請求網域名稱*/

server hostname:        www.google.com

/*請求的埠號*/

server port:            80

document path:          /

document length:        458 bytes

concurrency level:      10

/*整個測試持續的時間*/

time taken for tests:   0.265 seconds

/*完成的請求數量*/

complete requests:      10

/*失敗的請求數量*/

failed requests:        0

write errors:           0

non-2xx responses:      10

total transferred:      12890 bytes

html transferred:       4580 bytes

//每秒事務數(mean)代表平均值

requests per second:    37.71 [#/sec] (mean)

//平均事務響應時間(mean)表示是平均值

time per request:       265.207 [ms] (mean)

//每個請求實際執行時間的平均值

time per request:       26.521 [ms] (mean, across all concurrent requests)

transfer rate:          47.46 [kbytes/sec] received

connection times (ms)

min  mean[+/-sd] median   max

connect:       83   93   7.3     95     104

processing:   125  145  10.7    145     166

waiting:      125  145  10.8    145     166

total:        208  239  16.9    242     265

//50%的請求響應時間小於242毫秒,66%請求響應時間小於246毫秒,......

percentage of the requests served within a certain time (ms)

50%    242

66%    246

75%    252

80%    255

90%    265

95%    265

98%    265

99%    265

100%    265 (longest request)

http load壓力測試軟體

http load 測試web伺服器的吞吐量與負載 2 如果遇到錯誤,可以執行安裝 yum y install gcc gcc c 4 http load測試的命令格式是 http load p 100 s 10 url p表示併發程序數,s表示持續時間,此命令表示在10秒鐘內以每次100個併發程序...

stress 壓力測試軟體

ubuntu下安裝 zw zw pc apt get install stress zw zw pc apt get install htop top的增強版,比較直觀 zw zw pc stress help stress imposes certain types of compute stre...

介面壓力測試軟體jmeter

另外如果介面請求的是json引數,請參考 這裡說優化方案 當用壓力測試軟體測試介面在高併發的情況下出現記憶體溢位,資料庫死鎖等系統奔潰情況的時候,就要考慮優化 優化途徑一般有二 1 用redis快取 public list getuserinfobycache integer userid gett...