In Laravel, you can specify the maximum number of workers for a queue by setting the --max-workers
option when running the queue:work
command.
To specify the maximum number of workers, open your terminal or command prompt and navigate to the root directory of your Laravel project. Then, run the following command:
php artisan queue:work --max-workers=5
In the above command, --max-workers=5
sets the maximum number of workers to 5. You can replace 5
with your desired number of workers.
When you run this command, Laravel will spin up the specified number of worker processes to process the jobs in the queue. If the number of jobs in the queue exceeds the maximum number of workers specified, the excess jobs will wait in the queue until a worker becomes available.
Note that the maximum number of workers you can specify depends on the resources available on your server.