Performance: Queue worker supervision
This affects backend job processing speed and reliability, indirectly impacting frontend user experience by reducing delays and errors.
Jump into concepts and practice - no test required
Use Laravel Horizon or Supervisor to monitor and auto-restart queue workers: # Supervisor config example [program:laravel-worker] command=php /path/to/artisan queue:work --sleep=3 --tries=3 process_name=%(program_name)s_%(process_num)02d numprocs=3 autostart=true autorestart=true stderr_logfile=/var/log/worker.err.log stdout_logfile=/var/log/worker.out.log
php artisan queue:work --once
# Manually restarting workers after failure or crash| Pattern | Worker Uptime | Job Processing Delay | Backend Throughput | Verdict |
|---|---|---|---|---|
| Manual restart after failure | Low (stops after one job) | High (delays until manual restart) | Low (jobs pile up) | [X] Bad |
| Supervisor or Horizon auto-restart | High (continuous running) | Low (immediate job processing) | High (parallel workers) | [OK] Good |
[program:laravel-worker] command=php /var/www/artisan queue:work --sleep=3 --tries=3 numprocs=1 autostart=true autorestart=true user=www-data