Recording Web events takes time, and you might not like the impact this can have on the response time of your Web pages. Providers that derive from BufferedWebEventProvider support buffering (refer back to Figure 7-2), which in essence lets providers record Web events asynchronously by queuing the Web events in memory as they occur and then letting a background thread do the actual recording. Buffered providers implicitly support two extra attributes in their configuration. The first is "buffer," which specifies whether or not you want to use buffering at all. Note that this attribute is "true" by default on all buffered providers, so you'll need to explicitly add this attribute and set it to "false" if you don't want buffering with, for example, the SQL provider. The second, which must be present if buffering is enabled, is bufferMode. This attribute allows you to choose how big the buffer will be, how often it will be flushed, and so on, by referring to a predefined buffer "mode." Each buffer mode has six attributes that you can adjust, and as of this writing they aren't documented very clearly. Table 7-1 outlines what we've been able to learn about them by studying the code in BufferedWebEventProvider.
There are several of these modes defined in the root web.config file, and you can define others by adding a <bufferModes> section to your application's web.config file. Table 7-2 will help you learn the built-in modes and how they differ.
While it might be tempting to use a more aggressive buffering scheme (such as Logging), you need to consider that when your worker process crashes, you'll lose any buffered messages that haven't yet been flushed to a persistent media. So even if you're only planning on using SqlWebEventProvider, you might actually create two entries in the <providers> element under the <healthMonitoring> section in web.config and choose different buffering strategies, as shown in Listing 7-5 (this example also shows how to log to different databases). You could then register the nonbuffered provider for important events that you can't afford to lose, and the buffered provider for events you're just tracking for statistical analysis. Listing 7-5. Configuring buffering for the SQL provider
|