Laravel package replaces guesswork worker counts with queueing theory math
A developer has released two open-source Laravel packages — laravel-queue-autoscale and laravel-queue-metrics — that automatically calculate and adjust queue worker counts based on a defined SLA target rather than a hardcoded number. The formula draws on Little's Law, a 1961 queueing theory principle, to derive the exact number of workers needed to process pending jobs within a specified time window. In testing with 3,000 jobs dispatched simultaneously against a 10-second SLA, the autoscaler dynamically scaled workers from 1 up to a configured cap of 16, clearing the backlog in around 35 seconds. A built-in circuit breaker prevents runaway scaling during failure storms — when a simulated payment provider outage caused 100% job failures, the manager held workers at the minimum instead of spawning hundreds of processes. The project is currently maintained by a single developer, requires PHP 8.4+ with ext-pcntl and ext-posix, and is not compatible with Windows environments.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in