Laravel vs Next.js Performance Comparison: You are all wrong!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in my previous video nextjs performed much better than laravel and this got me investigating until I found that nextjs does not reflect database changes this invalidate my previous comparison because larav fetches the database with every request however today after I modified the nj's component to be dynamic the results really surprised me here I have gmet test plan open with 100 concurent users that will sum up in a r up period of 12 seconds and the whole test will last for 15 seconds and I prepared two requests here the laravel and I can show you my ec2 instance here that we can check the IP address and I have two SSH session open for each server let me close and show you the configuration let's clear here and clear so let's put the cut I prepared already the nextjs and you see here this is my nextjs configuration and on the other side is the Lil each server configuration is taken from the production documentation of each framework for njs I'm using forever and as we see here we have reverse proxy to the Local Host Port 3000 whereby larav we are using the PHP fpm so let's clear now and let's open back the agent for the CPU collector for our gmet for both larav and the next server all right and let me open now and start the server the command I already prepared and this command will test the test plan that I showed you earlier and will put the results in the gmet results so that we have a dashboard and we are ready so let's go and we see here that each server has already received connection from our machine requesting CPU and memory met end of run and our test is ready so I'm going to open Google Chrome to open the index HTML let's go now to the summary report and my eyes go directly to the error rate and both Frameworks have an error rate of 0% and the max here the max represent the longest response time now for laravel is 571 milliseconds half a second and for next J is 1,978 which is almost 2 second so is performing much better here I will show you now the other chart maybe we'll explain better and here is our chart now the next JS is the yellow and laravel is the blue and we can see now that larav is really performing much better than nextjs and nextjs performance is really worse and the more we add concurent users now let's navigate to the CPU users from our gmet so I open GM navigate to CPU metric as we see here larav is the blue next J is the red and Lar is performing also here much better is playing between like 80 and 95 or 96% CPU users whereby nextjs is playing between 95 and 100 the memory collector here we have larav using 63% of the memory whereby nextjs is using 78 between 78 and 82 % of the memory very interesting Now ladies and Gentlemen please keep in mind that we have two separate servers with similar specifications and two application with same functionality nextjs Dynamic component really worsen the performance however laravel performed much better and this has surprised me because there are so many sites in the internet that speaks about njs being so much faster than PHP please remember that every framework have its strength and while we have focused on performance there are so many other factors to consider I hope you enjoy watching and see you next time
Info
Channel: codeForMe
Views: 17,749
Rating: undefined out of 5
Keywords: Laravel, Next.js, Performance Comparison, Database, Real-world, Speed Test, Web Development, Dynamic Content, Efficiency, Frameworks, PHP, JavaScript, Server-Side Rendering, Database Interaction, jmeter, nodejs, expressjs
Id: 2-SVojp_BVc
Channel Id: undefined
Length: 4min 7sec (247 seconds)
Published: Sat Sep 09 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.