PHP Framework Performance test Report _php Skills

Source: Internet
Author: User
Tags php framework connection reset yii

As a PHP developer, and as a technology developer for a start-up team, choosing a development framework is a tough business.

With thinkphp, recruiting a developer who just came out of a training facility can get you started, but performance and late-code decoupling is a pain in the neck. However, many third-party functions do not need to write their own, many of Daniel has paved the way.

With laravel words, the legend written a very cool expansion is enough, but the learning cost is a bit high, can not give the primary developers half a month to learn the framework bar. And it is said that the Laravel performance is not very good, the document is not particularly rich.

With Yii, the syntax is a bit verbose, the front and back code separation a little trouble, but the performance is very good, and there have been many domestic large companies in use, there are accidents can quickly find Daniel FAQ.

Better to do a simple performance evaluation, choose a good performance is always not wrong

Performance test
Test time: May 06, 2016
Test tool: Siege (because the MAC system AB always appears pr_socket_recv:connection reset by peer (54) error, so chose siege)
Test machine: MacPro Core i5 processor/8GB Memory/256GB SSD Flash
Test environment: Apache PHP5.6
Frame version: thinkphp 3.2.3 Laravel 5.2 Yii2.0.5
Test principle: 5 times per test cycle, take medium data
Supplemental Note: All items are made in subdirectories

Result description

Transactions:        2119 hits total number of processing requests
availability:        96.85% availability
Elapsed time:        9.74 secs uptime
Data Transferred:      1.31 MB data transfer
Response time:        0.60 secs response times 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 request
longest transaction:      2.85 longest single request
shortest transaction:      0.01 The shortest single request

Start testing

Add a controller and enter 10,000 times in the controller HelloWorld

Concurrent 50 Cycles 10 times:

The first thing that came to us was thinkphp, and it looked good.

Transactions:         hits
availability:       100.00%
Elapsed time:        2.81 secs
Data Transferred:      52.45 MB
Response Time:        0.26 secs
Transaction rate: 177.94 trans/sec throughput
:        18.67
mb/sec Concurrency:        47.10
Successful transactions: Failed transactions
:        0
longest Transaction:      0.48
Shortest transaction:      0.03

Then Laravle, uh, slightly disappointed.

Transactions:         hits
availability:       100.00%
Elapsed time:        13.33 secs
Data Transferred:      52.45 MB
Response time:        1.27 secs Transaction rate
:      37.51
trans/sec Throughput:        3.93 mb/sec
Concurrency:        47.55 Successful transactions
:
Failed Transactions:        0
Longest transaction:      3.64
Shortest transaction:      0.07

The most promising yii before the final game

Transactions:         hits
availability:       100.00%
Elapsed time:        4.84 secs
Data Transferred:      52.45 MB
Response time:        0.46 secs
Transaction rate: 103.31 trans/sec throughput
:        10.84
mb/sec Concurrency:        47.65
Successful transactions: Failed transactions
:        0
longest Transaction:      0.88
Shortest transaction:      0.04

Concurrent 200 Cycles 10 times:

First, thinkphp.

Transactions:        1977 hits
availability:        98.85%
Elapsed time:        10.03 secs
Data Transferred:     207.40 MB
Response time:        0.95 secs Transaction rate
:     197.11
trans/sec Throughput:        20.68 mb/sec
Concurrency:       187.68 Successful transactions
:    1977
Failed Transactions:
Longest transaction:      1.22
Shortest transaction:      0.02

And then the Laravel.

Transactions:        1890 hits
availability:        94.50%
Elapsed time:        51.85 secs
Data Transferred:     198.27 MB
Response Time:        4.88 secs
Transaction Rate: 36.45 trans/sec throughput
:        3.82
mb/sec Concurrency:       178.00
Successful transactions:    1890 Failed Transactions
:
the longest Transaction:      26.01
Shortest transaction:      0.07

And finally, Yii.

Transactions:        1996 hits
availability:        99.80%
Elapsed time:        18.95 secs
Data Transferred:     209.39 MB
Response time:        1.79 secs Transaction rate
:     105.33
trans/sec Throughput:        11.05 mb/sec
Concurrency:       188.57 Successful transactions
:    1996
Failed Transactions:        4
Longest transaction:      3.29
Shortest transaction:      0.10

Did not expect in the absence of optimization, the speed of thinkphp is the fastest, yii slightly more, Laravel hobbled run the test. The results are somewhat unexpected, but the tests represent the development environment, and the frameworks are optimized to simulate the online environment.

Optimization framework

thinkphp:

App_debug Change to False


Laravel:

App_debug to False
php artisan route:cache
php artisan optimize
php artisan config:cache
Dumpautoload-o

YII:

Yii_debug Change to False
Composer Dumpautoload-o
Concurrent 200 Cycles 10 times:

thinkphp

Transactions:        1655 hits
availability:        82.75%
Elapsed time:        8.21 secs
Data Transferred:     173.62 MB
Response time:        0.69 secs
Transaction rate: 201.58 trans/sec throughput
:        21.15
mb/sec Concurrency:       139.29
Successful transactions:    1655 Failed transactions
:       345
Longest Transaction:      7.83
Shortest transaction:      0.00

Laravel:

Transactions:        1520 hits
availability:        76.00%
Elapsed time:        34.95 secs
Data Transferred:     159.45 MB
Response time:        3.15 secs Transaction rate
:      43.49
trans/sec Throughput:        4.56 mb/sec
Concurrency:       136.84 Successful transactions
:    1520
Failed Transactions:
Longest transaction:      19.18
Shortest transaction:      0.00

YII:

Transactions:        1704 hits
availability:        85.20%
Elapsed time:        15.16 secs
Data Transferred:     178.76 MB
Response Time:        1.46 secs
Transaction Rate: 112.40 trans/sec throughput
:        11.79
mb/sec Concurrency:       164.21
Successful transactions:    1704 Failed transactions
:       296
longest Transaction:      9.04
Shortest transaction:      0.00

Oddly enough, when the frame turns off debug mode, there are more failures. It is obvious, however, that the performance of Laravel is greatly improved after simple optimization, but it is lower than the other two frameworks.

Conclusion

In the process of testing, other my mood is depressed, feel their own three world has collapsed, collapse to slag.

The performance of thinkphp is one-fold higher than that of Yii, nearly four times times higher than Laravel.
The performance of Yii is moderate, but it is evident in the test that the request failed is less than the other two frameworks
Laravel is still elegant, but the performance is worrying, use the words of the netizen to describe the more studious people die

At last

My project finally used a self-built framework for development, thanks to the strong composer, the development process is very smooth, finally attached to its own framework in 200 concurrent 10 cycles of data, framework open source But update is busy, welcome to GitHub search ppphp, and I build a framework.

Transactions:        1672 hits
availability:        83.60%
Elapsed time:        6.18 secs
Data Transferred:     175.40 MB
Response time:        0.57 secs
Transaction rate: 270.55 trans/sec throughput
:        28.38
mb/sec Concurrency:       153.16
Successful transactions:    1672 Failed transactions
:       328
Longest Transaction:      4.57
Shortest 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.