小试 httperf

httperf是个web 服务器的性能测试工具

Step1) 安装

cd /usr/local/

tar xvzf httperf-0.9.0.tar.gz

cd httperf-0.9.0

./configure --prefix=/usr/local/weip/httperf-0.9.0

make && make install

Step2) 测试

通过如下命令:

httperf --server xx.com /
--port 80 /
--uri /foreground/all_stars
/
--rate
100 /
--num-conn
2000 /
--num-call 1 /
--timeout 5

rate是指每秒多少个请求数,num-conn指共发多少个请求 ,num-call每次连接发送的请求数通常为1

Step3)实战

背景:lighttpd+fcgi+rails部署在192.168.100.234,httperf运行在192.168.100.231

Case1) 利用rails生成了静态页面

httperf输出结果:

。。。。。

Total: connections 2000 requests 2000 replies 2000 test-duration 19.991 s

Connection rate: 100.0 conn/s (10.0 ms/conn, <=1 concurrent connections)

Connection time [ms]: min 0.6 avg 0.7 max 1.1 median 0.5 stddev 0.0

Connection time [ms]: connect 0.0

Connection length [replies/conn]: 1.000

Request rate: 100.0 req/s (10.0 ms/req)

Request size [B]: 86.0

Reply rate [replies/s]: min 100.0 avg 100.0 max 100.0 stddev 0.0 (3 samples)

Reply time [ms]: response 0.5 transfer 0.2

Reply size [B]: header 240.0 content 52164.0 footer 0.0 (total 52404.0)

Reply status: 1xx=0 2xx=2000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 6.43 system 12.60 (user 32.2% system 63.0% total 95.2%)

Net I/O: 5128.2 KB/s (42.0*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

可见每秒100个请求没问题

Case2 )纯动态页面,不做缓存处理

每秒100个请求完全崩溃

将每秒100改为10个,共发送200个请求,服务在19.948 s内顺利完成任务

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值