The Task Queue System in cPanel & WHM
For WHM version 11.30
Events in cPanel & WHM often cause one or more services to restart. For example, adding a subdomain causes a restart of Apache and the nameserver daemon.
On busy servers, such restart requests can degrade the quality of service.
To handle these requests, cPanel & WHM includes a task queueing and processing system. Subsystems that are aware of the task queue submit their requests to it, rather than directly issuing the restart (or other request).
A benefit of the task queue system is that multiple instances of an outstanding request are handled as a single action. This improves server response time.
Task Queue-Aware Functions
The system queues requests made by the following functions in cPanel & WHM:
- Apache-related functions in Tweak Settings (WHM)
- Create a New Account (WHM)
- Modify Account Properties (WHM)
- Terminate an Account (WHM)
- Upgrade/Downgrade an Account (WHM)
- Change Site's IP Address (WHM)
- Copy an account from another server (Transfers area in WHM)
- Add or remove an addon domain (Addon Domains area in cPanel)
- Create or remove a subdomain (Subdomains area in cPanel)
- Create or remove a parked domain (Parked Domains area in cPanel)
How Task Queueing Works
There are two aspects of the task queueing system:
- the queueing mechanism
- the queue processor
The Queueing Mechanism
Queueing of tasks is handled via the
script, which has the following usage:
/usr/local/cpanel/bin/servers_queue [queue $command] [unqueue $task_id]
parameter requires a command string as an argument. The command string should be quoted. For example:
root@example [~]# /usr/local/cpanel/bin/servers_queue queue 'apache_restart'
Only commands known to the task queueing system are accepted. If you provide an unknown command, the system returns an error. For example:
root@example [~]# /usr/local/cpanel/bin/servers_queue queue 'buildapacheconf'
ERROR: No known processor for 'buildapacheconf'. at /usr/local/lib/perl5/site_perl/5.8.8/
parameter requires a task ID number. This number is output when you queue a task. You can also find it by examining the
root@pxe [~]# /usr/local/cpanel/bin/servers_queue queue 'apache_restart'
root@pxe [~]# /usr/local/cpanel/bin/servers_queue unqueue TQ:TaskQueue:8
1 tasks unqueued
The Queue Processor
Queued tasks are stored in YAML files in
The task queue is processed periodically by the
daemon. This daemon resides in
and is prompted by the cPanel startup process. You can manage it using
. This daemon is monitored by