Home >Backend Development >PHP Tutorial >PHP performance optimization (1) Stress testing tools
ab uses
<code> Apache附带的压力测试工具ab,非常容易使用,并且完全可以摸你各种条件对Web服务器发起测试请求。ab可以直接在Web服务器本地发起测试请求,这对于需要了解服务器的处理性能至关重要,因为它不包括数据的网络传输时间以及用户PC本地的计算时间。。 </code>
to execute 1000 connections and 20 concurrent (parallel, simultaneous):
Syntax: ab -n 1000 -c 20 www.baidu.com
The results generated. What should be noted are the following:
§ Time taken for tests: How long did it take to execute in total. (The above 1000 times total How long)
§ Requests per second: How many connections can be processed on average per second.
webbench
can simulate up to 30,000 concurrent connections to test the load capacity of the website. Personally, I feel it is better than the ab stress testing tool that comes with Apache. Well, it’s very easy to install and use.
Webbench installation
<code>wget http://home<span>.tiscali</span><span>.cz</span>/cz210552/distfiles/webbench-<span>1.5</span><span>.tar</span><span>.gz</span> tar zxvf webbench-<span>1.5</span><span>.tar</span><span>.gz</span> cd webbench-<span>1.5</span> make && make install </code>
How to use webbench
webbench -c 500 -t 30 http://127.0.0.1/test.php
Parameter description of webbench
-c represents the number of concurrencies, -t represents time (seconds)
Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above has introduced the PHP performance optimization (1) Stress Testing Tool, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.