Split Your Worker Tier Before the Queue Takes Down Your Web Server
Running workers and web on the same VM is fine until it isn't. Here's how I know when to split them and how I actually do it.
The single-VM setup is not a mistake. I run a lot of client apps on a single well-specced Linode or DigitalOcean box and they hum along fine for years. But there is exactly one failure mode that has bitten me more than once: queue pressure bleeding into web request latency until the whole box falls over. This post is about recognizing that signal early and making the split before you're doing it at 2am.
Why Single-VM Works Until It Doesn't
On a single VM you're running nginx, PHP-FPM, Supervisor (which manages your queue workers), Redis or a database-backed queue, and probably cron. Under normal load these coexist peacefully. Workers idle between jobs. FPM handles requests. Everyone shares CPU and memory without fighting.
The problem is workers don't throttle themselves based on system load. Supervisor will happily spin up all eight of your worker processes and run them at 100% CPU while your PHP-FPM pool is trying to serve web requests to real users. I watched this happen on a print management platform I built for a client a few years back. A bulk order import triggered a cascade of jobs - image processing, PDF generation, inventory updates. The queue depth hit a few thousand, all eight workers pegged the CPU, and web response times went from 80ms to 8 seconds inside of two minutes. Same machine, shared resources, no isolation.
The fix that day was supervisorctl stop laravel-worker:*. That's not a fix. That's a panic button.
The Signal You're Looking For
Before you split infrastructure, you need to know whether you actually have a problem or whether you're over-engineering a quiet app.
I look at three things:
CPU steal and sustained load. On a shared VM, CPU steal above 5-10% consistently means you're contending. On dedicated metal or a high-CPU VPS, watch htop during your heaviest queue bursts. If workers regularly push load average above your vCPU count, web requests are waiting.
FPM queue depth. php-fpm has a listen.backlog and a pm.max_children ceiling. When workers eat all available CPU, FPM children stall mid-request. Add this to your monitoring:
# quick spot check - connections waiting on fpm
ss -tlnp | grep php
# or parse the fpm status page if you've enabled it
curl -s http://127.0.0.1/fpm-status | grep 'listen queue'
If listen queue is non-zero with any regularity, you're already losing web requests to worker pressure.
Job throughput vs. queue depth ratio. If your queue depth is growing faster than workers are consuming it during peak hours, you need either more workers or a faster machine - and adding more workers on a shared box makes the web problem worse, not better.
My rule of thumb: if two or more of these indicators are red at the same time, the split pays for itself in reliability before it pays for itself in raw cost.
How I Actually Do the Split
I keep the web server on the existing VM and spin up a second, usually smaller, instance dedicated to workers. Here is the actual approach.
Step 1: The worker VM needs access to your queue backend and your storage.
If you're on Redis, open the Redis port (or use a private network/VPC) so the worker VM can connect. If you're using database queues (fine for lower volume), just give the worker VM read/write access to the database. For file storage, I move to S3-compatible object storage at this point if I haven't already - shared NFS between two VMs is a headache I'd rather skip.
Step 2: Deploy the same app codebase to the worker VM.
I use the same deployment pipeline. The worker VM runs the full Laravel app but nginx and FPM are either not installed or not running. It exists solely to run php artisan queue:work.
# /etc/supervisor/conf.d/laravel-worker.conf on the worker VM
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/app/artisan queue:work redis --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=16
redirect_stderr=true
stdout_logfile=/var/log/supervisor/worker.log
stopwaitsecs=3600
Note numprocs=16 - on a worker-only VM I can run as many processes as the job type warrants without worrying about starving web requests. On the old shared VM I'd cap this at 4 or 6 out of caution.
Step 3: Lock down what runs where.
On the web VM, stop all Supervisor worker processes:
supervisorctl stop laravel-worker:*
# and remove or disable the supervisor conf so they don't restart on reboot
On the web VM, cron stays. Scheduler stays. php artisan queue:work goes away.
Step 4: Handle the queues you actually have.
Most apps I work on have more than one queue. High-priority stuff (sending a password reset email, completing a payment webhook) should not sit behind a pile of bulk export jobs. I use named queues:
// dispatching with priority
SendPasswordReset::dispatch($user)->onQueue('high');
ExportReportToCsv::dispatch($reportId)->onQueue('low');
And on the worker VM, Supervisor runs two pools:
[program:laravel-worker-high]
command=php /var/www/app/artisan queue:work redis --queue=high,default --sleep=1 --tries=3
numprocs=4
[program:laravel-worker-low]
command=php /var/www/app/artisan queue:work redis --queue=low --sleep=5 --tries=3
numprocs=12
This way bulk jobs can't starve time-sensitive ones, and you can tune the pool sizes independently.
Gotchas That Will Bite You
Environment variables. The worker VM needs its own .env with the right APP_KEY, database credentials, Redis host, storage config, mail config, everything. I've had workers silently fail because someone updated a secret on the web server and forgot the worker node. I solve this with a secrets manager (AWS Parameter Store or even just Ansible Vault) that both VMs pull from during deploy. Manual .env syncing between servers is a liability.
Horizon vs. bare Supervisor. If you're running Laravel Horizon, the dashboard runs as a web route and the actual worker management is handled by the horizon Supervisor config. The dashboard should live on the web VM. The workers still run on the worker VM, but Horizon's config needs to point its processes there, and the web VM's Horizon process is just the supervisor/dashboard - not a worker. Read the Horizon docs on this carefully; it's not obvious.
Job timeouts and stopwaitsecs. If your jobs can run for up to 10 minutes, your stopwaitsecs in Supervisor needs to be longer than that or you'll kill jobs mid-flight on deploy. I've seen partial PDF renders and corrupted CSV exports from a Supervisor that killed workers before they finished. Set stopwaitsecs to your max expected job duration plus 30 seconds of buffer.
Health checks and alerting. A worker VM with a dead Supervisor process is a silent failure. The queue depth grows and nobody notices until a client calls. I add a simple health check: a cron job on the worker VM that fires every 5 minutes, checks queue depth via php artisan queue:monitor, and sends an alert if any queue exceeds a threshold.
// in app/Console/Kernel.php
$schedule->command('queue:monitor redis:high=50,low=500')
->everyFiveMinutes()
->emailOutputOnFailure('ops@example.com');
Laravel's built-in queue:monitor command will exit with a non-zero code if thresholds are exceeded, which makes it easy to hook into Envoyer, OpsGenie, or even a plain cron-based alerter.
When I'd Reach for This (and When I Wouldn't)
I'd split the worker tier when: jobs are I/O or CPU heavy (image processing, PDF generation, report exports, bulk API calls), when job volume is unpredictable or spiky, or when I have clients where a slow web response is a support ticket.
I wouldn't split it for: a simple transactional app where the heaviest job is sending a welcome email, apps where infrastructure budget is genuinely constrained and the queue is quiet 95% of the time, or early-stage projects where the operational overhead of two VMs isn't worth it yet.
There's also a middle ground I use sometimes: keeping everything on one VM but pinning workers to specific CPUs using taskset and setting their nice priority higher, so they lose CPU contention to FPM automatically. It's a band-aid, not a solution, but it buys time before you need to pay for a second VM.
# run workers at lower priority so web requests win CPU contention
# in the supervisor command:
command=nice -n 10 php /var/www/app/artisan queue:work redis --sleep=3 --tries=3
That one change, combined with reducing numprocs, saved a client's site for three weeks while we planned the proper split.
The Bottom Line
The single-VM architecture is a rational starting point - I'm not here to tell you that you need Kubernetes because your app sends a few hundred emails a day. But queue pressure is insidious because it degrades quietly and then collapses fast, and the fix always looks obvious in hindsight. Splitting the worker tier is a half-hour of infrastructure work and usually costs $20-40/month for a small worker node. Do it before you need to, not during an incident.
Need help shipping something like this? Get in touch.