Start free trial
Start free trial Log in

14-day free trial. No credit card.

How to Monitor Laravel Queues in Production

Worker supervision, failed-job handling, and per-job-class metrics across Redis, SQS, and database drivers.

  • Guide
  • 3 min read

How do I monitor Laravel queues in production?

You need three layers: (1) a process supervisor like Supervisor to keep workers (or Horizon, on Redis) alive and restart them on crashes, (2) the failed_jobs table plus a dead-letter strategy for failures, and (3) an APM that groups attempts by job class with duration percentiles and failure alerts. Horizon covers Redis; NightOwl and Nightwatch Cloud cover all drivers.

Updated

A queue is the easiest part of a Laravel app to forget about, because when it works you never think about it. Jobs go in, things happen, nobody notices. The trouble is it fails the same way: quietly. A worker dies and isn't restarted, jobs pile up, and the first symptom isn't an error but a user asking why their export from an hour ago still hasn't arrived. Monitoring queues is mostly about making that silence loud by surfacing the dead worker, the failure spike, and the slowly-growing backlog before they become a support ticket.

1. Keep your workers alive

Queue workers are long-running processes. They leak memory, die on OOM, and restart on deploy. You need a supervisor that restarts them automatically.

Supervisor config: /etc/supervisor/conf.d/laravel-worker.conf

ini
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /srv/app/artisan queue:work redis --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=4
redirect_stderr=true
stdout_logfile=/srv/app/storage/logs/worker.log
stopwaitsecs=3600

If you're on Redis, Horizon manages the workers for you: it balances and scales worker processes across queues, exposes a dashboard, and restarts cleanly on deploy with horizon:terminate. It doesn't replace Supervisor. You run one php artisan horizon program under Supervisor instead of the queue:work entries. Not on Redis? See the Horizon alternatives for other queue drivers.

Terminal
composer require laravel/horizon
php artisan horizon:install
php artisan horizon

2. Handle failures loud, not silent

Laravel writes failed jobs to the failed_jobs table by default. That's useful as a dead-letter store but invisible unless you look.

Hook into the Queue::failing() event to alert on failures:

app/Providers/AppServiceProvider.phpphp
use Illuminate\Queue\Events\JobFailed;
use Illuminate\Support\Facades\Queue;

public function boot(): void
{
    Queue::failing(function (JobFailed $event) {
        logger()->error('Job failed', [
            'job' => $event->job->resolveName(),
            'connection' => $event->connectionName,
            'queue' => $event->job->getQueue(),
            'attempts' => $event->job->attempts(),
            'exception' => $event->exception->getMessage(),
        ]);
    });
}

Logging is a baseline. For production alerting you want something that groups failures by job class and throttles duplicate noise. Raw logger() calls will drown your channel. The failed job monitoring guide covers the options layer by layer.

3. Track attempts, duration, and throughput

A job that takes 10x longer today than yesterday is a problem, even if it doesn't fail. The three metrics that matter:

  • Wait time: how long a job sat in the queue before a worker picked it up
  • Processing time: how long handle() took, with p50/p95/p99 per job class
  • Attempt count: how often jobs are being retried before succeeding

For Redis queues, Horizon's dashboard shows the current wait per queue and its Metrics page charts throughput and runtime. The queue latency guide shows how to record wait time on any driver. For everything else (SQS, database, mixed drivers, per-class duration percentiles), you need an APM with queue-specific watchers.

4. Tag jobs for context

When a job fails, you want to know whose data it was processing. Use Horizon tags, or add values with Laravel's Context facade. Nightwatch records the Context on each job attempt, and NightOwl shows it on the attempt page. Job properties themselves aren't recorded.

php
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Context;

class ChargeCustomer implements ShouldQueue
{
    use Queueable;

    public function __construct(public Customer $customer) {}

    public function tags(): array
    {
        return ['billing', 'customer:'.$this->customer->id];
    }

    public function handle(): void
    {
        Context::add('customer_id', $this->customer->id);

        // ...
    }
}

Every queue attempt, grouped by job class

NightOwl records every dispatch and attempt on Redis, SQS, database or Beanstalkd queues and charts p50, p95 and p99 duration per job class. A job that throws a new exception opens an issue and alerts your Slack, Discord, email or webhook channel. Horizon can keep running next to it for live worker ops.

No credit card needed.

Terminal
composer require nightowl/agent
php artisan nightowl:install
php artisan nightowl:agent

Frequently asked questions

Anything else, write to support@usenightowl.com

How do I monitor Laravel queues in production?

You need three layers: a process supervisor (Supervisor or systemd) to keep workers alive, with Horizon running under it on Redis to manage the workers, job tables (failed_jobs) to log failures, and an APM that tracks attempts, duration, and retries per job class. Horizon covers workers and metrics for Redis queues; NightOwl or Nightwatch Cloud cover all drivers with per-job-class detail and alerting.

What's the difference between Horizon and NightOwl for queue monitoring?

Horizon is a worker dashboard for Redis-backed queues: it shows worker processes, throughput, and failed jobs. NightOwl is broader: it tracks every job attempt across any driver (Redis, database, SQS, Beanstalkd), groups by job class with duration percentiles, and surfaces failures with full stack traces. A new exception opens an issue and sends an alert once, not once per failed attempt. Many teams run both.

How do I see why a Laravel job failed?

Laravel writes failed jobs to the failed_jobs table by default, and you can inspect them with php artisan queue:failed and read the exception column. This shows the error but not the request context or attempt history. An APM that groups failures by job class (like NightOwl) shows you fingerprinted exceptions plus duration, attempts, and any Laravel Context you added. NightOwl doesn't store job payloads.

How do I monitor queue latency in Laravel?

Queue latency has two parts: wait time (how long a job sits in the queue before a worker picks it up) and processing time (how long the handle() method takes). Horizon's dashboard shows the current wait per queue, for Redis queues only. NightOwl charts processing time per job class (p50, p95, p99), and its trace timeline shows the queue wait for each attempt when you hover the gap before it. It doesn't chart wait time over time.

Should I alert on failed jobs?

Yes, but with care. A single failed job is noise; a spike in the failure rate for a specific job class is a real signal. Configure alerts at the class level on a time-windowed threshold (e.g. more than 5 failures in 10 minutes for App\Jobs\ChargeCustomer). Route alerts to Slack or Discord, never email for high-volume queues. NightOwl won't count failures in a window; it alerts when a job throws an exception it hasn't seen before, so a 5-in-10-minutes rule needs a Queue::failing() listener or your metrics stack.

How do I track job retries in Laravel?

Laravel's Job class has a tries property and an attempts() method on the underlying job instance. You can log the attempt count manually, but aggregating it across thousands of jobs is the hard part. NightOwl and Nightwatch Cloud both track the full attempt history per job (released, processed, failed) with timing.

What's the best queue driver for production Laravel?

Redis is the default for most teams: cheap, fast, well-supported by Horizon. SQS is the right pick if you're already on AWS and want managed infra. Database queues work for low-volume apps and put the queue load on your main database, so watch it as volume grows. Avoid sync and null in production.

Flat pricing, whatever your traffic does

Every plan starts with a 14-day free trial. No credit card needed.

Hobby
$5 a month

One app for a side project. Issues and alerts, with a 14-day dashboard window.

Start my 14-day trial
TeamRecommended
$15 a month

Up to 3 apps and 5 people per team. Full history, the MCP server, data clearing and agent health.

Start my 14-day trial
Agency
$69 a month

Unlimited client apps and people, one overview of every app, and apps you can hand over.

Start my 14-day trial

Related

Watch your own queues by job class

Failures and p95 duration for each job class show up on any queue driver. No credit card needed.