Last active
May 7, 2021 16:40
-
-
Save laurencei/d46893f833d5ddd439eccff025a0b63a to your computer and use it in GitHub Desktop.
Lumen vs Laravel performance steps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps to recreate tests: | |
// Create and configure server: | |
1. Create 2GB DigitalOcean server using Forge | |
2. Enable OpCache on server | |
3. Create http://domain1.com (use whatever domain name you have available) | |
4. Create http://domain2.com (use whatever domain name you have available) | |
5. Enable SSL on both domains using LetsEncrypt | |
6. Install: sudo apt-get install apache2-utils | |
// Install packages | |
7. gitclone to Domain 1: https://github.com/laurencei/benchmark-laravel | |
8. gitclone to Domain 2: https://github.com/laurencei/benchmark-lumen | |
9. Composer install on both domains | |
10. Set .env on both packages to use "Redis" for sessions and cache | |
11. Both domains: php artisan migrate --seed | |
12. On Domain1 only run "php artisan config:cache" and "php artisan route:cache" | |
13. Restart opcache: "echo "" | sudo -S service php7.2-fpm reload" | |
// Run EACH test below FIVE times and average the results | |
// Laravel (web) | |
ab -n 1000 -c 10 https://domain1.com/ | |
ab -n 1000 -c 10 https://domain1.com/user/1/ | |
ab -n 1000 -c 10 https://domain1.com/user/post/ | |
// Laravel (api) | |
ab -n 1000 -c 10 https://domain1.com/api/ | |
ab -n 1000 -c 10 https://domain1.com/api/user/1/ | |
ab -n 1000 -c 10 https://domain1.com/api/user/post/ | |
// Lumen | |
ab -n 1000 -c 10 https://domain2.com/ | |
ab -n 1000 -c 10 https://domain2.com/user/1/ | |
ab -n 1000 -c 10 https://domain2.com/user/post/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would be better with another -n and -c values. If we have bigger data to work with our numbers will correlate better to the truth.
I just run this against my akka-http helthcheck endpoint, and
428.92 [#/sec] (mean) 23.314 [ms] (mean) 2.331 [ms]
1197.71 [#/sec] (mean) 83.493 [ms] (mean) 0.835 [ms]
1458.72 [#/sec] (mean) 0.686 [ms] (mean) 0.686 [ms]
43.37 [#/sec] (mean) 230.578 [ms] (mean) 23.058 [ms]
6.97 [#/sec] (mean) 143.477 [ms] (mean) 143.477 [ms]
(my remote is a lowcost dev env and my local internet provider give us an unreliable service, I measured more then 4k req/sec in a single machine with the same backend when my loaders was on multiple machines but in the same network as the server)
Which means that the numbers you get with the measures are really "depends on" the testing method. (just see the req/sec differences in the 3 local-to-local measure...)