Process background jobs queued by your application.
Feature | Queue Clusters | Worker Clusters | App Cluster Background Processes |
---|---|---|---|
Queue Isolation | Fully dedicated to specific queues | Shared with other background processes | Shared with background processes and web traffic |
Auto-scaling | Intelligent scaling based on job latency | CPU/RAM based scaling | CPU/RAM based scaling |
php artisan queue:work
in a fully isolated cluster whose sole purpose is running and intelligently scaling queue worker processes. Queue clusters do not compete with your application’s web traffic or other scheduled tasks for resources.
Learn more about queue clusters
php artisan queue:work
in a cluster separated from web traffic, but worker clusters can also manage additional scheduled tasks and custom background processes that compete for cluster compute. Worker clusters scale based on CPU/RAM rather than queue depth and latency.
Learn more about creating worker clusters
php artisan queue:work
in an all-in-one cluster alongside your web application. Cost-effective but queues compete with web traffic for resources.
queue:work
processes within the given configuration that you would like to create. Finally, save and deploy your environment changes to start your queue worker.
queue:work
process configured with 10 processes
, would create 50 processes total. Smaller compute instances may consume excess memory through these additional workers, potentially creating unnecessary replica scaling.queue:work
processes within the given configuration that you would like to create. Finally, save and deploy your environment changes to start your queue worker.
queue:restart
Artisan command after each deployment.queue:work
processes, Laravel Cloud also allows you to configure arbitrary long-lived custom background processes, such as Laravel Horizon.
To get started, click on a compute cluster within your environment’s infrastructure canvas dashboard. Then, within the “Background processes” section of your cluster settings, click “New background process”.
Next, click the “Custom worker” tab and provide your custom worker command and the number of instances of the command that should be started. For instance, for Laravel Horizon, you should provide the php artisan horizon
command and specify that Laravel Cloud should create 1
process.