webbench之使用(二)

[root@lam7 ~]# webbench -help
webbench [option]... URL
-f|--force                  Don't wait for reply from server.        不等待服务器响应
-r|--reload         Send reload request - Pragma: no-cache.  发送重载请求 - 杂注:无缓存。
-t|--time         <sec> Run benchmark for <sec> seconds. Default 30.   运行<>秒基准。默认值为30。
-p|--proxy         <server:port> Use proxy server for request.  <服务器:端口>的要求使用代理服务器。
-c|--clients        <n> Run <n> HTTP clients at once. Default one.   <N>运行<N> HTTP客户端一次。默认值。
-9|--http09           Use HTTP/0.9 style requests.  使用HTTP/ 0.9风格的请求。
-1|--http10         Use HTTP/1.0 protocol.     使用HTTP / 1.0协议。
-2|--http11         Use HTTP/1.1 protocol.    使用HTTP / 1.1协议。
--get             Use GET request method.   使用GET请求方法。
--head              Use HEAD request method.    使用HEAD请求方法。
--options           Use OPTIONS request method.     使用的选项请求方法。
--trace              Use TRACE request method.    使用跟踪请求方法。
-?|-h|--help          This information.
-V|--version          Display program version.    显示程序版本。

参数说明:-c表示并发数,-t表示时间(秒)

测试结果示例:

并发100个,运行30s,访问请求全部成功,速度4208 pages/min, 3947546 bytes/sec

[root@lam7 ~]# webbench -c 100 -t 30 http://www.cnblogs.com/Lam7/p/5842061.html
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://www.cnblogs.com/Lam7/p/5842061.html
100 clients, running 30 sec.

Speed=4208 pages/min, 3947546 bytes/sec.
Requests: 2104 susceed, 0 failed.

1、压力测试工作应该放到产品上线之前,而不是上线以后 

2、测试时尽量跨公网进行,而不是内网

3、测试时并发应当由小逐渐加大,比如并发100时观察一下网站负载是多少、打开是否流程,并发200时又是多少、网站打开缓慢时并发是多少、网站打不开时并发又是多少 

4、 应尽量进行单元测试,如B2C网站可以着重测试购物车、推广页面等,因为这些页面占整个网站访问量比重较大

原文地址:https://www.cnblogs.com/Lam7/p/5844524.html