Written by bixuan on 2008年06月26号 – 22:14
做個标記:)
Httperf 是一個高效的 http 壓力測試工具,使用它可以模拟出超過1千的并發通路,能充分測試出 web server 的性能。而之前使用的 siege 測試工具則未能突破 500 個并發測試(如果您知道如何可以實作,請告訴我)
使用 httperf 應該能了解到自己編寫 yo2cache 軟體性能極限如何了
以下是 gzip 格式通路的測試資料(因緩存檔案以 gzip 格式儲存,是以性能是最高的)
oneoo@oneoo-pc:~/Desktop$ httperf –server oneoo.com –num-conns 2000 –add-header “accept-encoding: gzip” httperf –client=0/1 –server=oneoo.com –port=80 –uri=/ –send-buffer=4096 –recv-buffer=16384 –add-header=’accept-encoding: gzip’ –num-conns=2000 –num-calls=1 Maximum connect burst length: 1 Total: connections 2000 requests 2000 replies 2000 test-duration 1.304 s Connection rate: 1533.7 conn/s (0.7 ms/conn, Connection time [ms]: min 0.6 avg 0.7 max 6.3 median 0.5 stddev 0.2 Connection time [ms]: connect 0.0 Connection length [replies/conn]: 1.000 Request rate: 1533.7 req/s (0.7 ms/req) Request size [B]: 81.0 Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples) Reply time [ms]: response 0.6 transfer 0.0 Reply size [B]: header 302.0 content 10482.0 footer 0.0 (total 10784.0) Reply status: 1xx=0 2xx=2000 3xx=0 4xx=0 5xx=0 CPU time [s]: user 0.29 system 1.01 (user 22.4% system 77.6% total 100.0%) Net I/O: 16273.4 KB/s (133.3*10^6 bps) Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0 Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
以下是 deflate (2級壓縮率)格式通路的統計資料(需要從 gzip 解壓,再壓縮為 deflate 的資料處理)
oneoo@oneoo-pc:~/Desktop$ httperf –server oneoo.com –num-conns 2000 –add-header “accept-encoding: deflate” httperf –client=0/1 –server=oneoo.com –port=80 –uri=/ –send-buffer=4096 –recv-buffer=16384 –add-header=’accept-encoding: deflate’ –num-conns=2000 –num-calls=1 Total: connections 2000 requests 2000 replies 2000 test-duration 4.113 s Connection rate: 486.2 conn/s (2.1 ms/conn, Connection time [ms]: min 2.0 avg 2.1 max 11.8 median 2.5 stddev 0.3 Request rate: 486.2 req/s (2.1 ms/req) Request size [B]: 84.0 Reply time [ms]: response 0.6 transfer 1.5 Reply size [B]: header 305.0 content 11014.0 footer 0.0 (total 11319.0) CPU time [s]: user 0.91 system 3.20 (user 22.2% system 77.8% total 100.0%) Net I/O: 5414.3 KB/s (44.4*10^6 bps)
以下是 deflate (4級壓縮率)格式通路的統計資料
Total: connections 2000 requests 2000 replies 2000 test-duration 5.329 s Connection rate: 375.3 conn/s (2.7 ms/conn, Connection time [ms]: min 2.6 avg 2.7 max 32.8 median 2.5 stddev 0.7 Request rate: 375.3 req/s (2.7 ms/req) Reply rate [replies/s]: min 374.8 avg 374.8 max 374.8 stddev 0.0 (1 samples) Reply time [ms]: response 0.6 transfer 2.0 Reply size [B]: header 305.0 content 10457.0 footer 0.0 (total 10762.0) CPU time [s]: user 1.29 system 4.01 (user 24.2% system 75.2% total 99.4%) Net I/O: 3975.4 KB/s (32.6*10^6 bps)
以下是文本格式通路的統計資料
oneoo@oneoo-pc:~/Desktop$ httperf –server oneoo.com –num-conns 2000 –add-header “accept-encoding: normal” httperf –client=0/1 –server=oneoo.com –port=80 –uri=/ –send-buffer=4096 –recv-buffer=16384 –add-header=’accept-encoding: normal’ –num-conns=2000 –num-calls=1 Total: connections 2000 requests 2000 replies 2000 test-duration 2.349 s Connection rate: 851.3 conn/s (1.2 ms/conn, Connection time [ms]: min 1.1 avg 1.2 max 5.8 median 1.5 stddev 0.2 Request rate: 851.3 req/s (1.2 ms/req) Request size [B]: 83.0 Reply time [ms]: response 0.6 transfer 0.6 Reply size [B]: header 278.0 content 42562.0 footer 0.0 (total 42840.0) CPU time [s]: user 0.62 system 1.73 (user 26.2% system 73.7% total 99.9%) Net I/O: 35683.0 KB/s (292.3*10^6 bps)
從以上資料可以看到 yo2cache 性能挺好的,最高能達到每秒 1500 個并發處理。性能瓶頸是出現在緩存資料的解壓與壓縮處理上,如果緩存空間足夠大的話,可以考慮儲存多種格式的緩存資料,就能解決這個瓶頸問題。
而在 deflate 資料壓縮方面,因為2級壓縮率與4級壓縮率所産生的資料量差距不大,但并發性能有一定差距,可以考慮使用 2 級壓縮率。
From:http://oneoo.com/articles/httperf-the-pressure-of-a-high-performance-test-tools.html