Laravel Queue & Job System: From Table Creation to Production Deployment
July 1, 2025🚀 Laravel Queue & Job System
We’re gonna walk you through Laravel queues from setup to deploying in production using Supervisor.
Step 1: Create queue tables
Run these commands:
php artisan queue:table
php artisan queue:failed-table
php artisan queue:batches-table
php artisan migrate
Step 2: Monitor failed jobs
Run:
php artisan queue:failed
You’ll get a list with ID, connection, exception, and timestamp.
Step 3: Retry failed jobs
php artisan queue:retry 5 # retry single job
php artisan queue:retry all # retry all failed jobs
Step 4: Delete failed jobs
php artisan queue:flush
Step 5: Prune old failed jobs
php artisan queue:prune-failed # older than 24h
php artisan queue:prune --hours=48 # older than 48h
Step 6: Retry logic with backoff
Examples:
php artisan queue:work --tries=2
php artisan queue:work --queue=notification --tries=2 --backoff=1200
php artisan queue:work --queue=notification --tries=2 --backoff=10,20
Step 7: Job batches
Use batches to group jobs (e.g., sending 10,000 emails) and track overall progress, retries, and notifications.
Step 8: Production deployment with Supervisor
Supervisor restarts your queue workers on failure. Example config:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan queue:work --tries=3 --backoff=30 --timeout=120 --max-jobs=1000 --max-time=3600 --sleep=3 --reset=1
autostart=true
autorestart=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-worker.log
Save to /etc/supervisor/conf.d/laravel-worker.conf, then:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*
Blog
Jul 13, 2025
Laravel provides multiple ways to write reusable query logic. The two most common approaches are using Scopes with Traits or the newer #[UseEloquentBu...
Jul 07, 2025
How to cache report queries with fixed timelines How to generate large reports asynchronously using job queues 1. 🧠Report Query Caching wi...
Aug 03, 2025
Laravel 12.21.0 introduces two game-changing features aimed at writing cleaner, more maintainable code. The update includes the new whereValueBetwe...
Sep 13, 2025
If you want to send Push Notifications from your Laravel app to mobile or web clients, the fastest and simplest way is to use Notifire. It integrate...
Jun 26, 2025
CSS Specificity: Cascade Layers vs BEM vs Utility Classes This article compares three approaches to managing CSS specificity — BEM, utility‑f...
Jun 17, 2025
React Labs: View Transitions & Activity Published April 23, 2025 by Ricky Hanlon. React Labs is sharing two new experimental featu...