The good news is that Laravel Horizon is not available that combines a beautiful dashboard and code-driven configuration system for your Laravel Redis Queues. Apart from that, it’s totally open source and free for the entire community. The following post comprises of what Laravel Horizon brings for us!
The horizon dashboard seems beautiful, single-page Vue application that installs on the direct basis into your existing application with a simple composer require laravel/horizon. It provides real-time insight into queue workloads, and process counts. Authentication to the dashboard is controlled by a simple callback registered via Horizon::auth, allowing you full control over access to the dashboard.
Being a wonderful new way to configure your Laravel queues. Similar to Laravel’s scheduler, all of your queue worker configuration lives in your code:
This configuration in your code means it’s all under source control, making it simple for your team to collaborate. In the config/horizon.php file, I can configure how many processes I want to create, which queues should be processed, queue timeouts, and any of the other settings I would normally pass to the queue: work Artisan command. Then start all the queue workers, I only need a single, simple command: php artisan horizon. For this, no other command line options are required. This command will read the Horizon configuration and provision all of the necessary worker processes. As soon as these Horizons are installed and deployed to production, one can modify their entire worker configuration by simply modifying the configuration file and re-deploying.
Horizon provides a clear, detailed interface for reviewing and retrying your failed jobs. Yes, you heard it right! One can easily view the exception stack trace, tags, and recent retries for the job. Imagine, how wonderful is it to have the recent job retries displayed directly on the failed job detail page. Because retries are linked to the original failed job, you no longer need to blindly fire queue:retry into your console and try to figure out if the retry finishes successfully or fails again:
Laravel Horizon even allows you to assign “tags” to jobs, including mailables, broadcasts, notifications and queued listeners. In fact, Horizon will intelligently and automatically tag most jobs depending on the eloquent models that are attached to the job. This also means that you can easily search your jobs via these tags, allowing you to review all of the jobs for a given customer or other entity within your application. This feature allows you to quickly keep an eye on a high-value customer or find the failed job for a customer who just filed a support ticket:
Horizon can automatically balance your queue worker procedures across your queues depending on the workload of those queues. For example, If your default queue is empty but your notifications queue is swamped with jobs, Horizon can automatically allocate spare workers to your “notifications” queue to help those jobs get processed quickly.
The moment the queue feels caught up, Laravel Horizon will make sure that the procedures are re-distributed fairly across all queues.
Providing throughput and average runtime charts, allows you to see throughput and runtime trends for an individual job or for an entire queue. In general, these metrics snapshot are captured using the horizon: snapshot command, which can be scheduled to run as often as every minute using Laravel’s built-in scheduler. This allows you to quickly find performance degradations after a deployment.
So that’s all for now! For more information and updates feel free to connect with a reliable laravel development company in town.