Menu

1 / 2

Load testing a Laravel app without fooling yourself

DEV Community: php·Elvin Aghalarov·about 20 hours ago
#q0e2F3cT
#devto#dev#fullscreen#user#test
Reading 0:00
15s threshold

Laravel makes it easy to ship features fast, and just as easy to ship an N+1 query that only hurts at 200 concurrent users. Here's how to load test a Laravel app so the result actually means something.

1. Test production config, not your dev setup

The most common way to waste a load test is to measure the wrong thing.

❌ php artisan serve : single-threaded, one request at a time

❌ APP_DEBUG=true : collects debug data on every request

❌ Telescope or Debugbar recording

✅ PHP-FPM + Nginx, FrankenPHP, or Octane, same as production

✅ APP_ENV=production , APP_DEBUG=false

✅ caches built and OPcache on:

php artisan optimize # config, routes, events, views

Enter fullscreen mode

Exit fullscreen mode

; php.ini (production) opcache.enable = 1 opcache.validate_timestamps = 0 opcache.memory_consumption = 256

Enter fullscreen mode

Exit fullscreen mode

And seed realistic data volumes: an index you don't need with 100 rows is essential with 1,000,000.

2.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.