This site is archived.
Skip to Content

Multi-threaded cron jobs with Cron MT

Your session in a few words: 
Multi-threaded cron jobs with Cron MT
Track: 
Code it, test it, deploy it
Session Type: 
Lecture
Level of expertise: 
Intermediate
Language: 
English

PHP scripts typically run as a single build-up tear-down process. This is problematic when running batch operations, such as the Drupal cron run. For larger sites, cron will often time out or run out of memory thus failing to complete all maintenance tasks. Cron MT increases efficiency and reliability by utilizing PHP's "Process Control" extension available to Unix-like platforms. By forking the cron process a configurable number of times, Cron MT is able to execute each hook_cron() implementation in parallel allowing the system to distribute the load across its multiple CPUs. In addition to increasing efficiency, Cron MT eliminates the Achilles' heel of the Drupal cron run since a hangup in one hook_cron() implementation will not prevent the others from being run.

In this session, I will briefly explain how to install and configure the module so that attendees can use it on their sites. I will then give a technical overview of the Process Control extension and how it is used in Cron MT. To conclude, I will discuss the limitations of the Process Control extension as it applies to the Drupal environment, and I will discuss the areas in which Drupal may benefit from multi-threaded programming.

I hope to inspire attendees to use Multi-Threaded techniques in their code so that Drupal can compete in environments outside of the webspace that are normally reserved for other traditional programming languages.