When running Drupal on multiple servers, it can be useful to offload the cron processing to all or some servers.
If using the wget method for launching cron, this can be done on all servers which will then serve as redundant launchers. You can settle for launching cron on one server, but then you have a single point of failure.

Service groups

A service group is a collection of service hosts and a method for distributing load to these hosts. The default distribution algorithm is to choose a random host. An alternative method for distributing load is implemented in the Background Process Apache Server Status as a proof-of-concept. This method sends the job to the web server with the most idle connections.

Examples

Assuming example.com as the host name, and that the following servers are present in the setup:

Server #1: 192.168.1.2
Server #2: 192.168.1.3
Server #3: 192.168.1.4
Server #4: 192.168.1.5

Service host configuration

To configure the above service hosts, the following is add to settings.php:

<?php
$conf['background_process_service_hosts'] = array(
  'server_1' => array(
    'base_url' => 'http://192.168.1.2',
    'http_host' => 'example.com',
  ),
  'server_2' => array(
    'base_url' => 'http://192.168.1.3',
    'http_host' => 'example.com',
  ),
  'server_3' => array(
    'base_url' => 'http://192.168.1.4',
    'http_host' => 'example.com',
  ),
  'server_4' => array(
    'base_url' => 'http://192.168.1.5',
    'http_host' => 'example.com',
  ),
);
?>

Example 1

The following configuration (in settings.php) will send cron jobs to a randomly selected host in the pool (1, 2, 3, 4).

<?php
$conf['background_process_service_groups'] = array(
  'mycron' => array(
    'hosts' => array('server_1', 'server_2', 'server_3', 'server_4')
  )
);
?>

To use this service group configure each cronjobs to use "mycron" through the "schedule" settings on the cron overview page.

Example 2

The following configuration (in settings.php) will send cron jobs only to server #3 and #4. This is useful if you have a lot of cron jobs and want dedicated servers to process them.

<?php
$conf['background_process_service_groups'] = array(
  'mycron' => array(
    'hosts' => array('server_3', 'server_4')
  )
);
?>

To use this service group for all cron jobs, set the default service group on the Ultimate Cron settings page to "mycron".

You can also configure each cronjobs to use "mycron" through the "schedule" settings on the cron overview page. The setting in the job schedule take precedence over the default service group of course.