- wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
- tar zxvf webbench-1.5.tar.gz
- cd webbench-1.5
- make && make install
- webbench -c 50000 -t 30 http://127.0.0.1/test.jpg ./webbench -c 2000 -t 60 http://www.9linux.com
- 参数说明:-c表示并发数,-t表示时间(秒)
- 测试结果示例:
- Webbench - Simple Web Benchmark 1.5
- Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
- Benchmarking: GET http://127.0.0.1/test.jpg
- 500 clients, running 30 sec.
- Speed=3230 pages/min, 11614212 bytes/sec.
- Requests: 43000 susceed, 7000 failed.
- ./webbench -c 2000 -t 60 http://www.9linux.com/
- Webbench - Simple Web Benchmark 1.5
- Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
- Benchmarking: GET http://www.9linux.com/
- 2000 clients, running 60 sec.
- Speed=16190 pages/min, 288900 bytes/sec.
- Requests: 14267 susceed, 1923 failed.
- 由上可知在2000并发数下,服务器正常能响应的请求为14267个,失败的请求为1923个。而与此同时我用Fireofx打开网站时已经出现如下信息:
服务器已经不堪重负,直接报错了。最后经过前后参数调整,能正常请求不丢包的并发为1500个。本工具本质为压力测试软件,但也经常有人用来进行攻击,消耗服务器带宽和资源。简单的Dos,可以在nginx或apache中开启每IP并发限制。
- CGIWrap Error: Real UID could not be changed!
- Real UID could not be changed!
- Server Data:
- Server Administrator/Contact: root@9linux.com
- Server Name: www.9linux.com
- Server Port: 80
- Server Protocol: HTTP/1.1
- Request Data:
- User Agent/Browser: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
- Request Method: GET
- Remote Address: 125.77.142.90
- Remote Port: 64171