weighttp 使用

Weighttp 地址 http://redmine.lighttpd.net/projects/weighttp/wiki

Weighttp的介绍:weighttp  is a lightweight and small benchmarking tool for webservers。Weighttp只支持HTTP协议的一小部分,因此精艺、简单,使用起来也非常容易、快速。支持多线程,异步IO。

Weighttp的事件驱动依靠libev,支持高性能接口:epoll or kqueue等。

安装

Weighttp安装需要libev,找一个libev-4.04.tar.gz包,解压,configure,make,install就可以了,安装之后最好将库添加到系统链接库中

#yum install libev


#wget http://dist.schmorp.de/libev/libev-4.22.tar.gz

[root@localhost ]# echo "/usr/local/lib" >> /etc/ld.so.conf
[root@localhost ]# /sbin/ldconfig

现在开始编译安装Weighttp

tar zxvf weighttp-master.tar.gz
cd weighttp-master
./waf configure
./waf build
./waf install

 

在任何目录下都可运行直接运行命令:weighttp

[root@server1 ~]# weighttp 
weighttp - a lightweight and simple webserver benchmarking tool

error: missing url argument

weighttp <options> <url>
  -n num   number of requests    (mandatory) 请求数量
  -t num   threadcount           (default: 1)线程数量
  -c num   concurrent clients    (default: 1)并发用户数量
  -k       keep alive            (default: no)长连接,默认短连接
  -6       use ipv6              (default: no)Ip6
  -H str   add header to request 增加消息头Header
  -h       show help and exit
  -v       show version and exit

example: weighttpd -n 10000 -c 10 -t 2 -k -H "User-Agent: foo" localhost/index.html

 

Weighttp使用示例

在本机启动一个Web服务器,用Weighttp进行测试,我用的是Jetty7.4

[root@server1 ~]#weighttp -n 1 -k http://192.168.30.13:8080/hello
weighttp - a lightweight and simple webserver benchmarking tool

starting benchmark...
spawning thread #1: 1 concurrent requests, 1 total requests

progress: 100% done

finished in 0 sec, 204 millisec and 32 microsec, 4 req/s, 0 kbyte/s
requests: 1 total, 1 started, 1 done, 1 succeeded, 0 failed, 0 errored
status codes: 1 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 191 bytes total, 141 bytes http, 50 bytes data

几个与Weighttp相似的工具:apache ab,httperf,httpress

posted @ 2016-01-03 12:57  jking10  阅读(992)  评论(0编辑  收藏  举报