PHP framework performance test report_php skills

Source: Internet
Author: User
Tags connection reset
This article will share with you the performance test reports of several common php frameworks under different circumstances, and provide some help when selecting a framework. As a PHP developer and a technical developer of the startup team, it is very difficult to select a development framework.

If ThinkPHP is used, you can get started by recruiting a developer from a training institution. However, decoupling performance from code in the future is a headache. However, many third-party functions do not need to be written by themselves, and many Daniel has paved the way.

In Laravel's words, it is a legend that it is well written and has enough scalability, but the learning cost is a bit high. it is impossible for junior developers to spend half a month learning the framework. Moreover, it is said that Laravel's performance is poor, and the documentation is not very rich.

If Yii is used, the syntax is a bit wordy, and it is a little troublesome to separate the front-end code. However, the performance is very good, and many large domestic companies are using it, in case of an accident, you can quickly find Daniel to answer questions.

It is better to make a simple performance evaluation. selecting a superior performance will never make a mistake.

Performance testing
Tested on: July 15, May 06, 2016
Test Tool: siege (because the AB in the MAC system always has the pr_socket_recv: Connection reset by peer (54) error, siege is selected)
Test Machine: MacPro Core i5 processor/8 GB memory/256 gb ssd Flash
Test Environment: Apache PHP5.6
Framework Version: ThinkPHP 3.2.3 Laravel 5.2 Yii2.0.5
Test principle: test cycles 5 times each time, taking medium data
Note: All projects are made in sub-directories.

Result description

Transactions: 2119 total number of hits processing requests Availability: 96.85% Availability Elapsed time: 9.74 secs running time Data transferred: 1.31 MB Data transmission volume Response time: 0.60 secs Response time Transaction rate: 217.56 trans/sec processing efficiency per second Throughput: 0.13 MB/sec processing data per second Concurrency: 130.28 concurrent Successful transactions: 2162 Successful requests Failed transactions: 69 Failed requests Longest transaction: 2.85 maximum single request Shortest transaction: 0.01 minimum single request

Start Testing

Add a controller and enter HelloWorld 10000 times in the controller

Concurrency 50 cycles 10 times:

ThinkPHP comes to us first. it looks okay.

Transactions:         500 hitsAvailability:       100.00 %Elapsed time:        2.81 secsData transferred:      52.45 MBResponse time:        0.26 secsTransaction rate:     177.94 trans/secThroughput:        18.67 MB/secConcurrency:        47.10Successful transactions:     500Failed transactions:        0Longest transaction:      0.48Shortest transaction:      0.03

Then Laravle. well, I'm a little disappointed.

Transactions:         500 hitsAvailability:       100.00 %Elapsed time:        13.33 secsData transferred:      52.45 MBResponse time:        1.27 secsTransaction rate:      37.51 trans/secThroughput:        3.93 MB/secConcurrency:        47.55Successful transactions:     500Failed transactions:        0Longest transaction:      3.64Shortest transaction:      0.07

Yii, which is favored before the competition

Transactions:         500 hitsAvailability:       100.00 %Elapsed time:        4.84 secsData transferred:      52.45 MBResponse time:        0.46 secsTransaction rate:     103.31 trans/secThroughput:        10.84 MB/secConcurrency:        47.65Successful transactions:     500Failed transactions:        0Longest transaction:      0.88Shortest transaction:      0.04

Concurrency: 200 cycles:

First, ThinkPHP

Transactions:        1977 hitsAvailability:        98.85 %Elapsed time:        10.03 secsData transferred:     207.40 MBResponse time:        0.95 secsTransaction rate:     197.11 trans/secThroughput:        20.68 MB/secConcurrency:       187.68Successful transactions:    1977Failed transactions:       23Longest transaction:      1.22Shortest transaction:      0.02

Then Laravel

Transactions:        1890 hitsAvailability:        94.50 %Elapsed time:        51.85 secsData transferred:     198.27 MBResponse time:        4.88 secsTransaction rate:      36.45 trans/secThroughput:        3.82 MB/secConcurrency:       178.00Successful transactions:    1890Failed transactions:       110Longest transaction:      26.01Shortest transaction:      0.07

Yii

Transactions:        1996 hitsAvailability:        99.80 %Elapsed time:        18.95 secsData transferred:     209.39 MBResponse time:        1.79 secsTransaction rate:     105.33 trans/secThroughput:        11.05 MB/secConcurrency:       188.57Successful transactions:    1996Failed transactions:        4Longest transaction:      3.29Shortest transaction:      0.10

I didn't expect ThinkPHP to be the fastest in terms of speed without Optimization. Yii was slightly more, and Laravel ran through the test. The results are somewhat surprising, but the above tests only represent the development environment. The framework will be optimized below to simulate the online environment.

Optimization Framework

ThinkPHP:

Change APP_DEBUG to false.

Laravel:

Change APP_DEBUG to falsephp artisan route: cachephp artisan optimizephp artisan config: cachecomposer dumpautoload-o

Yii:

Change YII_DEBUG to false.
Composer dumpautoload-o
Concurrency: 200 cycles:

ThinkPHP

Transactions:        1655 hitsAvailability:        82.75 %Elapsed time:        8.21 secsData transferred:     173.62 MBResponse time:        0.69 secsTransaction rate:     201.58 trans/secThroughput:        21.15 MB/secConcurrency:       139.29Successful transactions:    1655Failed transactions:       345Longest transaction:      7.83Shortest transaction:      0.00

Laravel:

Transactions:        1520 hitsAvailability:        76.00 %Elapsed time:        34.95 secsData transferred:     159.45 MBResponse time:        3.15 secsTransaction rate:      43.49 trans/secThroughput:        4.56 MB/secConcurrency:       136.84Successful transactions:    1520Failed transactions:       480Longest transaction:      19.18Shortest transaction:      0.00

Yii:

Transactions:        1704 hitsAvailability:        85.20 %Elapsed time:        15.16 secsData transferred:     178.76 MBResponse time:        1.46 secsTransaction rate:     112.40 trans/secThroughput:        11.79 MB/secConcurrency:       164.21Successful transactions:    1704Failed transactions:       296Longest transaction:      9.04Shortest transaction:      0.00

It is strange that many failures occur after the framework turns off the debugging mode. But it is obvious that Laravel's performance is greatly improved after simple optimization, but it is still lower than the other two frameworks.

Conclusion

In the course of the test, my other feelings were frustrated. I felt that my three views of the world had collapsed and collapsed to the scum.

ThinkPHP has twice the performance of Yii, nearly four times higher than Laravel.
The performance of Yii is moderate, but in the test, it is obvious that the request failure is less than that of the other two frameworks.
Laravel is still elegant, but its performance is worrying. it can be described by netizens as an easy learner to use.

Last

My project was developed using a self-built framework. thanks to the powerful composer, the development process was very smooth. Finally, I attached the self-built framework with 200 concurrent 10 cycles of data, the framework is open-source, but updates are busy. You are welcome to search for PPPHP on github and build a framework with me.

Transactions:        1672 hitsAvailability:        83.60 %Elapsed time:        6.18 secsData transferred:     175.40 MBResponse time:        0.57 secsTransaction rate:     270.55 trans/secThroughput:        28.38 MB/secConcurrency:       153.16Successful transactions:    1672Failed transactions:       328Longest transaction:      4.57Shortest transaction:      0.01

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.