[Benchmark php frameworks]. Part 4. Laravel
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 .
framework | requests per second | relative | peak memory | relative |
---|---|---|---|---|
laravel-index | 9.56 | inf | 6.17 | 1.0 |
laravel-authors | 7.23 | inf | 7.38 | 1.2 |
laravel-categories | 6.44 | inf | 7.56 | 1.2 |
laravel-posts | 0.00 | nan | 17.73 | 2.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
Here it is visible that generation of page laravel-posts was carried out more than 6 seconds.
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
framework | requests per second | relative | peak memory | relative |
---|---|---|---|---|
phalcon-index | 309.99 | inf | 0.44 | 1.0 |
phalcon-authors | 31.18 | inf | 0.56 | 1.3 |
phalcon-categories | 16.80 | inf | 0.57 | 1.3 |
laravel-index | 9.91 | inf | 6.17 | 14.1 |
laravel-categories | 8.32 | inf | 7.56 | 17.3 |
laravel-authors | 8.26 | inf | 7.38 | 16.9 |
phalcon-posts | 0.07 | inf | 3.00 | 6.9 |
laravel-posts | 0.00 | nan | 17.65 | 40.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.
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.
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.