How to use supervisor to process jobs in Laravel?
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Efficiently Process Laravel Jobs Using Supervisor: A Comprehensive Guide
Introduction: As a developer, you know the importance of handling concurrent tasks efficiently to optimize application performance. With Laravel's powerful queuing system, jobs are distributed among multiple workers running in parallel, ensuring faster processing and reducing bottlenecks. In this article, we'll delve into how to use Supervisor for managing your Laravel queue processes.
1. Understanding Queueing in Laravel: Laravel's built-in queue system uses Redis as the default driver to handle job processing. These jobs are dispatched through a 'push' or 'delayed' mechanism. For more information on this, refer to https://laravelcompany.com/blog/queuing-jobs-with-laravel-5.2 for a detailed explanation.
2. Installing Supervisor: Supervisor is a process management tool designed to ensure that services stay running in the background, restarting them if they crash or stop unexpectedly. Follow these steps:
a. Install Composer and PHP on your system.
b. Run `composer create-project laravel/laravel myapp` to create a new application.
c. Open your Laravel installation's directory, create a folder named 'conf.d', and edit the default files if required.
d. Generate a supervisor configuration file by running `php artisan queue:supervisor`. This will generate a PHP file in the conf.d folder containing information on how to manage the queue processes.
e. Finally, run `supervisorctl update` to load your new configuration.
3. Configuring Supervisor for Laravel Jobs: The default Supervisor configuration may not be suitable for handling jobs in a large-scale application. Here's how we can tweak it:
a. Increase the 'autostart' option value to ensure all processes start when you launch supervisor.
b. Set the 'process_num' parameter to a higher value, such as 20 or 40, to handle a greater number of concurrent jobs.
c. Enable queue monitoring by setting 'logfile_maxbytes=0' and 'logfile_backups=10', reducing storage usage.
d. If your application has multiple queues (default, default_high_priority), consider specifying the queue name in each process definition. This helps separate tasks and better manage resources.
4. Testing Supervisor for Queue Processes: To ensure everything is functioning as expected, perform these steps:
a. Navigate to your Laravel install directory's 'conf.d' folder.
b. Open the generated supervisor configuration file in a text editor.
c. Modify the 'autostart', 'process_num', and other parameters as per your application requirements.
d. Save the file and run `supervisorctl update`, enabling the new settings.
e. Run `php artisan queue:listen` to start listening for jobs with a single worker.
f. Run `supervisorctl status`, ensuring all processes are running as expected.
5. Integrating Supervisor in Production: Once your setup is complete and you've tested it thoroughly, follow these steps for deploying it to production:
a. Copy the updated supervisor configuration file from the local environment to the production server.
b. Update the 'conf.d' folder in the Laravel installation on the server with the new configuration.
c. Restart Supervisor by running `supervisorctl update` or using the respective command for your system (e.g., `sudo service supervisord restart`).
d. Check that all processes are up and running with `supervisorctl status`.
Conclusion: Enabling Supervisor to manage Laravel's queuing system improves application performance by ensuring jobs run seamlessly in the background, even when workers crash or stop unexpectedly. By following these steps and optimizing the configuration as needed, you can efficiently process your application's tasks without any bottlenecks or delays. For further guidance on integrating Supervisor with Laravel and other best practices, refer to https://laravelcompany.com/blog for in-depth articles and tutorials.