Zubair Akhtar logo — Muhammad Zubair Akhtar, Software Engineer

Blog

Laravel Performance Optimization: 12 Practical Techniques

Laravel performance optimization: eager loading and indexes, config and route cache, Redis, queues, Octane, and Telescope, Debugbar, or Pulse.

Muhammad Zubair Akhtar

Laravel performance optimization is the order I use when a Laravel request is slow. I look at the queries first, then the files the framework rebuilds on every boot, then the values worth remembering, then the work that should leave the response. I am Zubair Akhtar, a senior software engineer in Lahore, Pakistan. The browser half of website performance optimization, images and long tasks, is a different job. This page is the PHP application.

A Laravel developer who inherits the app usually finds the same shape. A loop reads a relationship that was never loaded. The deploy never cached the config or the routes. A CSV is parsed inside the controller. Octane comes up before anyone has counted the queries. I go the other way.

The browser checklist that already names an N+1 as one item among many is how to improve website speed. A WordPress front has its own pass in WordPress speed optimization. If you want the query, the cache, and the worker done on an app you already run, that work is Laravel development.

Laravel performance optimization grouped into the query, the framework file caches, Redis and a queue, and local or production profiling, with Octane after the query is cheap

Figure 1. Four groups. The query is first. Octane does not replace it.

On 20 November 2026 I read the Laravel 13.x pages for Eloquent relationships, Eloquent, migrations, queries, deployment, cache, Redis, queues, Octane, Telescope, and Pulse. The same day I read MySQL 8.4 section 10.3.1, How MySQL Uses Indexes, and section 15.1.20.5, FOREIGN KEY Constraints. I also read config/cache.php from laravel/framework v13.43.0, and the readme plus config/debugbar.php in the fruitcake/laravel-debugbar tag v4.4.5. I have not installed these packages for this article. I have not run these snippets.

Versions this was written against

The Packagist metadata for laravel/framework listed v13.43.0 with a version time of 17 November 2026, 14:58 UTC, requiring PHP ^8.3. That is the framework version these 13.x pages describe.

laravel/octane listed v2.25.0 with a version time of 17 November 2026, 14:41 UTC. It requires PHP ^8.2.0 and laravel/framework ^12.69.0|^13.30.0. The framework package on 13.43.0 asks for PHP 8.3, so an app on that framework follows the higher floor.

laravel/telescope listed v5.29.0 with a version time of 11 November 2026, 14:11 UTC, requiring PHP ^8.2 and laravel/framework ^12.0|^13.0. laravel/pulse listed v1.11.0 with a version time of 11 November 2026, 14:20 UTC, requiring PHP ^8.2. Its Illuminate constraints are ^12.0|^13.0, and it requires livewire/livewire ^3.6.4|^4.0.

barryvdh/laravel-debugbar listed v4.4.5 with a version time of 28 October 2026, 13:25 UTC, requiring PHP ^8.2 and Illuminate routing, session, and support at ^11|^12|^13.0. The source field on that metadata points at fruitcake/laravel-debugbar. The readme in tag v4.4.5 says the package name has changed to fruitcake/laravel-debugbar.

Laravel performance optimization: twelve techniques

I use this order unless a profile already names a later row as the wait. Caching a slow query stores the slow result. Octane runs the same queries inside a process that stays up.

#TechniqueWhat it changes
1Eager load with withThe extra query per row
2preventLazyLoading outside productionA lazy load that would otherwise ship
3An index on the filtered columnsHow MySQL finds the rows
4A narrower read: columns, chunk, lazyMemory and bytes from the table
5config:cacheConfig files read on every boot
6route:cacheRoute registration
7view:cacheBlade compiled on demand
8Redis for Cache::rememberA repeated computation
9A queue for work that can waitTime spent inside the response
10Octane, after the query is cheapThe boot cost of each request
11Telescope or Debugbar, locallyOne request, including each query
12Pulse in productionSlow queries, jobs, and routes over time

php artisan optimize is the deploy command that caches configuration, events, routes, and views. Rows 5, 6, and 7 are three of those four. Event caching is the fourth, and it belongs in the same command. I keep it out of the twelve because it does not have a separate failure mode I want a row for.

Fix the query before you cache it

The relationships page says that accessing Eloquent relationships as properties lazy loads them. The data is not loaded until you first access the property. Eager loading loads the relationship when you query the parent. The page says eager loading alleviates the "N + 1" query problem.

Eager load with with

The illustration on that page is a Book that belongs to an Author. The loop is:

$books = Book::all();

foreach ($books as $book) {
    echo $book->author->name;
}

The page says this loop runs one query for all of the books, then another query for each book to retrieve the author. It then gives the figure I am willing to repeat, because it is the documentation's example and not a measurement of an app I ran: if there are 25 books, the code runs 26 queries, one for the books and 25 for the authors.

with reduces that operation to two queries. The page says so, and it prints the SQL shape:

$books = Book::with('author')->get();
select * from books

select * from authors where id in (1, 2, 3, 4, 5, ...)

Several relationships are an array: Book::with(['author', 'publisher'])->get(). A nested relationship uses dot syntax: Book::with('author.contacts')->get(). A nested array is the other form on the page, when one parent has more than one child relationship to load.

You do not always need every column. The page allows Book::with('author:id,name,book_id')->get(). The warning under that example says you should always include the id column and any relevant foreign key columns in the list. I treat a column list that omits the key as a broken eager load, not a smaller one.

A $with property on the model always eager loads that relationship. The page shows protected $with = ['author']; on Book. That is convenient when every query needs the author. It is a cost on the queries that did not. I would rather call with at the query than hide it on the model, unless the relationship really is part of every read.

Eager loading the children does not, by itself, put the parent back on each child. The relationships page has a separate section for that. The example is $posts = Post::with('comments')->get() and then $comment->commentable->title inside the loop. The page says an "N + 1" problem remains because Eloquent does not automatically hydrate the parent Post on each child Comment. chaperone() on the relationship definition, or ->chaperone() inside the with callback, is the method the page gives for that hydration. I use it when the child template reaches back to the parent I already loaded.

Stop a lazy load from shipping

The same page says eager loading can provide significant performance benefits, and that you may instruct Laravel to prevent lazy loading. The call belongs in AppServiceProvider::boot. The example disables it outside production, so a leftover lazy load does not take the production request down:

use Illuminate\Database\Eloquent\Model;

public function boot(): void
{
    Model::preventLazyLoading(! $this->app->isProduction());
}

After that, Eloquent throws Illuminate\Database\LazyLoadingViolationException when the app lazy loads a relationship. Model::handleLazyLoadingViolationUsing can log the model class and the relation name instead of throwing. I would log in a staging environment where I want the request to finish and the violation to show up in the log. I would throw locally, where I am the person who can fix the with.

Automatic eager loading is the other switch in that section. Model::automaticallyEagerLoadRelationships() in the same boot method makes Laravel lazy eager load a relationship for the whole collection when you touch it on one model. The page's example is users, then each user's posts, then each post's comments. Without the switch, that is a query per user and a query per post. With the switch, accessing posts on any user loads posts for the users in that collection, and accessing comments does the same for the posts already retrieved. withRelationshipAutoloading() does this for one collection instead of the whole app.

I do not treat the automatic switch as a substitute for a with I already know I need. It still waits until the first access, and it still runs a query. It is how a missed with becomes one query for the collection instead of one query per row. preventLazyLoading is how I find the miss. I have not turned either switch on for this article.

Index the column the query filters

An eager load can still be a slow query if the where or the order by cannot find the rows. MySQL 8.4's index page says indexes are used to find rows with specific column values quickly. Without an index, MySQL begins with the first row and reads through the entire table. The larger the table, the more this costs. If the table has an index for the columns in question, MySQL can determine the position to seek to without looking at all the data. Most MySQL indexes, including PRIMARY KEY, UNIQUE, INDEX, and FULLTEXT, are stored in B-trees. The page lists what indexes are used for: a WHERE clause, eliminating rows, joins, MIN() or MAX() on an indexed column, and sorting or grouping on a leftmost prefix of a usable index.

A multiple-column index has a rule I do not want to skip. The same page says any leftmost prefix can be used. An index on (col1, col2, col3) can serve (col1), (col1, col2), and (col1, col2, col3). It does not say the index serves a predicate on col2 alone. I put the column that the query always filters first.

Laravel's schema builder is how I create that index in a migration. The migrations page shows $table->index('state') for an index, $table->unique('email') for a unique index, and $table->index(['account_id', 'created_at']) for a composite. Laravel generates the index name from the table, the columns, and the type, unless you pass a second argument.

A foreign key is an index question as well as an integrity question. The migrations page shows $table->foreignId('user_id')->constrained(), and it says the indexName argument is the name assigned to the generated index. MySQL's foreign key page says MySQL requires indexes on foreign keys and referenced keys so that foreign key checks can be fast and not require a table scan. In the referencing table there must be an index where the foreign key columns are listed as the first columns in the same order. Such an index is created on the referencing table automatically if it does not exist. I still want the migration to be the place that states the index, so a later drop does not surprise the constraint. The foreign key page also says dropping an index required by a foreign key constraint is refused until the constraint is removed.

Creating an index on a large table can lock it. The migrations page says that by default, and it offers ->online() for PostgreSQL and SQL Server. For MySQL it offers ->inplace(), and ->inplace()->lock('none'). The same paragraph says to refer to MySQL's documentation to determine which operations support the INPLACE algorithm and lock modes. I am not going to turn that sentence into a list of safe ALTER forms. On a large table I read the MySQL page for that operation before I run the migration.

I am not publishing a timing for an index. The 13.x query page I read shows dd, dump, dumpRawSql, and ddRawSql for inspecting SQL. It does not document an explain() method on the builder. The way I see the plan in this article is Debugbar's explain option, below, or the database client. I have not run EXPLAIN for this page.

Read fewer rows and fewer columns

Book::all() and get() load the models they match. The Eloquent page says the application may run out of memory if you load tens of thousands of records that way. chunk processes a subset at a time. The example is Flight::chunk(200, ...). The first argument is the number of records per chunk. A query runs for each chunk. That 200 is the example on the page. It is not a size I measured.

If you filter on a column and also update that column inside the chunk, the page says to use chunkById. chunk in that situation can skip or repeat rows. chunkById adds its own where on the id, so your own conditions should be grouped inside a closure when they use or.

lazy is the same chunking, returned as a LazyCollection instead of a callback. cursor is different. The page says cursor executes a single query and hydrates one model at a time, so only one Eloquent model is kept in memory while you iterate. It also says cursor cannot eager load relationships. If you need with, use lazy. And cursor can still run out of memory, because PHP's PDO driver caches the raw results in its buffer. For a very large set, the page says to consider lazy.

I use chunk or lazy for a backfill or an export. I do not use them to render a page of twenty rows. A page of twenty is with, a limit, and the columns the screen shows.

Cache the files Laravel rebuilds

The deployment page says that when you deploy, a variety of files should be cached, including configuration, events, routes, and views. php artisan optimize caches all of them. The page says this command should typically run as part of deployment. php artisan optimize:clear removes the cache files optimize generated, and it also removes all keys in the default cache driver. I do not run optimize:clear on a production box as a casual reset. It clears the application cache as well as the bootstrap files.

The granular commands are the ones below. event:cache is the one without its own row. The page says you should cache auto-discovered event-to-listener mappings during deployment, with php artisan event:cache.

Cache configuration

php artisan config:cache combines Laravel's configuration files into a single cached file. The page says this greatly reduces the number of trips the framework must make to the filesystem when loading configuration values. It does not give a count of those trips. I will not invent one.

The same section is the rule I check before I turn the command on. If you run config:cache during deployment, you should only call the env function from within your configuration files. Once configuration is cached, the .env file will not be loaded, and all calls to env for .env variables will return null. A env('STRIPE_SECRET') left in a controller becomes null in production and works on a machine where the config is not cached. I grep for env( outside config/ before I cache config.

Cache routes

The deployment page says that if you are building a large application with many routes, you should run php artisan route:cache. The command reduces route registrations into a single method call inside a cached file, improving the performance of route registration when registering hundreds of routes. "Hundreds of routes" is the page's scale. It is not a cutoff I measured.

The deployment page I read on 20 November 2026 does not mention route closures. I am not going to add a restriction the current page does not state. If a future page adds one, that page wins.

Cache views

php artisan view:cache precompiles all Blade views so they are not compiled on demand. The page says this improves the performance of each request that returns a view. A request that returns JSON and never touches Blade does not pay for a view compile either way. I still run it on deploy, because the first HTML request after a release is the one that would otherwise compile the set.

I have not run optimize, config:cache, route:cache, or view:cache for this article. On an app I ship, they belong in the deploy script after the new release is the current code, which is the setup in deploy Laravel to a VPS.

Remember the data, and queue the rest

A Laravel request can spend its time in PHP-FPM or an Octane worker, in a query that should eager load and use an index, in Redis, or in a queued job, with Pulse or a local profiler watching

Figure 2. The response does not have to do all four. A value that is already in Redis skips the query. A CSV does not belong in the request. The query still has to be cheap when the cache misses.

Put repeated values in Redis

The cache introduction says some retrieval or processing tasks are CPU intensive or take several seconds. It is common to cache that data so the next request for the same data can retrieve it quickly. The page names Memcached or Redis as the usual fast store. Laravel's cache API covers Memcached, Redis, DynamoDB, relational databases, and filesystem disks. A file driver exists as well, and array and null are for tests.

The same page says that by default Laravel is configured to use the database cache driver, which stores serialized objects in the database. The config/cache.php I read from framework v13.43.0 sets 'default' => env('CACHE_STORE', 'database'). The database driver needs the cache table. The page says that table is typically the default 0001_01_01_000001_create_cache_table.php migration, and that php artisan make:cache-table creates it when the migration is missing.

Redis is a prerequisite install, not a flag. The cache page says that before you use a Redis cache you need the PhpRedis extension via PECL, or the predis/predis package. Laravel Sail already includes the extension. Laravel Cloud and Laravel Forge have PhpRedis installed by default. The Redis page shows the client defaulting to env('REDIS_CLIENT', 'phpredis').

The cache store named redis in the v13.43.0 config file uses env('REDIS_CACHE_CONNECTION', 'cache'). The Redis page's cache connection uses env('REDIS_CACHE_DB', '1'), and the default connection uses env('REDIS_DB', '0'). The port default on that page is 6379. The split is the point. The cache connection is not the same Redis database number as the default connection, unless you change the env. I want the queue and the cache to be obvious when I inspect Redis. The queues page adds a related warning: if multiple instances of the application share a Redis server, each instance should use its own key prefix or Redis database, or one queue worker may process jobs dispatched by another instance.

Cache::remember returns the cached value or runs the closure and stores the result. The page's example is Cache::remember('users', $seconds, function () { ... }). The TTL is the caller's $seconds. I am not going to pick a production TTL in this article. Cache::store('redis')->put('bar', 'baz', 600) is the page's example of talking to the Redis store directly, and the comment on that line says 600 is 10 minutes. That is the example's duration, not a duration I measured.

Cache::flexible is the stale-while-revalidate form. The page's example is Cache::flexible('users', [5, 10], function () { ... }). The first number is how long the value is fresh, in seconds. The second is when it becomes too stale to serve. Between them, the stale value is served and a deferred function refreshes it after the response. After the second number, the value is recalculated in the request. Five and ten are the example. They are a short window for a documentation snippet. I would not copy them onto a catalog without deciding what "stale" means for that catalog.

Cache tags are how you flush a group of keys. The cache page says tags are not supported when using the file, dynamodb, database, or storage drivers. The default database store is on that list. A tag flush is a reason to leave that default. I am not going to extend the sentence into a list of drivers the page does not name.

I have not pointed an application at Redis for this article. The worker that already uses Redis for queues is Laravel Horizon in production. Horizon's own Redis Cluster limit stays on that page. I am not pasting it onto the cache store.

Queue the work that is not the response

The queues introduction uses a concrete task: parsing and storing an uploaded CSV file that takes too long during a typical web request. Laravel can process that as a queued job in the background. The page says that by moving time intensive tasks to a queue, the application can respond to web requests with blazing speed. "Blazing speed" is the documentation's phrase. I am not attaching a number of milliseconds to it.

The drivers in config/queue.php include the database, Amazon SQS, Redis, and Beanstalkd, plus a synchronous driver that executes jobs immediately for development or testing, and a null driver that discards jobs. ProcessPodcast::dispatch() uses the default connection's default queue. ->onQueue('emails') picks another queue on that connection. php artisan queue:work --queue=high,default is the page's example of processing a high queue before the default one.

php artisan queue:work runs until you stop it. The page says to use a process monitor such as Supervisor to keep it running. Workers are long-lived and store the booted application in memory. They will not notice code changes after they start, so a deploy has to restart them. Static state is not reset between jobs. queue:listen reloads code without a manual restart, and the page says this command is significantly less efficient than queue:work. That comparison is the page's. I use queue:work.

You do not need a worker for the sync, background, or deferred drivers. Those process jobs in the current PHP process. The deferred connection runs the job after the HTTP response has been sent, still in that process. I use a real queue when the work must survive the request, retry, and be visible. I use deferred when the work is small and it only needs to happen after the response, on the same machine, without a worker. Mail, a webhook handler, and a CSV are the jobs I put on a worker. The worker's timeout and retry_after are the subject of Laravel Horizon in production. An API that does this work behind a JSON response is still the Laravel REST API problem. The queue does not change the status code.

Reach for Octane when the boot cost is what is left

Laravel Octane serves the application with FrankenPHP, Open Swoole, Swoole, or RoadRunner. The page says Octane boots the application once, keeps it in memory, and then feeds it requests at supersonic speeds. I am quoting that sentence. I am not adding a ratio, because the page does not give me one, and I have not measured a worker.

Install is composer require laravel/octane and php artisan octane:install. The package version I read is v2.25.0. Its PHP floor is 8.2. An app on framework 13.43.0 is on the 8.3 floor from the framework package, which is the floor I would follow.

By default, Octane starts one application request worker for each CPU core. --workers=4 is the example on the page for setting the count yourself. On Swoole, --task-workers=6 is the example beside it. To help prevent stray memory leaks, Octane gracefully restarts a worker once it has handled 500 requests. --max-requests=250 is the example for changing that number. max_execution_time in config/octane.php defaults to 30 seconds. Setting it to 0 disables the limit. The page says you must restart Octane after changing it. Those figures are the documentation's defaults and examples. They are not a capacity plan for a server I have not seen.

php artisan octane:reload gracefully restarts the workers so the new code is what serves the next request. The deployment page has a broader command. After a deploy, long-running services such as queue workers, Laravel Reverb, and Laravel Octane should be reloaded. php artisan reload terminates those services. On Laravel Cloud, the page says the reload is handled for you. Otherwise a process monitor has to notice the exit and start the process again. PHP-FPM loading new code does not reload a queue worker or an Octane worker that is still in memory. The VPS shape of that process monitor is deploy Laravel to a VPS. Reverb is one of the processes the deployment page names, and the socket itself is Laravel Reverb. The proxy in front of PHP-FPM or Octane is the nginx setup guide. A container that runs octane:start is a different service from PHP-FPM, which is the split in the Laravel Docker setup.

FrankenPHP is the server the Octane page describes as written in Go, with early hints, Brotli, and Zstandard. When you choose it, Octane downloads the binary. The static binary includes its own copy of PHP, so updating the system PHP does not update the PHP inside that binary. The page says to check it with ./frankenphp version, and to delete the binary and run php artisan octane:install --server=frankenphp when you want a newer build. I have not installed FrankenPHP, RoadRunner, Swoole, or Octane for this article.

Octane's caveats come from the boot-once model. The register and boot methods of your service providers run once, when the worker boots. On the next request the same application instance is reused. Octane resets first-party framework state between requests. It does not always know how to reset global state your application created. The page says to avoid injecting the service container or the HTTP request into the constructor of an object bound as a singleton, because that object can hold a stale container or a stale request. The documented memory leak is a static array that appends on every request. The page recommends monitoring memory during local development so you see the leak before production. I have not watched a worker's memory for this article.

Swoole can run concurrent tasks with Octane::concurrently. Those tasks use Swoole task workers, in a different process from the request. The page says you should not provide more than 1024 tasks, because of a limit in Swoole's task system. That 1024 is the documented ceiling. It is not a throughput result.

Octane does not remove an N + 1. The worker still executes the queries the code asks for. with, the index, and the decision to queue the CSV all still apply. I reach for Octane when those are already in place and the remaining cost is booting the framework on every request. I leave it when the team cannot own a long-running process, a reload on deploy, and the singleton rules.

See one request, then watch production

Row 11 is local. Row 12 is the production record. I do not put either package on a public URL and call that monitoring.

Telescope, on the local machine

The Telescope page calls it a companion to the local Laravel development environment. It provides insight into requests, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps, and more.

composer require laravel/telescope, then php artisan telescope:install and php artisan migrate. The dashboard is /telescope. If you only want it locally, the page says to install with --dev, remove the TelescopeServiceProvider registration from bootstrap/providers.php, and register Telescope's providers from AppServiceProvider::register only when the environment is local and the class exists. You also add laravel/telescope to dont-discover in composer.json.

By default the dashboard is available in the local environment. A gate in app/Providers/TelescopeServiceProvider.php controls access in other environments. The page says you should set APP_ENV to production in production. Otherwise the Telescope installation will be publicly available. I read that as a reason to keep the local-only install, not as a reason to rely on a mis-set env var.

The query watcher records the raw SQL, the bindings, and the execution time for queries the application runs. It tags queries slower than 100 milliseconds as slow. The page's example sets the watcher's slow option to 50. Both numbers are the page's. A query under 100 milliseconds can still be an N + 1. Twenty fast queries are still twenty queries. I use the tag as a highlight, not as the definition of a problem.

Telescope v5.29.0 is the version I read. I have not installed it.

Debugbar, while the HTML is open

The v4.4.5 readme describes Debugbar as the PHP Debug Bar integrated with Laravel. The QueryCollector shows all queries, including bindings and timing. A caution at the top says to use the DebugBar only in development, and not on a publicly accessible website, because it will leak information from stored requests, by design. A warning says it can also slow the application down, because it has to gather and render data. If the app feels slow while you are profiling, the readme says to try disabling some collectors.

The install line in that readme is composer require fruitcake/laravel-debugbar --dev. The readme says the package name has changed, and that an app on barryvdh/laravel-debugbar can replace it with the new name. Debugbar is enabled when APP_DEBUG is true and the environment is not production or testing. DEBUGBAR_ENABLED, or debugbar.enabled in config, overrides that. The readme says it is highly recommended not to install Debugbar in production at all.

The published config/debugbar.php in that tag sets the database collector's backtrace default to true, explain to true, soft_limit to 100, and hard_limit to 500. slow_threshold defaults to false. The comment on soft_limit says that after the soft limit, parameters and the backtrace are not captured. The comment on hard_limit says that after the hard limit, queries are ignored. I read the collector provider in the same tag. It adds a query when the only-slow option is off, when the threshold is empty, or when the query time is greater than the threshold. With the published false threshold, the empty-threshold path collects the query. EXPLAIN is enabled when the explain option is true and Debugbar storage is open for the request. I am describing that code. I have not executed it.

The same tag ships a skill file, resources/boost/skills/debug-using-debugbar/SKILL.md, for the Artisan commands. php artisan debugbar:queries {id} is the command it gives for query issues. It separates two reports. Duplicate queries are identical SQL and identical bindings, which the skill describes as a query that should have been cached or hoisted out of a loop. Repeated query shapes with varying bindings are the same SQL with a different value each time, which the skill calls the classic N+1, fixed with with(). The --issues path on debugbar:find defaults to flagging a request at 50 queries. I read that default in the command signature in this tag. It is a flag threshold for the finder, not a budget for a page. --explain re-executes a SELECT against the current database, and the skill says the result may differ from the original request. I have not run these commands.

The readme also says Laravel Debugbar 4.x works with Octane without extra config. I have not combined them.

Pulse, on the production app

Pulse is the production view. The page says it delivers at-a-glance insights into performance and usage, so you can track down bottlenecks like slow jobs and endpoints, and find the most active users. The next sentence points in-depth debugging of individual events at Telescope. That split is why Telescope is row 11 and Pulse is row 12.

Pulse's first-party storage currently requires MySQL, MariaDB, or PostgreSQL. Another database engine means a separate MySQL, MariaDB, or PostgreSQL database for Pulse data. Install is composer require laravel/pulse, then php artisan vendor:publish --provider="Laravel\Pulse\PulseServiceProvider", then php artisan migrate. The dashboard is /pulse.

The slow-request card shows requests that exceed the configured threshold, which the page says is 1,000ms by default. The slow-job card uses 1,000ms by default. The slow-query card uses 1,000ms by default. The slow outgoing HTTP client card uses 1,000ms by default. The slow-queries recorder example sets 'default' => env('PULSE_SLOW_QUERIES_THRESHOLD', 1000) and shows a per-query threshold of 5000 for an insert into `yearly_reports`. Those are the page's numbers. A query that is fast and repeated still will not cross 1,000ms. Pulse does not replace the local query list for an N + 1 of cheap statements. It shows the statements that are actually slow, and the routes and jobs around them.

The servers card needs php artisan pulse:check running on each server you want to monitor. Most other recorders capture from framework events and do not need that daemon. The Redis ingest driver, set with PULSE_INGEST_DRIVER, writes to a Redis stream instead of the database during the request. The page says that driver should always use a different Redis connection than a Redis-powered queue. php artisan pulse:work moves the stream into Pulse's tables. If capturing Pulse data throws, for example because the storage database is down, Pulse fails silently so it does not affect the application.

Reverb's connection and message cards are a Pulse setup of their own. I left them on the Laravel Reverb page. Pulse v1.11.0 is the version I read. I have not installed Pulse.

Reload the long-running processes

The twelve techniques are incomplete if the deploy leaves an old worker in memory. After the release is current, I run php artisan optimize, then php artisan reload. The deployment page says reload terminates queue workers, Laravel Reverb, and Laravel Octane. A process monitor starts them again, except on Laravel Cloud, where the page says that reload is automatic.

/up is the health route. The deployment page says it returns 200 if the application booted without exceptions, and 500 otherwise. A 200 from /up does not tell you that queue:work or octane:start loaded the new release. Those are separate processes. The VPS process list is deploy Laravel to a VPS. The queue supervisor is Laravel Horizon in production. The socket process is Laravel Reverb.

FAQ

What is Laravel performance optimization?

It is the set of changes that make a Laravel request do less work. On this page that set is twelve techniques: eager loading, a block on lazy loading outside production, indexes, smaller reads, config and route and view cache, Redis, queues, Octane, and then Telescope or Debugbar locally and Pulse in production. The versions above are what I read on 20 November 2026. I have not run the snippets.

Does Octane fix an N + 1?

No. Octane keeps the booted application in memory and serves the next request on that worker. The worker still runs every query the code issues. The relationships page's 25-book illustration is still 26 queries inside an Octane worker if the loop lazy loads the author. with is what changes that illustration to two queries. Octane is the technique I consider after that, when the remaining cost is the boot.

Should Telescope or Debugbar run in production?

The Telescope page tells you to set APP_ENV to production so the dashboard is not public, and it documents a local-only install with --dev. The Debugbar readme says to use it only in development, not on a publicly accessible website, because stored requests leak information by design. Pulse is the package whose page is written as the production at-a-glance view. I follow that split.

Do I have to use Redis?

No. The cache page says the default store is the database driver. Queues can use the database driver, SQS, or Beanstalkd. Redis is the store I use when the repeated value should not be another query against the application database, and it is the store Horizon requires. That Horizon requirement is on the Horizon page, not a requirement of every cache call. Cache::store('redis') is how one call opts into Redis when the default store is something else.

What does config:cache do to env()?

Once configuration is cached, the .env file is not loaded, and env() calls for .env variables return null. The deployment page says to call env only from configuration files. Values the application needs at runtime should be read with config(), from a file under config/ that called env while the cache was being built.

If you want this on an app you already ship

I would open one slow URL, read the query list, add the with the list is missing, and add the index the filter needs. Then I would put optimize on the deploy, move the CSV to a queue, and only then talk about Redis or Octane. Telescope or Debugbar is how I see the one request. Pulse is how I see the slow ones after the release.

The commands on this page come from the 13.x documentation and the package files I linked above. I have not run them here. The person you ask to own that list is the subject of the hire a Laravel developer checklist. If you want it done on an application, start with Laravel development.

Discuss this with Muhammad

Message Muhammad Zubair Akhtar on WhatsApp or email [email protected].