Home >Backend Development >PHP Problem >How to stress test php

How to stress test php

(*-*)浩
(*-*)浩Original
2019-09-12 10:33:547171browse

Because the company wants to develop a high-concurrency interface, in order to save server resources, it conducts research on some common frameworks to determine which performance meets the requirements

How to stress test php

Preliminary preparation

Install the stress testing tool (I use ab)

ab’s full name is: apache bench

The explanation on the official website is as follows: (Recommended learning: PHP programming from entry to proficiency)

AB is the performance of Apache’s Hypertext Transfer Protocol (HTTP) test tools. Its design intention is to depict the execution performance of the currently installed Apache, mainly to show how many requests per second your installed Apache can handle.

Installation framework

I installed yii2, ci, lumen5.0, tp5, biny framework

for testing

Link each frame to the local database, turn on the cache, and conduct two rounds of tests, one for the pure HTML page and one for the database calculation page.

The pressure measurement is 20 concurrency, and the total is 300

Test results

The database operation and maintenance stress test results are as follows:

How to stress test phpThe pure html interface stress test results are as follows:

How to stress test phpResult Analysis

Native scripts have the strongest ability to withstand pressure, but have low development efficiency and high post-maintenance costs. Moreover, here is just a simple test of the database operation. The specific project The gap may not be that big

The concurrency effect between ci and biny is the best, but the ci version is very old, and updating may be a problem, while biny is Tencent’s recent open source framework, and in some places it is still There are flaws, and the documentation is not friendly enough. Currently, only official documentation is embedded in the framework, there is no manual, and the readability is very poor. Although the efficiency of tp5 is not as good as the above three frameworks, its performance is still good. Yes, the support for php7 is very good. The problem is that the framework directory is confusing, which is not conducive to the development of large projects.

The concurrency support of lumen and yii2 is not very good, but the two frameworks themselves are very powerful, among which yii2 is very good for restful The interface support is more friendly. If you are not short of money, it is recommended to use yii2 for restful interface specification development

The above is the detailed content of How to stress test php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn