summaryrefslogtreecommitdiff
path: root/modules/throttle.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-01-23 18:42:43 +0000
committerDries Buytaert <dries@buytaert.net>2004-01-23 18:42:43 +0000
commitb85eb11e113396490720572d11d30cd83c772ba1 (patch)
treec40775ddc2808a40651323d2e35800e5f31305df /modules/throttle.module
parentce803acecb4b695567d77d5219218d5ae2b100f4 (diff)
downloadbrdo-b85eb11e113396490720572d11d30cd83c772ba1.tar.gz
brdo-b85eb11e113396490720572d11d30cd83c772ba1.tar.bz2
Patch 5287 by Stefan: multiline help texts should become inside a single $output.
Diffstat (limited to 'modules/throttle.module')
-rw-r--r--modules/throttle.module47
1 files changed, 28 insertions, 19 deletions
diff --git a/modules/throttle.module b/modules/throttle.module
index 15e8c2e10..c92cddfee 100644
--- a/modules/throttle.module
+++ b/modules/throttle.module
@@ -62,30 +62,39 @@ function throttle_help($section = "admin/help#throttle") {
case "admin/system/modules/throttle":
return t("If your site gets linked to by a popular website, or otherwise comes under a \"Denial of Service\" (DoS) attack, your webserver might become overwhelmed. This module provides a mechanism for automatically detecting a surge in incoming traffic. This mechanism is utilized by other Drupal models to automatically optimize their performance by temporarily disabling CPU-intensive functionality. To use the auto-throttle, the access log must be enabled. It is advised that you carefully read the explainations below and then properly tune this module based on your site's requirements and your webserver's capabilities.", array("%access" => url("admin/system/modules/statistics")));
case "admin/help#throttle":
- $output .= "<h3>Introduction</h3><p>This Drupal module allows you to enable and configure the auto-throttle congestion control mechanism offered by the <a href=\"%statistics-module\">statistics module</a>. The auto-throttle mechanism allows your site to automatically adapt to different server levels.</p>";
- $output .= "<p>This module also adds a block that displays the current status of the throttle. You must have \"<a href=\"%throttle-block\">access throttle block</a>\" privileges to view the block. As a general rule of thumb, only site administrators should be granted access to this block.</p>";
- $output .= "<p>The auto-throttle mechanism performs an extra database query in order to determine what the current throttle level should be. Fortunately the throttle can be tuned so these database queries only occur on a fraction of all pages generated by your site, reducing the overhead to an insignificant amount. Additionally, when the top-most throttle level is reached, all throttle queries are suspended for a configurable period of time. More detail follows.</p>";
- $output .= "<p>As with any module, the throttle module needs to be <a href=\"%modules-enable\">enabled</a> before you can use it. Also refer to the permissions section below if you wish to access the throttle statistics block.</p>";
- $output .= "<h3>Configuring the throttle module</h3><p>The <a href=\"%throttle-config\">configuration section</a> for the throttle allows you to turn it on and off, as well as to fine-tune how sensitive it is.</p>";
- $output .= "<h4>enable auto-throttle:</h4><blockquote>This first option on the throttle module configuration screen allows you to enable or disable the auto-throttling mechanism. Note that the access-log must also be enabled via the <a href=\"%statistics-config\">statistics module</a> for the auto-throttling mechanism to have any effect.</blockquote>";
- $output .= "<h4>auto-throttle multiplier:</h4><blockquote><p>This second option allows you to tune the auto-throttle mechanism. The auto-throttle mechanism supports six throttle levels, from 0 (off) to 5 (maximum). The current throttle level is based upon how many pages have been accessed on your site in the past 60 seconds - the more pages being displayed, the higher the throttle level. This multiplier defines how many hits are required to switch from one throttle level to the next.</p>";
- $output .= "<p>For example, with a throttle multiplier of 20: Once 20 pages have been accessed on your site within a period of 60 seconds, the throttle level will be incremented to a level of 1. Once 40 pages have been accessed on your site within a period of 60 seconds, the throttle level will be incremented to a level of 2. And so on, until 100 pages are accessed on your site within a period of 60 seconds, at which time the throttle level will be set to a maximum level of 5.</p></blockquote>";
- $output .= "<h4>auto-throttle probability limiter:</h4><blockquote><p>This option allows you to minimize the performance impact of the auto-throttle. If we refer to the probability limiter as P, then P% of all pages generated by your site will perform an extra database query to verify that the current throttle level is appropriate to the current server load.</p>";
- $output .= "<p>As a rule of thumb, the higher your multiplier, the lower your probability limiter should be. For example, if you have a multiplier of 100, then you logically don't need to check the throttle level more than once out of every 100 page views, so the probability limiter should be set to 1%. As database queries are \"expensive\", it's recommended that you keep the probability limiter to the smallest percentage possible, while still high enough to react quickly to a change in server load.</p></blockquote>";
- $output .= "<h3>Throttle block</h3><p>This block displays some statistics regarding the current throttle and its configuration. It is recommended that only site administrators receive the \"<a href=\"%throttle-access\">access throttle block</a>\" permission bit required to view this block. It does not display information that would interest a normal site end-user.</p>";
- $output .= "<p>Don't forget to <a href=\"%throttle-block-enable\">enable the block</a>.</p>";
- $output .= "<h3>Permissions</h3><p>This module has one permission that needs to be configured in <a href=\"%permissions\">user permissions</a>.</p>";
- $output .= "<ul><li><i>access throttle block</i> - enable for user roles that get to view the throttle block.</li></ul>";
- $output .= "<h3>For programmers: throttle_status()</h3><p>The function <code>throttle_status()</code> will return a number from 0 to 5. 0 means that there is no throttle enabled at this time. Each number above that is a progressively more throttled system... To disable a feature when a site first begins to get busy, disable it at a throttle of 2 or 3. To hold on to the bitter end, wait until 4 or 5.</p>";
- $output .= "<p>To implement the throttle, you should do something like this:";
- $output .= "<pre>
+ $output .= t("
+ <h3>Introduction</h3>
+ <p>This Drupal module allows you to enable and configure the auto-throttle congestion control mechanism offered by the <a href=\"%statistics-module\">statistics module</a>. The auto-throttle mechanism allows your site to automatically adapt to different server levels.</p>
+ <p>This module also adds a block that displays the current status of the throttle. You must have \"<a href=\"%throttle-block\">access throttle block</a>\" privileges to view the block. As a general rule of thumb, only site administrators should be granted access to this block.</p>
+ <p>The auto-throttle mechanism performs an extra database query in order to determine what the current throttle level should be. Fortunately the throttle can be tuned so these database queries only occur on a fraction of all pages generated by your site, reducing the overhead to an insignificant amount. Additionally, when the top-most throttle level is reached, all throttle queries are suspended for a configurable period of time. More detail follows.</p>
+ <p>As with any module, the throttle module needs to be <a href=\"%modules-enable\">enabled</a> before you can use it. Also refer to the permissions section below if you wish to access the throttle statistics block.</p>
+ <h3>Configuring the throttle module</h3>
+ <p>The <a href=\"%throttle-config\">configuration section</a> for the throttle allows you to turn it on and off, as well as to fine-tune how sensitive it is.</p>
+ <h4>enable auto-throttle:</h4>
+ <blockquote>This first option on the throttle module configuration screen allows you to enable or disable the auto-throttling mechanism. Note that the access-log must also be enabled via the <a href=\"%statistics-config\">statistics module</a> for the auto-throttling mechanism to have any effect.</blockquote>
+ <h4>auto-throttle multiplier:</h4>
+ <blockquote><p>This second option allows you to tune the auto-throttle mechanism. The auto-throttle mechanism supports six throttle levels, from 0 (off) to 5 (maximum). The current throttle level is based upon how many pages have been accessed on your site in the past 60 seconds - the more pages being displayed, the higher the throttle level. This multiplier defines how many hits are required to switch from one throttle level to the next.</p>
+ <p>For example, with a throttle multiplier of 20: Once 20 pages have been accessed on your site within a period of 60 seconds, the throttle level will be incremented to a level of 1. Once 40 pages have been accessed on your site within a period of 60 seconds, the throttle level will be incremented to a level of 2. And so on, until 100 pages are accessed on your site within a period of 60 seconds, at which time the throttle level will be set to a maximum level of 5.</p></blockquote>
+ <h4>auto-throttle probability limiter:</h4>
+ <blockquote><p>This option allows you to minimize the performance impact of the auto-throttle. If we refer to the probability limiter as P, then P% of all pages generated by your site will perform an extra database query to verify that the current throttle level is appropriate to the current server load.</p>
+ <p>As a rule of thumb, the higher your multiplier, the lower your probability limiter should be. For example, if you have a multiplier of 100, then you logically don't need to check the throttle level more than once out of every 100 page views, so the probability limiter should be set to 1%. As database queries are \"expensive\", it's recommended that you keep the probability limiter to the smallest percentage possible, while still high enough to react quickly to a change in server load.</p></blockquote>
+ <h3>Throttle block</h3>
+ <p>This block displays some statistics regarding the current throttle and its configuration. It is recommended that only site administrators receive the \"<a href=\"%throttle-access\">access throttle block</a>\" permission bit required to view this block. It does not display information that would interest a normal site end-user.</p>
+ <p>Don't forget to <a href=\"%throttle-block-enable\">enable the block</a>.</p>
+ <h3>Permissions</h3>
+ <p>This module has one permission that needs to be configured in <a href=\"%permissions\">user permissions</a>.</p>
+ <ul><li><i>access throttle block</i> - enable for user roles that get to view the throttle block.</li></ul>
+ <h3>For programmers: throttle_status()</h3>
+ <p>The function <code>throttle_status()</code> will return a number from 0 to 5. 0 means that there is no throttle enabled at this time. Each number above that is a progressively more throttled system... To disable a feature when a site first begins to get busy, disable it at a throttle of 2 or 3. To hold on to the bitter end, wait until 4 or 5.</p>
+ <p>To implement the throttle, you should do something like this:
+ <pre>
if (module_invoke(\"throttle\", \"status\") >= \$my_throttle_value) {
// my throttle limit was reached, disable stuff
}
else {
// throttle limit not reached, execute normally
- }</pre></p>";
- $output = t($output, array("%statistics-module" => url("admin/statistics"), "%throttle-block" => url("admin/user/permission"), "%modules-enable" => url("admin/system/modules"), "%throttle-config" => url("admin/system/modules/throttle"), "%statistics-config" => url("admin/system/modules/statistics"), "%throttle-access" => url("admin/user/permission"), "%throttle-block-enable" => url("admin/block"), "%permissions" => url("admin/user/permission")));
+ }</pre>
+ </p>", array("%statistics-module" => url("admin/statistics"), "%throttle-block" => url("admin/user/permission"), "%modules-enable" => url("admin/system/modules"), "%throttle-config" => url("admin/system/modules/throttle"), "%statistics-config" => url("admin/system/modules/statistics"), "%throttle-access" => url("admin/user/permission"), "%throttle-block-enable" => url("admin/block"), "%permissions" => url("admin/user/permission")));
break;
}