Intermediate LevelLaravel
What is Laravel Horizon and how does it monitor Redis queues?
❓ Interview Prompt: Explain Laravel Horizon, config/horizon.php, real-time dashboard UI, auto-scaling worker strategies, and failed job metrics.
Laravel Horizon provides a beautiful real-time dashboard and configuration system for Laravel Redis queues.
Key Features:
•
Auto-scaling Workers: Spawns worker processes dynamically based on queue workload spikes.
•
Metrics: Monitors job throughput, runtime averages, queue wait times, and failure rates.
•
Failed Job Management: Retries or discards failed queued jobs directly from the web dashboard.
Code Implementation Example
php
<?php
// In config/horizon.php
'environments' => [
'production' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default', 'high'],
'balance' => 'auto',
'minProcesses' => 1,
'maxProcesses' => 10,
],
],
];💡Configuring Horizon auto-scaling queue supervisor processes.
🎯 Interview Key Takeaway
Use Laravel Horizon to monitor Redis queues, auto-scale worker processes, and manage failed jobs via a web dashboard.
#Horizon#Redis Queue#Monitoring#Intermediate
Back to all Laravel Questions→