Executive Summary: Deep dive into Redis, Laravel Horizon, and optimizing worker processes for high-volume tasks.
If your application responds slowly to users, you are likely doing synchronous work that should be deferred. Sending emails, calling third-party APIs, and generating PDFs must happen in the background.
### Configuring Horizon
Laravel Horizon provides a beautiful dashboard to monitor Redis queues. To maximize throughput, configure your `horizon.php` to scale workers dynamically:
```php
'production' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default', 'emails', 'webhooks'],
'balance' => 'auto',
'minProcesses' => 1,
'maxProcesses' => 20,
'memory' => 128,
'tries' => 3,
],
],
```
Horizon will automatically spin up more processes when the queue gets backed up, and scale down to save CPU when idle.