What is Laravel Horizon?
45sQuick intro to a beautiful queue monitoring tool that grabs developers' attention.
▶ Play ClipLaravel Horizon provides a beautiful dashboard and code-driven configuration for managing Redis queues. It allows monitoring key metrics like job throughput, runtime, and failures, and enables easy scaling and configuration of workers.
Horizon is a powerful tool for managing Redis queues with a dashboard and code-driven configuration.
Horizon monitors job throughput, runtime, job failures, and other key metrics.
Horizon acts as a central hub for all queue monitoring needs, with a single configuration file for workers.
Access the dashboard via /horizon; it shows active status, supervisors, and job data.
Run 'php artisan horizon' to start Horizon and push jobs to the queue.
Increase max processes in the config file to speed up job processing.
Horizon auto-balances processes across queues, allocating more to queues with more jobs.
Adjust processes, retries, and timeouts based on your specific needs.
Horizon is essential for effective queue management, providing insights and enhancing background job processing.
Laravel Horizon is essential for managing queues effectively, offering a dashboard and auto-balancing to optimize job processing. Check the official docs for advanced use.
"The title accurately describes Horizon as a beautiful queue monitoring tool; the video delivers exactly that."
What command starts Laravel Horizon?
php artisan horizon
1:00
What is auto-balancing in Horizon?
Horizon automatically allocates more processes to queues with more jobs.
4:12
How do you access the Horizon dashboard?
By navigating to /horizon in the application.
0:46
What metrics does Horizon monitor?
Job throughput, runtime, job failures, and other key metrics.
0:16
What is the purpose of the Horizon config file?
To configure workers, supervisors, processes, queues, retries, and timeouts.
0:33
Horizon Overview
Introduces Horizon as a tool for queue management with a dashboard and code-driven config.
Increasing Processes
Demonstrates how tweaking max processes speeds up job processing.
1:58Auto-balancing Explained
Shows how Horizon dynamically allocates processes to busy queues.
4:12[00:00] Are you ready to take your Q management
[00:02] to the next level? Let's explore Level
[00:05] Horizon, a powerful tool that provides a
[00:07] beautiful dashboard and code-driven
[00:09] configuration for managing your Rady's
[00:11] cues. With Horizon, you can easily
[00:13] monitor key metrics of your Q system,
[00:16] such as job throughput, runtime, job
[00:18] failures, and so on. This means you can
[00:21] keep your application running smoothly
[00:23] and efficiently while gaining valuable
[00:25] insights into your background jobs.
[00:28] Horizon acts as a central hub for all
[00:30] your Q monitoring [music] needs. It
[00:31] allows you to configure your workers in
[00:33] a single manageable configuration file,
[00:36] making it easy to scale and modify your
[00:38] co-workers as needed. Let's take a look
[00:41] together. Once you have Horizon
[00:43] installed, you can access the dashboard
[00:46] by going to / Horizon application. And
[00:48] this is what it looks by looks like by
[00:50] default. We don't have any data yet. And
[00:53] we can see that it's currently inactive.
[00:55] So let's change this. Now let's start
[00:57] Horizon and push some jobs to the queue.
[01:00] And we can do this by running PHP
[01:03] artisan horizon. Here we go. And you can
[01:05] also see I have my Q worker for the
[01:07] default queue already running. So when
[01:10] we go back to the dashboard, we can now
[01:12] see it's active. We also see some more
[01:14] information here about the queue about
[01:16] supervisors. And we're going to talk
[01:18] about this just in a bit. But let's push
[01:21] some chops here so that we actually see
[01:24] something. And in our application which
[01:25] is called user lift, we're going to
[01:27] import some users. And then we're going
[01:29] to take a look again. And you can see
[01:31] suddenly something is happening here. We
[01:33] have 100 and one chops. Here we see jobs
[01:36] per minute. We see currently it's just
[01:38] running one process. And we can see here
[01:41] on the left the pending jobs. It seems
[01:44] like everything was already running. And
[01:46] here are our completed jobs which we
[01:49] used in order to import all the users to
[01:52] our import users table. This already
[01:54] went pretty well, but we can speed
[01:56] things up a little bit while tweaking
[01:58] our Horizon config file. Now, let's
[02:00] increase the number of max processes
[02:02] here for our local supervisor here,
[02:05] which we're using. Then, we're going to
[02:07] need to rerun Horizon and rerun our
[02:10] Qwork. And then back here now, we're
[02:13] going to import, let's say, 1,000 users
[02:15] here. And if we go to the dashboard,
[02:17] let's see what's happening now here.
[02:19] Okay, we can already see that there are
[02:20] one around 1,000 chops here being added
[02:23] to our default queue. And we can see
[02:25] it's already using all the three
[02:27] processes. And you can also see that
[02:29] chops per minute is now way faster than
[02:31] it was before. So this means more
[02:33] processes of course means that you can
[02:35] handle more chops at the same time. And
[02:38] I think we're already done here. Let's
[02:40] see. Now we still have some pending jobs
[02:42] here. The completed ones. You could also
[02:44] see failed ones, but we don't have any
[02:46] of them here. But it looks like it's
[02:48] still running here. But it's going
[02:49] pretty fast here as you can see. And I
[02:51] think we should be already done in a
[02:53] couple of seconds. 80 more jobs here.
[02:57] Here we go. Pending jobs. No, we're done
[03:00] now. And yeah, this was of course now
[03:02] very fast now while running while using
[03:04] three processes. And you can see it has
[03:06] has gone down again to one process again
[03:09] because that's the only thing we
[03:10] currently need because there are no
[03:11] chops on our default queue.
[03:14] It is important to mention that you have
[03:16] to find the right settings, amount of
[03:17] processing, retries or timeouts for your
[03:20] own situation. There is a lot you can
[03:22] tweak to your exact needs. But I want to
[03:24] show you here one more thing. Okay, back
[03:27] here in the config file for our local
[03:29] supervisor, we have defined the default
[03:31] queue, a male ske, and the backups Q.
[03:34] And we have given them 10 processes to
[03:37] share. And now again, let's import let's
[03:40] say 1,000 users again. Let's start this
[03:43] and let's go back here. We can already
[03:45] see we have 1,000 chops here, but we
[03:47] also see the other cues here, backups on
[03:48] meals. We have no chops here at all. And
[03:51] you can see it's already using a little
[03:53] more processes than before, now it's
[03:54] using um five processes. And our
[03:57] supervisor is currently using already
[04:00] eight. So this means from those 10
[04:01] processes which we have allocated for
[04:03] the supervisor one now most of them are
[04:06] being used by default Q because they
[04:08] already see that there are no shops
[04:10] being processed on backups and mails and
[04:12] this is called autobalancing. So that it
[04:15] use all the possible processes for the
[04:18] [snorts] queue which has the most chops
[04:21] and you can see it's already done by
[04:22] processing around 1,000 chops per
[04:25] minute. And now the processes went back
[04:27] to just one because yeah, Horizon sees
[04:30] there that there are zero jobs for all
[04:32] the other cues. So only three processes
[04:34] are currently being used for our
[04:37] supervisor.
[04:39] In summary, Laval Horizon is essential
[04:41] tool for any Laval developer looking to
[04:43] manage their cues effectively. It
[04:45] enhances your application background job
[04:47] processing capabilities and provides
[04:50] valuable insights into your job
[04:51] performance. For more details and
[04:53] advanced uses, be sure to check out the
[04:56] official docs. As always, happy coding
[04:58] and enjoy managing your cues with
[05:01] Larable Horizon.
⚡ Saved you time reading this? Transcribe any YouTube video for free — no signup needed.