[Benchmark php frameworks]. Part 4. Laravel

in #programming7 years ago (edited)

Table of content.

Well, I got to benchmark the second framework according to my plan. ( More info about plan in the first part )

Some information about framework.

Site: https://laravel.com/

It's a very big community. The Community is growing as well as the framework is developing fast. It has a lot of different services. And There are many packages for different cases.

There is a good review here by @willian95.

Let's see benchmark.

Just to remind about the structure ( Full description here )

  • /laravel-authors - lists of authors with posts counts.
  • /laravel-categories - list of categories with counts of posts in every one.
  • /laravel-posts - all posts with information about types, authors and categories.
  • /laravel-index - simple "hello world" for comparison

For my benchmark I took this code and made some modifications. All code committed to Github .

frameworkrequests per secondrelativepeak memoryrelative
laravel-index9.56inf6.171.0
laravel-authors7.23inf7.381.2
laravel-categories6.44inf7.561.2
laravel-posts0.00nan17.732.9

We see that the generation time of the initial almost empty page (laravel-index) is not very different from the time of generation of other pages. For a second, ~ 6-10 pages were generated. But the generation of the largest and most complex page - laravel-posts - all 1000 posts with information about types, authors and categories - did not meet the second.

Some Graphics

https://s3-us-west-2.amazonaws.com/notion-static/8b137780d70c42f5b9ff3708da197557/2017-07-05_16-47-19.png

https://s3-us-west-2.amazonaws.com/notion-static/4579a1bd13c54f21bbb6d3e2fac1b76c/2017-07-05_16-47-40.png

https://s3-us-west-2.amazonaws.com/notion-static/07b442a1dc754e0199d654f055892515/2017-07-05_16-47-54.png

Here it is visible that generation of page laravel-posts was carried out more than 6 seconds.

https://s3-us-west-2.amazonaws.com/notion-static/5105f1634c86461891faade9b2f6231a/2017-07-05_16-48-19.png

Later I will connect the service https://blackfire.io/ to profile the requests inside and find out where the delays occur.

Let's compare #phalcon and #laravel

frameworkrequests per secondrelativepeak memoryrelative
phalcon-index309.99inf0.441.0
phalcon-authors31.18inf0.561.3
phalcon-categories16.80inf0.571.3
laravel-index9.91inf6.1714.1
laravel-categories8.32inf7.5617.3
laravel-authors8.26inf7.3816.9
phalcon-posts0.07inf3.006.9
laravel-posts0.00nan17.6540.4

Phalcon works faster, although the page generation time has also increased, but as I suggested in a previous article, in the case of phalcon, this is similar to the complexity with mysql. Later we will find out.

Most of all I'm interested in the time of generation of a page with posts.

https://s3-us-west-2.amazonaws.com/notion-static/39380a9ffb134d69a51a5b5ad6510651/2017-07-05_17-18-41.png

Phalcon-posts ~ 2.3s
Laravel-posts ~5.8s

On the one hand, the difference is only 2 times. Is this a lot or a little? It depends on the project. For a highly loaded project with millions of visitors a day, that's a lot. But in such projects, data caching is always used. In the future, I will also run tests with connected caching. And also describe the process of its inclusion.

In addition, for big queries, you need to optimize the database settings. And its updating to a newer version take effect.
But this is more difficult for me. The server part is not my strong point yet. But I'm working on it.

If there is any inaccuracy in my research - welcome to the comments.

It's also very interesting to look at the results of two more equally well-known frameworks: Yii and Symfony.

In the foreseeable future:

  • Implementing a test application and running tests on Symfony
  • Implementation of the test application and testing on Yii
  • Try to use Cache for all frameworks
  • Connection with https://blackfire.io/
  • Deal with the Docker and wrap it all up in it. To be able to quickly deploy to a more powerful server for comparison.

All code is committed to github: https://github.com/semasping/php_frameworks_for_tests

Thank you for your attention and your support.

Sort:  

Upvoted and Resteemed by the xx_Votes_Plus curation trail! Want more earnings? Follow @dropahead in Streemian https://streemian.com/profile/curationtrail/trailing/396 and/or delegate some STEEM POWER to @dropahead! Keep up the good work!

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by semasping from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, and someguy123. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you like what we're doing please upvote this comment so we can continue to build the community account that's supporting all members.

This post has received a 1.22 % upvote from @booster thanks to: @teamgreen.

Coin Marketplace

STEEM 0.23
TRX 0.21
JST 0.035
BTC 97405.88
ETH 3349.98
USDT 1.00
SBD 3.18