標籤:web伺服器 linux 虛擬機器 資料庫 nginx
http_load基於linux平台的一種效能測工具.用以測試web伺服器的輸送量與負載,測試web頁面的效能.工具簡單輕巧容易測試,但只能在Linux系統上使用,且只能測試web服務,不能對資料庫進行測試.以下就用一台虛擬機器測試一下nginx效能,測試只是寫出方法並不是生產環境.
1.下載和安裝http_load
[[email protected] home]# wget http://www.acme.com/software/http_load/http_load-14aug2014.tar.gz
[[email protected] home]# tar xvf http_load-14aug2014.tar.gz
[[email protected] home]# cd http_load-14aug2014
[[email protected] http_load-14aug2014]# make && make install
[[email protected] http_load-14aug2014]# ll
總用量 128
-rw-r--r--. 1 root root 51 10月 9 18:15 1.txt
-r--r--r--. 1 root root 97 7月 16 2001 FILES
-rwxr-xr-x. 1 root root 24400 10月 9 18:00 http_load
-r--r--r--. 1 root root 5414 5月 21 2005 http_load.1
-r--r--r--. 1 root root 47394 8月 15 10:48 http_load.c
-rw-r--r--. 1 root root 1682 8月 12 03:13 Makefile
-r-xr-xr-x. 1 root root 1178 9月 14 2000 make_test_files
-r--r--r--. 1 root root 2397 8月 3 02:04 port.h
-r--r--r--. 1 root root 1035 3月 13 2006 README
-r--r--r--. 1 root root 7362 7月 10 08:25 timers.c
-r--r--r--. 1 root root 3832 7月 10 08:09 timers.h
-rw-r--r--. 1 root root 4760 10月 9 18:00 timers.o
-r--r--r--. 1 root root 163 8月 14 06:53 version.h
[[email protected] http_load-14aug2014]#
2.將要測試的地址寫入檔案中
[[email protected] http_load-14aug2014]# vim 1.txt
http://192.168.1.179/test.php --可以寫多個
http://192.168.1.179
3.測試檔案中的地址
參數介紹:
-fetches 簡寫-f :含義是總計的訪問次數
-rate 簡寫-r :含義是每秒的訪問頻率
-seconds 簡寫-s :含義是總計的訪問時間
-parallel 簡寫-p:並發訪問的線程數
urls是一個url 列表,每個url 單獨的一行。可以單個頁面
開始測試
[[email protected] http_load-14aug2014]# ./http_load -p 10 -s 5 1.txt
2059 fetches, 10 max parallel, 5.44223e+07 bytes, in 5.00237 seconds
26431.4 mean bytes/connection
411.605 fetches/sec, 1.08793e+07 bytes/sec
msecs/connect: 0.078831 mean, 0.874 max, 0.028 min
msecs/first-response: 6.322 mean, 3003.78 max, 0.071 min
HTTP response codes:
code 200 -- 2059
[[email protected] http_load-14aug2014]#
分析結果
2059 fetches, 10 max parallel, 5.44223e+07 bytes, in 5.00237 seconds
一共請求串連2059次,最大並發線程10個,持續5.00237秒內,總傳輸速率為5.44223e+07 bytes
26431.4 mean bytes/connection
每次請求串連平均資料量(5.44223e+07÷41)
411.605 fetches/sec, 1.08793e+07 bytes/sec
每秒的響應請求串連數為411.605 個,每秒傳輸的資料為1.08793e+07bytes/毫秒
msecs/connect: 0.078831 mean, 0.874 max, 0.028 min
每次串連平均回應時間:0.078831 264.607毫秒,最大時間: 0.874 毫秒,最小時間:0.028 毫秒
msecs/first-response: 6.322 mean, 3003.78 max, 0.071 min
每次串連平均返回時間:6.322 毫秒,最大時間:3003.78 毫秒,最小時間:0.071 毫秒
code 200 -- 2059
HTTP返回碼:200 ,一共2059次。
本文出自 “XFICC” 部落格,請務必保留此出處http://xficc.blog.51cto.com/1189288/1562349
Nginx效能測試工具之http_load