Laravel Horizon setup guide: monitored Redis queues in Laravel 13
Install Laravel Horizon 5 on Laravel 13, configure supervisors and balancing, set retries and timeouts safely, secure the dashboard and run it under Supervisor.
Updated 8 min read

In this article
Laravel Horizon is the official dashboard and process manager for Redis queues. You install it with Composer, describe your workers in config/horizon.php, run a single php artisan horizon command, and get live throughput, wait times and failed jobs in a browser. This guide sets it up on Laravel 13 with Horizon 5, step by step, including the settings that most often cause duplicate or killed jobs in production.
A Laravel Horizon setup on Laravel 13 with Horizon 5 comes down to three things: supervisors configured per environment, retries and timeouts that avoid duplicate or killed jobs, and dashboard access restricted through the viewHorizon gate.
Everything below was checked against the Laravel 13.x Horizon and queue documentation and the Horizon 5.x source on 10 October 2026. At that date the latest releases were Laravel 13.35.0 and Horizon 5.50.0.
What Horizon adds to Laravel queues
Plain Laravel queues already work: you dispatch a job, and php artisan queue:work processes it. The trouble starts when you have several queues, several servers and no visibility. Horizon solves three problems:
- Configuration in code. Worker counts, queues, retries and timeouts live in one version-controlled file, per environment.
- Automatic balancing. Horizon can move worker processes to whichever queue is busiest.
- Visibility. A dashboard at
/horizonshows pending, completed and failed jobs, runtimes, throughput and tags, and Horizon can alert you when a queue waits too long.
There are limits to know before you start. Horizon works only with the Redis queue driver, it does not support Redis Cluster, and the package requires the pcntl and posix PHP extensions, so it runs on Linux and macOS but not natively on Windows (use WSL2, Docker or Sail there).
Step 1: install Horizon
Make sure your queue connection is Redis. In .env:
QUEUE_CONNECTION=redis
REDIS_HOST=127.0.0.1
REDIS_PORT=6379Then install the package and publish its files:
composer require laravel/horizon
php artisan horizon:installhorizon:install creates config/horizon.php and app/Providers/HorizonServiceProvider.php. One detail from the documentation is easy to miss: Horizon uses a Redis connection named horizon internally, so do not define your own Redis connection with that name.
Step 2: configure supervisors per environment
The environments key maps each APP_ENV value to one or more supervisors. A supervisor is a group of worker processes with its own queues and balancing rules. Values in the defaults key are merged into every supervisor, so you only override what differs.
Here is a practical production setup with a fast lane for user-facing work and a capped lane for heavy jobs:
// config/horizon.php
'defaults' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default'],
'balance' => 'auto',
'autoScalingStrategy' => 'time',
'maxProcesses' => 1,
'memory' => 128,
'tries' => 3,
'timeout' => 60,
],
],
'environments' => [
'production' => [
'supervisor-1' => [
'queue' => ['default', 'notifications'],
'minProcesses' => 1,
'maxProcesses' => 10,
'balanceMaxShift' => 1,
'balanceCooldown' => 3,
'maxJobs' => 1000,
'maxTime' => 3600,
],
'supervisor-media' => [
'connection' => 'redis-long',
'queue' => ['media'],
'balance' => 'simple',
'processes' => 2,
'tries' => 2,
'timeout' => 300,
],
],
'local' => [
'supervisor-1' => [
'maxProcesses' => 3,
],
],
],Add an entry for every environment where you run Horizon. If APP_ENV=staging and there is no staging key (and no * wildcard), no workers start.
Choosing a balancing strategy
| Strategy | How workers are assigned | Use it when |
|---|---|---|
auto (default) | Scales processes per queue between minProcesses and maxProcesses based on workload | Load varies and queues are roughly equal in importance |
simple | Splits a fixed processes count evenly across the queues | You want predictable resource use, for example heavy media jobs |
false | Processes queues strictly in listed order, still scaling total processes | One queue must always drain before the next |
With auto, the autoScalingStrategy option decides how workers are shared: time uses the estimated time to clear each queue, size uses the number of jobs, and log uses the logarithm of the job count so one huge queue cannot take every worker. Note that under auto the order of queues in the list does not create a priority. If you need a guaranteed lane, use a separate supervisor, as with supervisor-media above.
Step 3: get retries and timeouts right
Most production queue incidents come from three numbers that disagree with each other. Keep this order:
- Job timeout (the
#[Timeout]attribute or the job'stimeout) is the shortest. - Horizon supervisor
timeoutis longer than any job timeout on that supervisor. retry_afteron theredisconnection inconfig/queue.php(90 seconds by default) is a few seconds longer than the Horizon timeout.
If retry_after is shorter than the time a job really runs, Redis hands the same job to a second worker and it runs twice. If the Horizon timeout is shorter than a job's own timeout, the documentation warns that Horizon can treat the worker as hanging and kill it mid-job while scaling down.
The supervisor-media lane above allows jobs up to 300 seconds, which is longer than the default 90-second retry_after. Give long jobs their own Redis queue connection in config/queue.php instead of raising retry_after for everything:
// config/queue.php, inside 'connections'
'redis-long' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => 'media',
'retry_after' => 330,
'block_for' => null,
'after_commit' => false,
],Laravel 13 lets you set the job's own limits with attributes on the job class:
<?php
namespace App\Jobs;
use App\Models\Video;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Queue\Attributes\Backoff;
use Illuminate\Queue\Attributes\Timeout;
use Illuminate\Queue\Attributes\Tries;
use Throwable;
#[Tries(3)]
#[Timeout(240)]
#[Backoff([10, 60, 300])]
class TranscodeVideo implements ShouldQueue
{
use Queueable;
public function __construct(public Video $video)
{
$this->onConnection('redis-long');
$this->onQueue('media');
}
public function handle(): void
{
// Transcode the file...
}
public function failed(?Throwable $exception): void
{
$this->video->update(['status' => 'failed']);
}
/**
* @return array<int, string>
*/
public function tags(): array
{
return ['media', 'video:'.$this->video->id];
}
}A value set on the job takes precedence over the supervisor's tries. If you leave tries unset everywhere, Horizon makes a single attempt. Middleware such as WithoutOverlapping or RateLimited releases jobs back to the queue and uses attempts, so raise tries for jobs that use them.
Step 4: secure the dashboard
The dashboard lives at /horizon. In the local environment anyone can open it; everywhere else access is controlled by the viewHorizon gate in HorizonServiceProvider. Replace the placeholder with a real rule:
use App\Models\User;
use Illuminate\Support\Facades\Gate;
protected function gate(): void
{
Gate::define('viewHorizon', function (User $user) {
return $user->is_admin === true;
});
}The is_admin column is an example; use whatever role or permission check your application already has. The dashboard can retry and delete jobs and shows job payloads, so treat it as an admin tool. If you serve a Content Security Policy, Horizon supports a nonce through Horizon::cspNonce() called from middleware listed in the middleware option of config/horizon.php.
Step 5: metrics, tags and alerts
The metrics graphs stay empty until you schedule snapshots. In routes/console.php:
use Illuminate\Support\Facades\Schedule;
Schedule::command('horizon:snapshot')->everyFiveMinutes();Horizon tags jobs automatically with any Eloquent models in their properties, such as App\Models\Video:42, which lets you search the dashboard for every job that touched one record. The tags() method in the job above adds your own tags.
For alerts, set thresholds in the waits option (seconds per connection:queue, 60 by default) and route notifications in the provider's boot method:
public function boot(): void
{
parent::boot();
Horizon::routeMailNotificationsTo('ops@example.com');
Horizon::routeSlackNotificationsTo(config('services.slack.horizon_webhook'), '#queues');
}Noisy jobs you never need to inspect can be hidden with the silenced or silenced_tags options, or by implementing Laravel\Horizon\Contracts\Silenced.
Step 6: run Horizon in production
Horizon is a long-running process, so a process monitor must restart it if it exits. On Ubuntu, install Supervisor and add /etc/supervisor/conf.d/horizon.conf:
[program:horizon]
process_name=%(program_name)s
command=php /var/www/example.com/artisan horizon
autostart=true
autorestart=true
user=www-data
redirect_stderr=true
stdout_logfile=/var/www/example.com/storage/logs/horizon.log
stopwaitsecs=3600sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start horizonSet stopwaitsecs longer than your longest job, or Supervisor may kill a job that is still finishing. Then add one line to every deployment, after the new code is in place:
php artisan horizon:terminateThis lets running jobs finish, stops Horizon, and Supervisor starts it again on the new code. Without it, workers keep running the old code in memory. Useful commands for day-to-day work are horizon:status, horizon:pause and horizon:continue, and horizon:pause-supervisor supervisor-media to stop one lane during maintenance. Locally, php artisan horizon:listen restarts Horizon when files change (it needs Node and the chokidar package).
Laravel Horizon setup gotchas and what to do next
- Jobs run twice: check that
retry_afteris longer than the Horizontimeout, and that both are longer than real job runtimes. - Nothing processes in staging: the environment name has no entry under
environments. - Maintenance mode: Horizon does not process jobs during
php artisan downunless a supervisor sets'force' => true. - Memory creep: keep
memoryat a sensible limit and setmaxJobsormaxTimeso workers restart periodically. - Mixed drivers: Horizon manages Redis queues only. If a failover queue uses the
databasedriver, run a normalqueue:work databaseprocess beside it. - Redis memory: the
trimoption controls how many minutes Horizon keeps recent, completed and failed job records; shorten it if Redis is small.
Next, load-test one busy queue with realistic jobs and watch the wait-time graph. If waits grow, raise maxProcesses or move slow work to its own supervisor before you add servers.
Frequently asked questions
Does Laravel Horizon work without Redis?
No. Horizon only manages queues on the
redisdriver and does not support Redis Cluster. For the database or SQS drivers, usephp artisan queue:workwith your own process monitor.Can I run Horizon on Windows?
Not natively. The package requires the
pcntlandposixPHP extensions, which are not available on Windows. Run it inside WSL2, Docker or Laravel Sail.Why do my Horizon jobs sometimes run twice?
Usually because
retry_afteron the Redis queue connection is shorter than the time the job really takes, so another worker picks it up. Keep job timeout < Horizon timeout <retry_after.How do I restart Horizon after a deployment?
Run
php artisan horizon:terminate. Horizon finishes current jobs and exits, and your process monitor (such as Supervisor) starts it again with the new code.Who can see the Horizon dashboard in production?
Only users allowed by the
viewHorizongate inApp\Providers\HorizonServiceProvider. In thelocalenvironment the dashboard is open to everyone.Why are the Horizon metrics graphs empty?
Metrics come from snapshots. Schedule
horizon:snapshotto run every five minutes inroutes/console.phpand make sure the Laravel scheduler is running.
Sources
- Laravel Horizon (Laravel 13.x) — Laravel
- Queues (Laravel 13.x) — Laravel
- Horizon default configuration file, 5.x branch — Laravel (GitHub)
- laravel/horizon composer.json, 5.x branch — Laravel (GitHub)
- laravel/horizon releases — Laravel (GitHub)
- Supervisor: A Process Control System — Supervisor
Read next

TutorialDevOps5 min read
GitLab CI/CD for Laravel: test, build and deploy a reviewed release to a VPS
Design GitLab CI/CD for Laravel with a reviewed PHP image, disposable MySQL checks, explicit artifacts, protected credentials and serialized VPS deployments.
New tools, once a week
One short email listing what joined the directory.
Comments
No comments yet. Be the first to join the conversation.
Leave a comment
Every comment is read by a moderator before it appears. Your email address is never published; it is used only to contact you about this comment.
More from Cloudsoft Zone

TutorialDevOps5 min read
Laravel CI/CD with GitHub Actions: verification, release artifacts and guarded deployment
Build Laravel CI/CD with GitHub Actions using locked dependencies, isolated verification, immutable release artifacts and a protected deployment job with explicit recovery gates.
By Nilesh Kushvaha

TutorialDevOps5 min read
Prometheus and Grafana monitoring for Laravel and Node.js applications
Use Prometheus and Grafana to connect private application metrics, host observations and actionable dashboards for Laravel and Node.js production workloads.
By Nilesh Kushvaha

TutorialDevOps5 min read
Production stack monitoring: nginx, PHP-FPM, MySQL, Redis and queue workers
Build production stack monitoring with private nginx and PHP-FPM status, MySQL connection signals, Redis memory context and queue progress instead of process-only checks.
By Nilesh Kushvaha