Laravel Queues in Production: What Nobody Tells You
LaravelQueuesBackendProduction

Laravel Queues in Production: What Nobody Tells You

Beyond the docs — real patterns for reliable queue jobs, retry strategies, and monitoring that I use in production SaaS applications.

Mokammel Tanvir

Mokammel Tanvir

Software Engineer

Why Queues Matter

Anything that takes more than 200ms — emails, AI calls, webhooks, PDF generation — belongs in a queue. Your users shouldn't wait.

Job Structure That Scales

class ProcessAIWorkflow implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public int $tries = 3;
    public int $backoff = 60;
    public int $timeout = 120;

    public function handle(ClaudeService $claude): void
    {
        // idempotent logic here
    }

    public function failed(Throwable $e): void
    {
        // notify, log, alert
    }
}

Production Tips

  • Always set $timeout — default is unlimited, will freeze workers
  • Make jobs idempotent — retries happen, your job must handle them
  • Use uniqueJobs — prevents duplicate processing on race conditions
  • Monitor with Telescope in staging, Horizon in production

Horizon Config That Works

'production' => [
    'supervisor-1' => [
        'connection' => 'redis',
        'queue' => ['ai-heavy', 'default', 'emails'],
        'processes' => 10,
        'tries' => 3,
    ],
],

Run separate supervisors per queue priority. AI jobs shouldn't block email delivery.

All Posts
Mokammel Tanvir

Mokammel Tanvir

Full-Stack Engineer · Laravel · Vue · WordPress · AI

Building web applications with Laravel, Vue/Nuxt, and WordPress — SaaS platforms, REST APIs, and AI-integrated workflows. Open to remote and hybrid opportunities.