How to Determine Healthy Laravel Queues
Learn how to determine healthy Laravel queues. Understand how to take a look at Horizon to see if something weird is happening. Discover a new interesting package that helps you solve the problem and a visualization that makes it easy to see.
Freek Van der Herten ๐ญ
PHP developer at @spatie_be, built @getmailcoach, https://t.co/IRUtuG0FwZ, @ohdearapp and @flareappio, blogging at https://t.co/a3spVy88VN, organising @fullstackeu
-
Let's talk a bit about how you can determine that your #laravel queues are healthy!
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023
At the end of this thread, I'll share a new interesting package that helps you solve the problem!
๐งต Let's dive in! #laravel #php -
๐ค Take a look at this screenshot of Horizon. Are those numbers health for my app? To answer this question, more than simple point-in-time numbers are needed. pic.twitter.com/AVIUQ8Xkox
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023 -
๐ For @OhDearApp we use Prometheus / Grafana to visualise the amount of jobs on the queue. On this graph, every coloured line is a queue. (I've removed the legend with queue names and job count to not give too much away about our operations) pic.twitter.com/NXJRpKVKpE
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023 -
A visualization like this makes it easy to see if something weird is or is happening. Here's a screenshot of our queues, but this time for the past 12 hours. You can see that something was off around 11 am. pic.twitter.com/KnwsHkKFTl
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023 -
Let's also take a look at a scale of 7 days. In this screenshot, you can again see the breathing rhythm of our queues. pic.twitter.com/VlIK6yu0fF
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023 -
Plotting out the historical load on Horizon gives us a good picture of the health of the queues. Of course, these graphs aren't everything. You still need a monitoring solution like @flareappio to detect any exceptions that happen inside the jobs.
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023 -
Now, to easily export your horizon metrics (and your own custom metrics to Prometheus / Grafana), we've released a new package called Laravel Prometheus
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023
๐ The docs are here: https://t.co/MUMjjCAnHb pic.twitter.com/34mAX100q2 -
๐ The docs don't only contain instructions on how to use the package, but also a guide on how to export data to https://t.co/bypXEp5hg2 / self-hosted grafana / https://t.co/tFLIgtvsdY server pic.twitter.com/SMNm77ukc3
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023 -
โ๏ธ I've also written a nice and clear blog post that guides you through all of this: https://t.co/EYvIuAvnKj
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023
๐งโ๐ป I've also prepared a little demo app that you can use to follow along with the blog post: https://t.co/dY0v4dG0TF -
๐ Prometheus / Grafana are insanely powerful tools! They could be a bit daunting to set up on your own, but I hope our package / blog post will help you take your first steps!
— Freek Van der Herten ๐ญ (@freekmurze) June 13, 2023