Introducing Laravel Horizon
Published on by Paul Redmond
The moment everyone in the Laravel community has been waiting for has finally arrived! Laravel Horizon is software to “supercharge your queues with a beautiful dashboard and code-driven configuration.”
On a regular basis, I find myself on a production server console trying to rerun failed jobs and clear a “stuck” jobs and using
redis-cli see what is in the queue. Generally speaking, Laravel queues are amazing and work fantastically most of the time; however, when things fail, troubleshooting queues can be a daunting task. On top of troubleshooting, wouldn’t you also like some key metrics on queue performance?
Laravel Horizon is designed to make it easy monitor your queues from a web interface and receive notifications when things go wrong.
According to Taylor Otwell, the creator of Laravel, here’s the background of why he built Laravel Horizon:
I built Horizon to scratch my own itch. I need deep insight into my queue throughput, performance, wait times, failures. And, when a customer has a problem, Horizon allows me to quickly find the job that failed.
At a high level, here are some of the key features of Laravel Horizon:
- Code-Driven Configuration
- Dashboards and Metrics
- Queue monitoring
- Failed Job Management
- Open-Source Software
Horizon will balance your workers across queues. When a queue gets busy, Horizon can intelligently see if any other workers are available and move them to queues that need help.
Laravel Horizon uses code-driven configuration, which is awesome because you can version control it along with your project.
See what your queue is doing in real-time with dashboard metrics for your queues and jobs. The metrics can help you monitor things like performance, job stats, and throughput.
With Laravel Horizon you will be able to tag your jobs and monitor them with a simple dashboard. Monitoring will allow you to isolate issues and usage patterns according to your specific needs.
Failed Job Management
Most people that have used Laravel queues have had to SSH into a server and retry failed queue jobs. Laravel Horizon will make it easy to retry failed jobs and even search failed jobs and retry specific jobs. For example, you can search for a failed jobs for a single user and retry them.
When a queue is getting overloaded, Laravel Horizon can notify you of the issue, allowing you to react much more quickly. I’ve set up custom monitoring in order to receive queue notifications when things go bad, but Laravel Horizon should make it much simpler to get notifications up without all the hassle of setting up custom monitoring solutions.
In my opinion, one of the most awesome parts of Laravel Horizon is that the free version will be 100% open-source software. You will be able to browse the source code and contribute if you run into a bug or spot an improvement that can be made.
Laravel Horizon is an exciting addition to the Laravel ecosystem and solves a much-needed pain point around using queues with Laravel. I personally can’t wait to install Horizon and give it a further review after launching it into one of my production systems!