---
title: 'Laravel Horizon: queue monitoring + configuration'
source: 'https://youtube.com/watch?v=r3c_qBvAHXA'
video_id: 'r3c_qBvAHXA'
date: 2026-06-14
duration_sec: 893
---

# Laravel Horizon: queue monitoring + configuration

> Source: [Laravel Horizon: queue monitoring + configuration](https://youtube.com/watch?v=r3c_qBvAHXA)

## Summary

Laravel Horizon is a first-party package by the Laravel team that provides a beautiful dashboard for monitoring queue workers and a code-driven way to configure workers, balancing strategies, and processes. It only works with Redis-backed queues and is free and open source.

### Key Points

- **Introduction to Laravel Horizon** [00:00] — Horizon is a first-party package for monitoring and configuring queue workers, available since Laracon 2017.
- **Redis Requirement** [00:58] — Horizon only works with Redis-backed queues, not database or SQS queues.
- **Installation** [01:31] — Install via Composer: composer require laravel/horizon, then run php artisan horizon:install to publish assets and config.
- **Dashboard Overview** [02:29] — The dashboard shows pending, completed, silenced, and failed jobs. In production, access is restricted via an authorization gate.
- **Authorization Gate** [03:16] — Modify the Horizon service provider's gate to control who can view the dashboard in production.
- **Notifications** [04:15] — Horizon can send notifications via various channels when queues are overwhelmed or jobs take too long.
- **Configuration: Environments and Supervisors** [05:16] — Define per-environment worker counts, balancing strategies, and queues. Supervisors group processes with specific configurations.
- **Balancing Strategies** [06:39] — Auto balancing allocates processes based on queue depth. Options include auto, simple, and false. Autoscaling can be based on time or size.
- **Running Horizon** [08:31] — Start with php artisan horizon. This single command manages all workers. Use php artisan horizon:terminate for graceful shutdown during deployments.
- **Real-World Configuration Example** [09:07] — Example shows multiple supervisors with different timeouts and queues, e.g., short vs long jobs.
- **Useful Commands** [13:04] — Commands: status, list, supervisors, pause, continue, and terminate.
- **Reasons Not to Use Horizon** [14:11] — Only if using SQS as queue driver. Otherwise, Horizon is recommended for its power and convenience.

### Conclusion

Laravel Horizon is a powerful, free, and open-source tool for managing Redis-backed queues, offering a dashboard and code-driven configuration. It simplifies queue management and is highly recommended for Laravel applications using Redis.

## Transcript

welcome back to the what is Laravel series I'm 
your host Aaron Francis let's Dive Right [Music]
In Laravel Horizon got to be one of my favorite 
packages in the Laravel ecosystem it is a first  
party package so it's written and maintained by 
the laravel team it's been around since Laracon  
2017 I think so it's been around for a long time 
time now and what it does is it provides you a  
beautiful dashboard for monitoring your Q workers 
it also gives you a code driven way to configure  
the number of workers the balancing strategy the 
the processes and so your entire Q system can be  
wrapped up and put into this Horizon configuration 
file now importantly this only works with redis  
backed cues so if you're using a database backed 
Q or an sqs backed Q it's not going to work with  
that and so that's one maybe drawback but I pretty 
much use redis back cues for everything if you're  
coming from a different ecosystem this is very 
similar to sidekick over in the Ruby world or  
I think it's called obon over in The Elixir world 
and so if you're coming from a different spot that  
probably sounds more familiar to you than Horizon 
but they're all basically the same thing except  
Horizon is free and open source so I'm going to 
show you how it works here and then we'll talk a  
little bit more at the end I've got a very basic 
Laravel application here if we open it in the  
browser we see it's just this invite a user and 
this doesn't really do anything except queue up a  
job so this is the application that we're working 
with I'm going to go ahead and do composer require  
Laravel Horizon that's all it takes it's going to 
pull the package into my application and then you  
can see that we are left with we're left with a 
lot of horizon commands we're not going to cover  
all of them but the first thing I am going to do 
is say PHP Artisan Horizon install and what that's  
going to do it's going to publish the assets the 
service provider and importantly the configuration  
we'll go over the configuration here in a second 
but I want to show you that in the matter in a  
matter of 30 seconds here we now have a full on 
if we hit in the browser we now have a full on Q  
dashboard monitoring metrics pending jobs 
completed jobs silence jobs failed jobs all  
of this lives inside of our application it's 
being served by this Laravel Horizon package  
so all of this all of this chrome all of these 
assets all of this logic is inside that Laravel  
Horizon package now it's inside of our app now 
this dashboard is totally open to the public  
where everybody can see it in local development 
only by default Inu production nobody can see this  
and you have to modify the authorization gate to 
allow people to look at this in production which  
is kind of important that's kind of what you 
want so let me show you how that works and then  
we'll dive in a little bit deeper to modify the 
authorization we're going to look at the Horizon  
service provider which has been published into our 
application so you can see that it lives inside  
of our app providers directory that was put there 
by the Horizon install command first thing you'll  
see is this looks interesting but we're going to 
skip that for now so we'll come back to it pay  
attention we're going to jump down here to this 
view Horizon gate and by default it's just saying  
great put some people's emails here and we'll 
check to see if they're allowed to use it so we  
could put Aaron example.com please send me some 
emails um and this would allow me to use this in  
production if if you aren't um if you don't have a 
user login system and you want to limit by IP only  
I think you can say equals null and then you don't 
have to check the user and you can do anything  
that you want down here it's just a function you 
can do anything you want to decide if this person  
is able to view the Horizon dashboard scrolling 
back up to this very interesting thing Horizon  
also comes with notifications so if a queue is 
overwhelmed or backed up or jobs are taking a  
really long time to complete you can just route 
notifications to many different channels just like  
that all you have to do is put the information in 
here with SMS you would have to set up you would  
have to set up your SMS provider but this uses 
laravel's notification system under the hood so  
it's pretty it's pretty straightforward let's look 
at the configuration file before we look at this  
configuration file I have to warn you it's pretty 
robust which is a good thing we want to be able to  
configure it exactly how we want I am not however 
going to show you every single option there's too  
much right here but I can show you uh a few of 
the interesting ones you can serve The Horizon  
dashboard from a subdomain so if you don't want 
it on your main domain you want it on like app dot  
or o or admin dot you could do that you can also 
change the path where it is served so it doesn't  
have to be SL Horizon it can be SL whatever else 
pretty cool not what I'm here to show you I am  
here to show you this environments key so in this 
environments key you've got production and you've  
got local and this is where you get to Define per 
environment you get to Define how many workers  
what the balancing strategy is what cues are 
being worked so inside of these Keys you've  
got something called supervisor one doesn't need 
to be called that it could be called Fu one it  
could be called anything you want we'll leave 
it at supervisor in this context supervisor  
just means um a collection of processes a group a 
bundle that's it nothing more fancy than that the  
reason you can have multiple is let's say you want 
to have um this supervisor this group of processes  
this configuration you just want it to process the 
default q and maybe the high Q so maybe you have  
a high and a low q and you need more throughput 
on the high Q than you do on the low Q this is a  
great place to do that in fact let's go ahead and 
turn that up to 15 we'll turn this down to three  
because we don't super care about it and then 
we'll say for this supervisor all I want you to  
process is in fact just process the low Q that's 
all that I want you to care about three processes  
is fine I don't really care about that so much 
now you can say you can say I want to balance the  
default is auto which is good I like that I think 
the other options are simple and then I think  
false is an option but since Auto is the default 
I usually leave that off and what this is going to  
do is this is going to allocate processes based on 
how deep the cues are so if your high Q is totally  
slammed and your default queue is empty it's going 
to move a bunch of processes over to process the  
high Q you can say hey don't don't leave me 
totally high and dry um let's just say that  
the Min the minimum number of processes working 
on a single Q let's make that two so you can move  
13 over to the high q but leave two on to process 
the default Queue Now you can also have something  
I think it's Auto scaling strategy let's I think 
that's right let's check the notes autoscaling  
strategy that is correct you've got time and 
you've got size and so if you have some jobs that  
take a really long time you can say actually let's 
let's balance based on how long we think it will  
take to empty out the queue instead of balancing 
based on Raw number of jobs so you can change  
that if you want and then down here it's going 
to say how many processes do you want to shift  
at a time in our case we're saying one process 
every 3 seconds and so there's so much here that  
you can configure to match your exact setup and 
you can find the balance between throughput and  
absolutely hammering your server um this is where 
I think Horizon shines the best is putting all of  
this in Version Control and then putting all of 
this behind a single command so you can have 50  
processes but for you to start it all you have 
to do is run PHP Artisan Horizon in fact let's  
go ahead and do that right now so if we run PHP 
Artisan Horizon that's it that's all you have to  
do now it is running under the hood it's running 
up to what did we say 15 plus 5 I think so it's  
running up to 20 processes watching those cues 
for us and this this is the only command that we  
have to keep alive this is it I'm going to show 
you these commands in a second but first let me  
show you configuration from a real app that I've 
worked on so you can see some of the nuances there  
this is the configuration from an app that I 
have worked on you see we have a supervisor  
short supervisor long and the connection one is on 
redis and one is on redis long that makes enough  
sense timeout is 90 timeout is 1,200 and you see 
this one processes the high and the default cues  
and this one processes the long and the scrapers 
cues so these jobs take a whole lot longer and so  
we give it a much longer time out and a and just 
a few fewer processes than the ones that need to  
have a lot higher throughput starting Horizon is 
easy like we just looked at PHP Artisan Horizon  
this is the command that you would um that you 
would want to keep alive if you're running on  
Forge it's a simple toggle you just say keep 
Horizon alive if you're running somewhere else  
you'd need to set up actual supervisor to make 
sure that this stays alive because when this  
command goes down all of your key workers go down 
and in fact you want to roll this you want to  
terminate this gracefully when you are deploying 
a new version of your application you can do that  
by saying PHP Artisan Horizon terminate so you 
send the terminate signal and over here it stops  
and this is really important when you deploy new 
code because this is a long running process it  
is going to put your application in memory and 
so the the last thing you probably want to put  
in your deploy script is Horizon colon terminate 
and then let supervisor bring that back to life  
and it's going to load your new application into 
memory so we'll go ahead and start this again and  
over here I'm just going to run PHP artisan and I 
think it's invite um let's grip for I think it's  
invite yeah PHP Artisan invite users and this 
is going to put a th jobs on the Queue and we  
should start to see that working so this this 
job sleeps for 2 seconds to simulate you know  
calling out to an API or something but you can 
see that we're we're churning through these jobs  
and if we look in the browser if we look in the 
browser you'll see we're running three processes  
on the default and we've got some failed jobs so 
you can click into the failed jobs and see okay  
well this failed to send in fact let me just let 
me just retry that guy and if you click retry from  
the dashboard it's going to put it back in the 
queue and you're going to get um you're going to  
get this the retry down here it shows that it's 
pending it's waiting so let's uh let's go ahead  
and kill let's kill Horizon again and hop back to 
the browser and if we look in the browser you see  
that it is inactive and we're going to come over 
to we're going to come down here to local and  
let's change the max process is to Let's Go Crazy 
let's make it uh let's make it 25 and if we start  
this again I bet those are going to turn through 
a lot faster we see we're now running 25 processes  
and it gives us a little bit it gives us a little 
bit of information about the cues themselves you  
can see we've got 800 700 um jobs in this default 
queue and so this gives you a nice overview of not  
only your cues but also the supervisors that are 
running and if we check back here in local we just  
have the one supervisor so that checks out that 
it's correct and you can see this is just totally  
churning through these jobs now you can check the 
completed jobs to look in there see a little bit  
of information if you have a bunch of jobs that 
you don't want mucking up your completed jobs view  
right here you can add those to silence jobs and 
those won't show up sometimes that's thirdparty  
packages running jobs or um notifications or 
something like that that you don't really care to  
see you can put you can put those in the silenced 
jobs let me show you a few of the Horizon commands  
before we go PHP Artisan Horizon let's start 
with status you can see Horizon is running which  
is good then you can say list and this will show 
all of the machines and the supervisors that are  
running you could also do PHP Artisan supervisors 
and that's going to show you um a little bit more  
detail about each individual supervisor you can 
also pause so if if you're like if your server's  
getting totally hammered by something you can say 
who let's not let's not work with any cued jobs  
at the moment so you can log in or you can ssh 
in pause the workers and everything pauses one  
command and you could potentially pause hundreds 
of workers and then after you fix whatever is  
broken it's not resume it's continue after you 
fix it you can just say all right we're good to  
go back to work people and finally remember the 
one that you want to run when you're deploying is  
PHP aren Horizon terminate there you go and 
Horizon will stop working speaking of it is  
time to terminate this video pretty proud of that 
one um why would you why would you maybe not use  
Horizon I think potentially the best reason to not 
use Horizon is you're using sqs as your as your  
Q driver and therefore you can't use Horizon if 
you're already using redis as your queue driver I  
don't see a good reason not to use it frankly free 
open source first party battle tested extremely  
powerful makes your life extremely convenient 
so give Horizon a try if you want to watch a  
video about Laravel octane in the same style 
I'll put that here until the next time see you
