Throttling and Profiles


While buffering can help flatten out the load from Web events generated in bursts, not all providers support buffering, and those that do have finite limits on the size of their buffers. To help control noise and mitigate potential attacks against the health monitoring system, you can turn on throttling and coalesce or discard events that are occurring too often. Throttling is controlled via the three optional attributes on a rule shown in Table 7-4.

Table 7-4. Throttling attributes

Attribute

Description

minInstances

A given event will only be sent to the provider if the same event has occurred this many times. This feature allows you to coalesce noisy events so that they don't show up so often in the log. The default value is 1, which effectively turns off this feature.

minInterval

A given event will only be sent to the provider if the same event has not already been sent within this time interval. Similar in spirit to minInstances, this is a time-based solution for coalescing noise. The default is 0, which effectively turns off this feature.

maxLimit

Only records the first N instances of a given event. The default is "Infinite," which turns off this feature.


To make it easy to reuse a set of throttling parameters on many different rules, you can factor these three attributes into a health monitoring profile[5] and then refer to that profile from your rules. The root web.config already defines two profiles (shown in Listing 7-8) or you can define your own.

[5] Don't confuse this with the state management profiles discussed in Chapter 4. They are different animals altogether.

Listing 7-8. Using health monitoring profiles

<!-- excerpt from root web.config file that ships with ASP.NET 2.0 --> <healthMonitoring>   <!-- ... -->   <profiles>       <add name="Default"            minInstances="1"            maxLimit="Infinite"            minInterval="00:01:00"            custom="" />       <add name="Critical"            minInstances="1"            maxLimit="Infinite"            minInterval="00:00:00"            custom="" />   </profiles> </healthMonitoring> <!-- web.config file that enables throttling      using the "Default" profile --> <healthMonitoring enabled="true">   <!-- ... -->   <rules>     <add name="Send a copy of all events to the statistics database"          eventName="All Events"          provider="StatisticsSqlProvider"          profile="Default"/>   </rules> </healthMonitoring> 

While you might not turn on throttling to begin with, it's good to know that it's there and that an administrator can turn it on in case of an attack or to eliminate excess noise.




Essential ASP. NET 2.0
Essential ASP.NET 2.0
ISBN: 0321237706
EAN: 2147483647
Year: 2006
Pages: 104

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net