Nginx性能测试工具之http_load

       http_load基于linux平台的一种性能测工具.用以测试web服务器的吞吐量与负载,测试web页面的性能.工具简单轻巧容易测试,但只能在Linux系统上使用,且只能测试web服务,不能对数据库进行测试.以下就用一台虚拟机测试一下nginx性能,测试只是写出方法并不是生产环境.

 

1.下载和安装http_load

[root@centos179min home]#  wget http://www.acme.com/software/http_load/http_load-14aug2014.tar.gz

[root@centos179min home]# tar xvf http_load-14aug2014.tar.gz

[root@centos179min home]# cd http_load-14aug2014
[root@centos179min http_load-14aug2014]# make && make install

[root@centos179min 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
[root@centos179min http_load-14aug2014]#

 

2.将要测试的地址写入文件中

[root@centos179min 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 单独的一行。可以单个页面

 

开始测试

[root@centos179min 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
[root@centos179min 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次。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值