Laravel Horizon: queue monitoring + configuration
Summary
TLDRIn this video, Aaron Francis introduces Laravel Horizon, a powerful package for monitoring queue workers in Laravel applications. Horizon provides a beautiful dashboard and allows for fine-grained control over queue configurations, including worker numbers, balancing strategies, and process management, all tailored for Redis-backed queues. While it doesn't support database or SQS queues, Horizon offers advanced features like notifications, flexible environment configurations, and integration with Laravel's notification system. Aaron demonstrates its installation, setup, and configuration, offering insight into how Horizon can streamline and optimize Laravel queue management.
Takeaways
- π Laravel Horizon is a first-party package for monitoring queue workers in Laravel applications.
- π Horizon provides a beautiful dashboard to track queue metrics, including pending, completed, and failed jobs.
- π It is specifically designed for Redis-backed queues, not compatible with database or SQS-backed queues.
- π Horizon allows code-driven configuration for queue workers, balancing strategies, and worker processes.
- π The dashboard is publicly accessible in local development but needs configuration for production environments.
- π Horizon includes an authorization system that can be customized with user emails or IPs for access control.
- π Horizon can send notifications for events like overwhelmed queues or long-running jobs, using Laravel's notification system.
- π The configuration file for Horizon is robust, allowing customization for environments, supervisor settings, and queue balancing.
- π Horizon supports different balancing strategies, including auto-scaling based on the queue depth or job processing time.
- π The PHP Artisan command `php artisan horizon` starts the Horizon process, and it can be controlled using additional commands like `terminate` and `status`.
- π Horizon is free, open-source, and battle-tested, making it a powerful and convenient tool for Laravel developers, especially for those using Redis as their queue driver.
Q & A
What is Laravel Horizon, and what is its main purpose?
-Laravel Horizon is a first-party package in the Laravel ecosystem, designed to provide a beautiful dashboard for monitoring queue workers. It allows users to configure and manage the number of workers, balancing strategies, and processes for Redis-backed queues.
Which queue drivers are supported by Laravel Horizon?
-Laravel Horizon only works with Redis-backed queues. It does not support database-backed queues or SQS-backed queues.
How does Laravel Horizon compare to similar tools in other ecosystems?
-Laravel Horizon is similar to Sidekiq in the Ruby ecosystem and Obon in the Elixir ecosystem. However, unlike those tools, Horizon is free and open-source.
What is the first step in installing Laravel Horizon in a Laravel project?
-The first step is running the Composer command `composer require laravel/horizon` to pull the package into your application.
What does the `php artisan horizon:install` command do?
-The `php artisan horizon:install` command publishes Horizon's assets, service provider, and the configuration file necessary to set up Horizon in your Laravel application.
What is the default access level for the Horizon dashboard in local development?
-By default, the Horizon dashboard is open to the public in local development. In production, the dashboard is restricted and requires modifications to the authorization gate to allow access.
How can you restrict access to the Horizon dashboard in production?
-You can restrict access to the Horizon dashboard in production by modifying the `Horizon::auth` method in the Horizon service provider, where you can specify the emails of users allowed to access the dashboard or implement other forms of authentication, such as IP checks.
What is the significance of the `supervisor` configuration in Horizon?
-A `supervisor` in Horizon refers to a group of processes responsible for handling specific queues. You can define multiple supervisors, each managing different queues with varying numbers of processes and balancing strategies.
What is the role of the `environments` configuration in Horizon?
-The `environments` configuration allows you to define settings specific to different environments (e.g., production, local). You can set different numbers of workers, balancing strategies, and which queues to process for each environment.
What command do you need to keep running to monitor the queue workers in Horizon?
-To keep monitoring the queue workers, you need to run the command `php artisan horizon`, which starts the Horizon process and monitors the queues as per the configuration.
Outlines

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowMindmap

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowKeywords

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowHighlights

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowTranscripts

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowBrowse More Related Video

tutorial laravel livewire - part 1

Tutorial Laravel 8 #2 - MVC, Penjelasan Stuktur Folder Project dan Memahami Route

Tutorial Laravel 8 #1 - Perkenalan dan Membuat Project

Laravel vs Django - What to choose and why?

Is Laravel the Top PHP Framework for 2025?

Integrate Laravel Reverb with NextJS 14 (Private Messaging Example)
5.0 / 5 (0 votes)