Weighttp 学习 使用 安装
来源:互联网 发布:apache错误日志在哪 编辑:程序博客网 时间:2024/06/05 07:04
最近对web服务器做简单的压力测试,使用的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等。
安装
我的系统是RedHat 6.0,安装时提示缺少libev,自己安装了libev,Weighttp是编译安装的,安装过程中提示缺少什么就安装什么就可以了。
Weighttp的安装非常简单,在上面地址找到 版本库,下载里面所有文件
Weighttp安装需要libev,找一个libev-4.04.tar.gz包,解压,configure,make,install就可以了,安装之后最好将库添加到系统链接库中
[root@localhost ]# echo "/usr/local/lib" >> /etc/ld.so.conf[root@localhost ]# /sbin/ldconfig
现在开始编译安装Weighttp
tar zxvf weighttp-master.tar.gzcd weighttp-master./waf configure./waf build./waf install
在任何目录下都可运行直接运行命令:weighttp
[root@server1 ~]# weighttp weighttp - a lightweight and simple webserver benchmarking toolerror: missing url argumentweighttp <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 exitexample: 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/helloweighttp - a lightweight and simple webserver benchmarking toolstarting benchmark...spawning thread #1: 1 concurrent requests, 1 total requestsprogress: 100% donefinished in 0 sec, 204 millisec and 32 microsec, 4 req/s, 0 kbyte/srequests: 1 total, 1 started, 1 done, 1 succeeded, 0 failed, 0 erroredstatus codes: 1 2xx, 0 3xx, 0 4xx, 0 5xxtraffic: 191 bytes total, 141 bytes http, 50 bytes data
修改源码,打印请求和响应
[root@server1 ~]# weighttp -n 1 -k http://192.168.30.13:8080/helloweighttp - a lightweight and simple webserver benchmarking toolRequest (99):==========GET /hello HTTP/1.1Host: 192.168.30.13:8080User-Agent: weighttp/0.3Connection: keep-alive==========host: '192.168.30.13', port: 8080starting benchmark...spawning thread #1: 1 concurrent requests, 1 total requestsread(): 186, offset was: 0response buffer:==========HTTP/1.1 200 OKDate: Fri, 14 Feb 2014 02:35:59 GMTContent-Type: text/htmlTransfer-Encoding: chunkedServer: Jetty(7.4.5.v20110725)27<html><h1>Hello World</h1></html>==========read(): 5, offset was: 0response buffer:==========0==========progress: 100% donefinished in 0 sec, 205 millisec and 276 microsec, 4 req/s, 0 kbyte/srequests: 1 total, 1 started, 1 done, 1 succeeded, 0 failed, 0 erroredstatus codes: 1 2xx, 0 3xx, 0 4xx, 0 5xxtraffic: 191 bytes total, 141 bytes http, 50 bytes data
并发测试,100个请求,10个线程,10个client
[root@server1 ~]# weighttp -n 100 -t 10 -c 10 -k http://192.168.30.13:8080/helloweighttp - a lightweight and simple webserver benchmarking toolRequest (99):==========GET /hello HTTP/1.1Host: 192.168.30.13:8080User-Agent: weighttp/0.3Connection: keep-alive==========host: '192.168.30.13', port: 8080starting benchmark...spawning thread #1: 1 concurrent requests, 10 total requestsspawning thread #2: 1 concurrent requests, 10 total requestsspawning thread #3: 1 concurrent requests, 10 total requestsspawning thread #4: 1 concurrent requests, 10 total requestsspawning thread #5: 1 concurrent requests, 10 total requestsspawning thread #6: 1 concurrent requests, 10 total requestsspawning thread #7: 1 concurrent requests, 10 total requestsspawning thread #8: 1 concurrent requests, 10 total requestsspawning thread #9: 1 concurrent requests, 10 total requestsspawning thread #10: 1 concurrent requests, 10 total requestsprogress: 10% doneprogress: 20% doneprogress: 30% doneprogress: 40% doneprogress: 50% doneprogress: 60% doneprogress: 70% doneprogress: 80% doneprogress: 90% doneprogress: 100% donefinished in 2 sec, 226 millisec and 627 microsec, 44 req/s, 8 kbyte/srequests: 100 total, 100 started, 100 done, 100 succeeded, 0 failed, 0 erroredstatus codes: 100 2xx, 0 3xx, 0 4xx, 0 5xxtraffic: 19100 bytes total, 14100 bytes http, 5000 bytes data
几个与Weighttp相似的工具:apache ab,httperf,httpress
0 0
- Weighttp 学习 使用 安装
- Weighttp 源码分析
- hadoop学习--安装使用
- docker安装、使用学习
- [fluentd学习]安装使用
- 学习Tensorflow,使用源码安装
- nodejs安装以及使用学习
- TensorFlow学习:安装和使用
- 学习maven安装和使用
- MINIGUI学习笔记之安装使用
- Smarty学习笔记一:安装与使用
- 【学习笔记】log4cxx安装和使用
- sqlalchemy的安装及学习使用
- Nginx安装学习使用详细记录
- Virtualbox 安装CoreOS 学习使用Docker
- 使用PackageInstaller安装app流程学习小结
- Memcached学习一:Memcached安装使用
- Python学习笔记1_安装使用
- Linux系统下开发或者运行java程序
- C++ 拷贝构造函数和重载赋值操作符不能相互调用
- mysql的逆袭:如何做递归层次查询
- Nginx与PHP(FastCGI)的安装、配置与优化
- 支持多平台的2D和3D游戏引擎Godot开源
- Weighttp 学习 使用 安装
- rtmp服务器解决方案
- 编译及安装QCA类库及使用
- Android SDK 更新问题解决方法
- ios7版 30天精通iPhone手机编程 第24天 璀璨的烟花
- 算法入门经典第八章学习笔记(中)
- IIS7 IIS8 应用程序池用户
- java 从零开始,学习笔记之基础入门<Struts2_实战演练(上)>(三十八)
- OpenGL: 创建名字栈