Autothrottling blocks

In Drupal 4.4 and higher (or the latest CVS version), it is possible to configure blocks to be automatically disabled when the auto-throttle reaches a maximum level of 5, indicating that your site is currently experiencing a severe load. This could happen for a number of reasons, such as a link from Slashdot, or being indexed by sometimes over-aggressive googlebots, or even an intentional DoS (Denial of Service) attack. Under these heavy loads, you may find your site choking, usually reporting a MySQL error saying something like "Too many connections". By automatically disabling blocks, the cost of generating pages on your site will require less database queries and thus your site will be able to better withstand a greater number of hits.

To throttle blocks go to the block administration page on your site at "administer > configuration > blocks". Now, for any blocks that should be disabled when your site is under a severe load click the "throttle" checkbox. It is recommended that you select nearly all boxes, except perhaps "Navigation" and "User login", as it will be rare that the auto-throttle actually causes them to be temporarily disabled. If you have an especially under-powered webserver, you may even wish to enable the throttle for the "User login" block so that users will be discouraged from logging in under heavy loads, as each page viewed by a user has to be dynamically built rather than displaying them from the cache.

Now, when your site comes under a heavy load, all blocks that have "throttle" enabled will be automatically disabled. As long as your site remains under a severe load, the blocks will remain disabled, optimizing your page and helping to prevent your database from choking. When the load starts to decline, the blocks will be automatically restored.

Was this article helpful?

0 0

Post a comment