Note: This information is only relevant for customers with an on-premise instance.
21.3 comes with a queue component to normalise workloads. The queued jobs are executed by a long running worker process.
Command to start the worker manually:
php /xentral_root_dir/artisan queue:work
Command to stop the worker manually:
php /xentral_root_dir/artisan queue:restart
Note: The command is called “restart” but it will only stop the process.
For more information and command options visit the Laravel Documentation.
Process Control System
You should use a process Control System or process monitor to restart workers when they shut down or crash.
Any system that has the ability to automatically start a process via console command when it is not running will do.
You may define and run a service as the process control system using
systemd on Linux.
Define the service
create a file like
put the configuration in that file
Description=Runs and keeps alive the artisan queue:work process
ExecStart=php /var/www/xentral/artisan queue:work --max-time=3600
/var/www/xentral with the root directory of your xentral installation.
Run the first worker
systemctl start queue_worker@1
# enable service on every boot
systemctl enable queue_worker@1
You may run additional workers by repeating the command with subsequent numbers
systemctl start queue_worker@2
systemctl enable queue_worker@2
systemctl start queue_worker@3
systemctl enable queue_worker@3
You may use
supervisor as process control system to configure the queue process.
Visit the Supervisor Documentation for more information on how to use Supervisor.
command=php /var/www/xentral/artisan queue:work --max-time=3600
Visit the Laravel Documentation for more information on the configuration.
When using a process control system, it is important to regularly stop and restart the worker process. One way to achieve this is by using the following options of the
artisan queue:work command:
--max-jobs=1000- The worker stops after processing certain amount of jobs. More Information
--max-time=3600- The worker stops after a certain amount of time (seconds). More Information
A combination of both options is possible.
Tip: Tinker around with these values as you seem fit according to your experience. E.g. if a worker often exceeds its memory limit, you should consider restarting the workers more often.
Amount of Workers
You may run multiple worker processes at the same time. The amount of worker is controlled differently by different process control systems. For Systemd you need to start several services, Supervisor uses the
Take the following into consideration for the decision on how many workers should run.
How many unprocessed jobs are there?
Queued jobs are stored in the
queue_jobstable. When the jobs become too many you may add more workers.
More workers working jobs leads to higher CPU and RAM usage and might affect the response-time of the application.