1.server
服务器端查看性能
tail -f nginx.log | awk '{print $4;}' | sort | uniq -c
有很多时候,你不清楚浏览器到底是怎么请求的消息
apache服务器为例子,首先停止服务器
/etc/init.d/httpd start|stop|restart|reload|status
使用万能工具nc
nc -l 80
截获浏览器请求,安装原样,使用压测工具请求即可~
2.jmeter
没有研究过,不过cookie需要单独写入
3.ab
<span style="font-size:10px;"><span style="font-size:10px;"><span style="font-size:10px;"><?php
$file=fopen('log.txt','a+');
fwrite($file,date("Y-m-d H:i:s"));
fwrite($file," ");
fwrite($file,$_REQUEST['test']);
fwrite($file,"\r\n");
fclose($file);
?></span></span></span>
压测上面的php页面
test1=a&test2=b
下面这种格式是错误的,ab会把整个a回车test2=b 当作test1这个field传送出去
test1=a
test2=b
4.pylot
具体使用看我以前的文章
使用pylot压测时,有时候返回一种错误 504 : Gateway Timeout with urllib2
5xx status codes are problems with the server (compared with 4xx status codes, which are problems with the client). This means you sent the server a valid request, but the server was unable to serve a valid response.
Your code is fine, but the server (or in this case, a gateway that the server is using) is having problems. You just need to wait patiently for the server to resolve its own issues, or contact the server administrator and inform them that their server is misbehaving.
5.conclusion
几种工具比较起来
ab性能比较好,可以并发压力比较大,但是服务比较笨,无法处理302跳转这些动作
pylot性能稍差,但是文档和报告都比较好,最好的是可以改动源码,对问题进一步跟踪
http://www.vpser.net/opt/webserver-test.html