Laravel Queue Autoscale
Intelligent, predictive autoscaling for Laravel queues with SLA/SLO-based optimization using queueing theory and trend analysis.
SLA-driven, not threshold-driven
Most autoscalers react to queue depth thresholds. When the queue grows past 100 jobs, add workers. When it drops below 10, remove them. This is backwards. You do not care about queue depth. You care about how long jobs wait before a worker picks them up.
Laravel Queue Autoscale lets you define SLA targets: "jobs on the default queue should start processing within 30 seconds." The autoscaler uses queueing theory to calculate exactly how many workers are needed to meet that target, and adjusts proactively before demand spikes.
Intelligent Scaling
Little's Law
Calculates steady-state worker requirements using L = λW. Given the arrival rate and target wait time, the math tells you the exact worker count.
Trend Prediction
Detects increasing arrival rates and scales proactively before demand causes SLA breaches. No more waiting for the queue to overflow.
Backlog Drain
When an SLA breach is imminent or already happening, aggressive scaling kicks in to drain the backlog within the target time window.
Resource Awareness
Integrates with System Metrics to respect container CPU and memory limits. Will not scale beyond what the host can handle.
Per-Queue SLAs
Different queues can have different SLA targets. Payments might need 5-second pickup, while email can tolerate 60 seconds.
Graceful Shutdown
Workers receive SIGTERM and get time to finish their current job before SIGKILL. No interrupted jobs or lost work.
How the algorithm works
The autoscaler runs three algorithms in parallel and takes the maximum recommendation. Little's Law provides the steady-state baseline. Trend prediction catches rising demand before it hits. Backlog drain handles emergency situations. The max() of all three ensures SLA compliance under all conditions.
Dry-run mode
Run the autoscaler in evaluation mode to see what it would do without actually scaling workers. Perfect for tuning SLA targets before going live.