Home > Technical Support > Downloadable licences > High performance tweaks > How to speed up the background tasks' execution using parallel cron processes

How to speed up the background tasks' execution using parallel cron processes

LiveAgent background tasks are executed by jobs.php started by cron. Even if you set cron to execute jobs.php every minute, the interval might still be too long for some operations (e.g. mass actions).

Fortunately the background tasks are thread safe and it is possible to run jobs.php in parallel by adding multiple cron entries. If however you just add the same entries multiple times to crontab, all the jobs.php processes would start at the same moment.

A better solution is to start 1 jobs.php process every 10 seconds instead of all at the same time every minute. To achieve this, you would configure the crontab like this:

* * * * * /usr/bin/php -q /var/www/liveagent/scripts/jobs.php  
* * * * * (sleep 10 ; /usr/bin/php -q /var/www/liveagent/scripts/jobs.php)
* * * * * (sleep 20 ; /usr/bin/php -q /var/www/liveagent/scripts/jobs.php)
* * * * * (sleep 30 ; /usr/bin/php -q /var/www/liveagent/scripts/jobs.php)
* * * * * (sleep 40 ; /usr/bin/php -q /var/www/liveagent/scripts/jobs.php)
* * * * * (sleep 50 ; /usr/bin/php -q /var/www/liveagent/scripts/jobs.php)

This will start all 6 processes at the same time, but process 2 to 6 will sleep for the configured number of seconds before executing jobs.php.

Ready to try LiveAgent?

It's free for the first 14 days! No credit card required.

Get Started
We work well with others...
Magento Joomla Wordpress Mailchimp
Contact us

support@liveagent.com

+1-800-811-6590 (Toll Free in USA & Canada)

+421 2 33 456 826 (European Union & Worldwide)

Quality Unit, LLC 616 Corporate Way, Suite 2-3278 Valley Cottage, NY 10989

Stay in touch
Blog Google+
© 2004-2020 LiveAgent.com, All rights reserved