几款Web服务器性能压力测试工具
一、http_load
程序非常小,解壓后也不到100K
http_load以并行復用的方式運行,用以測試web服務器的吞吐量與負載。
但是它不同于大多數壓力測試工具,它可以以一個單一的進程運行,一般不會把客戶機搞死。
還可以測試HTTPS類的網站請求。
下載地址:http_load-12mar2006.tar.gz
安裝很簡單
#tar zxvf http_load-12mar2006.tar.gz
#cd http_load-12mar2006
#make && make install
基本用法:
http_load -p 并發訪問進程數 -s 訪問時間 需要訪問的URL文件
參數其實可以自由組合,參數之間的選擇并沒有什么限制。
比如你寫成http_load -parallel 5 -seconds 300 urllist.txt也是可以的。
我們把參數給大家簡單說明一下。
-parallel 簡寫-p :含義是并發的用戶進程數。
-fetches 簡寫-f :含義是總計的訪問次數
-rate 簡寫-p :含義是每秒的訪問頻率
-seconds 簡寫-s :含義是總計的訪問時間
準備URL文件:urllist.txt,文件格式是每行一個URL,URL最好超過50-100個測試效果比較好。
文件格式如下:
http://www.qixing318.com/
http://www.qixing318.com/blog/
http://www.qixing318.com/signin/
http://www.qixing318.com/signup/
http://www.qixing318.com/article/a-quick-look-at-the-redis-source-code.html
http://www.qixing318.com/article/how-the-browser-end-encryption.html
http://www.qixing318.com/article/jquery-form-validation-plug-in-validate.js-the-basic-usage.html
http://www.qixing318.com/article/use-flash-plugin-swfupload-head-is-upload-the-screenshot-in-two-ways.html
http://www.qixing318.com/article/should-make-your-site-using-html5.html
http://www.qixing318.com/article/simple-to-understand-linux-memory-allocation-mechanism.html
http://www.qixing318.com/article/organize-the-sphinx-api-based-on-php.html
http://www.qixing318.com/article/jquery-1-9-removed-browser-method-alternatives.html
http://www.qixing318.com/article/the-installation-of-fedora-under-chinese-search-sphinx-configuration.html
http://www.qixing318.com/article/schema-org-tag-was-used-to-optimize-web-pages.html
http://www.qixing318.com/article/jquery-reference-manual-tutorials-and-tools.html
http://www.qixing318.com/article/falling-in-love-with-bike-30-reasons.html
http://www.qixing318.com/article/online-test-tools-browserstack-cross-browser-compatibility.html
http://www.qixing318.com/article/talk-about-javascript-image-preloading-technology.html
http://www.qixing318.com/article/brokeback-mountain.html
http://www.qixing318.com/article/sql-index-caused-performance-issues.html
http://www.qixing318.com/article/use-python-scapy-reporter.html
http://www.qixing318.com/article/a-python-web-attack-script.html
例如:
http_load -p 30 -s 60 urllist.txt
參數了解了,我們來看運行一條命令來看看它的返回結果如下:
結果分析:
1、294 fetches, 30 max parallel, 3.83835e+06 bytes, in 60.0026 seconds
說明在上面的測試中運行了294個請求,最大的并發進程數是30,總計傳輸的數據是3.83835e+06bytes,運行的時間是60.0026秒
2、13055.6 mean bytes/connection
說明每一連接平均傳輸的數據量3.83835e+06/294=13055.6
3、4.89979 fetches/sec, 63969.7 bytes/sec
說明每秒的響應請求為4.89979,每秒傳遞的數據為63969.7 bytes/sec
4、msecs/connect: 312.009 mean, 1319.57 max, 209.994 min
說明每連接的平均響應時間是312.009 msecs,最大的響應時間1319.57 msecs,最小的響應時間209.994 msecs
5、msecs/first-response: 1191.01 mean, 10212.4 max, 220.78 min
6、HTTP response codes:
code 200 – 127
code 502 – 166
說明打開響應頁面的類型
如果403的類型過多,那可能要注意是否系統遇到了瓶頸。
特殊說明:
測試結果中主要的指標是 fetches/sec、msecs/connect 這個選項,即服務器每秒能夠響應的查詢次數。
用這個指標來衡量性能。似乎比 apache的ab準確率要高一些,也更有說服力一些。
Qpt-每秒響應用戶數和response time,每連接響應用戶時間。
測試的結果主要也是看這兩個值。
當然僅有這兩個指標并不能完成對性能的分析,我們還需要對服務器的cpu、men進行分析,才能得出結論。
http_load壓力測試windows版使用方法及結果分析
工具下載:
https://pan.baidu.com/s/1gftN13H
配置說明:
解壓后將cygwin1.dll 放置到 C:\Windows\system目錄下,將http_load.exe 放置到 C: \Windows\System32目錄下。
進入cmd命令行,輸入命令http_load顯示相關說明則配置成功。
使用方法:
http_load -p 10 -s 60 -r 3 -f 100 c:\urls.txt
參數的含義:
-parallel 簡寫-p :并發的用戶進程數
-fetches 簡寫-f :總計的訪問請求次數
-rate 簡寫-r :每秒的訪問頻率
-seconds簡寫-s :總計的訪問時間
準備URL文件:urls.txt,文件格式是每行一個URL
結果分析:
49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds5916 mean
bytes/connection4.89274
fetches/sec, 28945.5 bytes/secmsecs/connect: 28.8932 mean, 44.243 max, 24.488minmsecs/first
-response: 63.5362 mean, 81.624 max, 57.803 minHTTP response codes: code 200— 49
1.49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
說明在上面的測試中運行了49個請求,最大的并發進程數是2,總計傳輸的數據是289884bytes,運行的時間是10.0148秒
2.5916 mean bytes/connection
說明每一連接平均傳輸的數據量289884/49=5916
3.4.89274 fetches/sec, 28945.5 bytes/sec
說明每秒的響應請求為4.89274,每秒傳遞的數據為28945.5 bytes/sec
4.msecs/connect: 28.8932 mean, 44.243 max, 24.488 min
說明每連接的平均響應時間是28.8932 msecs,最大的響應時間44.243 msecs,最小的響應時間24.488 msecs
5.msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
6.HTTP response codes: code 200 — 49
說明打開響應頁面的類型,如果403的類型過多,可能要注意是否系統
特殊說明:
測試結果中主要的指標是 fetches/sec、msecs/connect 這個選項,即服務器每秒能夠響應的查詢次數,用這個指標來衡量性能。似乎比 apache的ab準確率要高一些,也更有說服力一些。遇到了瓶頸。
二、webbench
webbench是Linux下的一個網站壓力測試工具,最多可以模擬3萬個并發連接去測試網站的負載能力。
下載地址可以到google搜,我這里給出一個
下載地址:http://soft.vpser.net/test/webbench/webbench-1.5.tar.gz
這個程序更小,解壓后不到50K,呵呵
安裝非常簡單
#tar zxvf webbench-1.5.tar.gz
#cd webbench-1.5
#make && make install
會在當前目錄生成webbench可執行文件,直接可以使用了
用法:webbench -c 并發數 -t 運行測試時間 URL
例如:
#webbench -c 1000 -t 130 http://www.qixing318.com
三、ab
ab是apache自帶的一款功能強大的測試工具。
安裝了apache一般就自帶了。
用法可以查看它的說明
#./ab
參數眾多,一般我們用到的是-n 和-c
例如:
#webbench -c 1000 -t 130 http://www.qixing318.com/index.php
這個表示同時處理1000個請求并運行130次index.php文件。
四、Siege
一款開源的壓力測試工具,可以根據配置對一個WEB站點進行多用戶的并發訪問,記錄每個用戶所有請求過程的相應時間,并在一定數量的并發訪問下重復進行。
Siege官方:http://www.joedog.org/
Siege下載:http://www.joedog.org/pub/siege/siege-latest.tar.gz
Siege解壓并安裝:
tar -zxvf siege-latest.tar.gz
cd siege-latest/
#./configure
#make
#make install
Siege使用:
#siege -c 100 -r 10 -f site.url
-c是并發量,-r是重復次數。
url文件就是一個文本,每行都是一個url,它會從里面隨機訪問的。
site.url內容:
http://www.qixing318.com/
http://www.zendsns.com/
http://www.qixing.info/
測試結果:
結果說明:
Transactions: 550 hits //完成550次處理
Availability: 55.00 % //55.00 % 成功率
Elapsed time: 31.32 secs //總共用時
Data transferred: 1.15 MB //共數據傳輸1.15 MB
Response time: 3.04 secs //顯示網絡連接的速度
Transaction rate: 17.56 trans/sec //均每秒完成 17.56 次處理:表示服務器后
Throughput: 0.04 MB/sec //平均每秒傳送數據
Concurrency: 53.44 //實際最高并發數
Successful transactions: 433 //成功處理次數
Failed transactions: 450 //失敗處理次數
Longest transaction: 15.50 //每次傳輸所花最長時間
Shortest transaction: 0.42 //每次傳輸所花最短時間
總結
以上是生活随笔為你收集整理的几款Web服务器性能压力测试工具的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 看看自己08年的基金是否能赚钱
- 下一篇: memcached应用策略(转)