Introducing Laravel Horizon

Taylor Otwell
Jul 25, 2017 · 4 min read

Today I’m proud to announce Laravel Horizon, which combines a beautiful dashboard and code-driven configuration system for your Laravel Redis queues.

In addition to a brand-new, code-driven configuration system, Horizon is a truly beautiful dashboard UI, and it’s totally open source and free for entire Laravel community. We’re launching the beta tomorrow. I hope you love it.

Dashboard

Image for post
Image for post

The Horizon dashboard is a beautiful, single-page Vue application that installs directly into your existing application with a simple composer require laravel/horizon. It provides real-time insight into queue workloads, recent jobs, failed jobs, job retries, throughput and runtime metrics, 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.

Configuration

Image for post
Image for post

Having this configuration in your code base 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, to start all of my queue workers, I only need a single, simple command: php artisan horizon. No other command-line options are required. This command will read the Horizon configuration and provision all of the necessary worker processes.

Once Horizon is installed and deployed to production, you can modify your entire worker configuration by modifying your configuration file and re-deploying.

Failed Jobs

Image for post
Image for post

Tag Monitoring

You may 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:

Image for post
Image for post

Balancing

Image for post
Image for post

Horizon can automatically balance your queue worker processes 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.

Once the queue has caught up, Horizon will make sure the processes are re-distributed fairly across all queues.

Metrics

Image for post
Image for post

Horizon provides throughput and average runtime charts, allowing you to see throughput and runtime trends for an individual job or for an entire queue. 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.

Notifications

Image for post
Image for post

Horizon sends both Slack and SMS notifications when one of your queues is too full. You can easily configure wait time thresholds to determine when a notification should be sent. This means you are always aware of when your queues need more workers. Once you get the notification, Horizon’s code-driven configuration allows you to make a quick configuration change to add more workers.

Conclusion & Thanks

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store