Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lumen vs Laravel performance steps
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/
@tg44

This comment has been minimized.

Copy link

commented Sep 13, 2018

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

  • with 1000/10 (local-to-local) I get 428.92 [#/sec] (mean) 23.314 [ms] (mean) 2.331 [ms]
  • with 10000/100 (local-to-local) I get 1197.71 [#/sec] (mean) 83.493 [ms] (mean) 0.835 [ms]
  • with 1000/1 (local-to-local) I get 1458.72 [#/sec] (mean) 0.686 [ms] (mean) 0.686 [ms]
  • with 1000/10 (local-to-remote) I get 43.37 [#/sec] (mean) 230.578 [ms] (mean) 23.058 [ms]
  • with 1000/1 (local-to-remote) I get 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...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.