optimization

Incorporating Drupal's Throttle Module into Your Code

To make your code safer to run on servers with high load conditions, you should prioritize its functionality into two categories: mission critical and non-critical. The Throttle module allows you to test the current server load conditions using the following code snippet:

$is_throttled = module_invoke('throttle', 'status');
if (!$is_throttled) {
  // the site is not being throttled
  // execute non-critical functionality
}

This way you can lessen the server's burden when traffic spikes, conserving valuable resources for your customers.

Syndicate content