← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

PHP Queue Workers

Messaging PHP 7.0+ Intermediate
debt(d8/e6/b6/t7)
d8 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'silent in production until users hit it' (d9), -1 because Laravel Horizon dashboard and supervisor status can surface dead workers if monitored. Per detection_hints.automated=no, there's no automated check — crashed workers, memory leaks, and missing dead-letter queues silently accumulate until the queue backs up visibly.

e6 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7), -1 because quick_fix involves configuring Supervisor/Horizon, adding timeouts, max-tries, and a dead-letter queue — this is more than a single file but stays within the deployment/worker configuration layer rather than touching all business code.

b6 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (b7), -1 because applies_to is the queue-worker context specifically. Once jobs are async, every long-running task gets shaped around job design, retries, idempotency, and worker lifecycle, but it doesn't redefine the whole system.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap (contradicts how a similar concept works elsewhere)' (t7), grounded in the misconception that workers restart automatically on crash — developers assume PHP-FPM-like supervision but `queue:work` is just a process that dies silently, contradicting expectations from web request handling.

About DEBT scoring →

Also Known As

Laravel Horizon Supervisor queue worker background jobs php artisan queue:work

TL;DR

Laravel Horizon for Redis queues with dashboard and auto-scaling; Supervisor for process management ensuring crashed workers automatically restart.

Explanation

PHP queue workers process jobs from queues (Redis, SQS, database) in persistent background processes. Laravel Horizon: dashboard with real-time metrics, auto-scaling worker pools, per-queue configuration, memory limit enforcement. Supervisor: process control system that monitors and restarts crashed workers, manages multiple worker processes with log rotation. Job patterns: $tries and $backoff for retry logic, failed() hook for cleanup on permanent failure, ShouldBeUnique for deduplication.

Common Misconception

Queue workers restart automatically when they crash — without Supervisor or systemd, a crashed worker process simply stops; the queue silently backs up until someone notices and restarts manually.

Why It Matters

Processing 1000 emails synchronously in a web request blocks users for minutes — queue workers process them asynchronously in the background, and Supervisor automatically restarts any worker that crashes.

Common Mistakes

  • Workers started manually without Supervisor — crashed workers never restart
  • No memory limit — PHP workers accumulate memory leaks over time without restart
  • No job timeout — a hanging job blocks that worker indefinitely
  • Single worker handling all job types — slow report generation blocks fast email sending

Code Examples

✗ Vulnerable
# Manual worker without process management:
php artisan queue:work &
# Worker crashes: nobody notices
# Queue backs up silently
# Server restarts: worker never comes back
# 2 hours later: customer reports emails not sending
✓ Fixed
# /etc/supervisor/conf.d/horizon.conf:
[program:horizon]
process_name=%(program_name)s
command=php /var/www/app/artisan horizon
autostart=true
autorestart=true
user=www-data
stopwaitsecs=3600
stdout_logfile=/var/log/supervisor/horizon.log

# config/horizon.php — separate queues, memory limits:
# 'supervisor-1' => ['queue'=>['critical','default','low'],'processes'=>10,'memory'=>128]

Added 16 Mar 2026
Edited 22 Mar 2026
Views 49
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 1 ping T 0 pings F 1 ping S 1 ping S 5 pings M 0 pings T 1 ping W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Amazonbot 7 Scrapy 7 Perplexity 6 ChatGPT 5 Ahrefs 4 Google 4 SEMrush 4 Unknown AI 2 Claude 2 Meta AI 1 PetalBot 1
crawler 36 crawler_json 7
DEV INTEL Tools & Severity
🟠 High ⚙ Fix effort: Medium
⚡ Quick Fix
Configure Laravel Horizon or Symfony Messenger workers with supervisor/systemd — set max-tries=3 and a timeout, and always have a dead-letter queue for failed jobs
📦 Applies To
PHP 7.0+ queue-worker laravel symfony
🔗 Prerequisites
🔍 Detection Hints
Queue workers started manually not via supervisor; no dead-letter queue; workers with no timeout; memory leaks accumulating over days
Auto-detectable: ✗ No supervisor laravel-horizon symfony-messenger
⚠ Related Problems
🤖 AI Agent
Confidence: Medium False Positives: Medium ✗ Manual fix Fix: Medium Context: File


✓ schema.org compliant