Overviewthis MSDN article.
Performance counters can be monitored and logged using the built-in Windows tool Performance Monitor. For more details see this MSDN article. Sense/Net performance counters can be found in the SenseNet category.
Sense/Net has built-in performance counters that you can use to monitor the behavior of the system. The current list of counters:
- Current number of items in the Lucene index gap, which shows the actual size of the Lucene syncronization gap on a given webserver. This number is 0 if there is only one web server present. In normal operation in multi webserver environments it can go up to a two-digit number at maximum, but usually it it zero. Under extremely heavy load it can go up to several thousand, but should go back to zero after the load decreases. If you encounter a constant or constnatly increasing gap, your system is not properly set up.
- Current number of items in the message store (maintained by the system) that were received from MSMQ but not processed yet.
- Incoming messages (see above) plus number of messages that the system is currently processing.
- The value of this counter can be 0 or 1 depending on whether the portal decided to delay requests due to heavy load or not. Usually this is 0.
If you have created custom features (portlets, content handlers, observers, etc) and want to monitor them as wel, you can define custom performance counters that will appear in the SenseNet category as well. Defining a new custom counter is a simple configuration setting as seen in the Configuration section of this wiki page. After you have set up a custom counter, you can use it in you code with simple methods on the CounterManager. Using the counter API, you can increment, decrement, update and reset your counter:
CounterManager.Increment("MyCounter1"); CounterManager.Increment("MyCounter1", longValue); CounterManager.Decrement("MyCounter2"); CounterManager.SetRawValue("MyCounter1", Convert.ToInt64(result)); CounterManager.Reset("MyCounter2");
There is a possibility that an error occurs during counter initialization or incrementing/setting counters (e.g. lack of permissions of the IIS app pool identity or referring to a non-existing counter). In this case the portal logs the event only once, than stops that particular counter that caused the error. This means no calling code will fail because of a counter and only one error or warning message will be added to the event log.
You can switch on or off all performance counters and define your custom counters in the appSettings section in the web.config. By default this feature is ON.
<appSettings> <add key="PerformanceCountersEnabled" value="true" /> <add key="CustomPerformanceCounters" value="MyCounter1;MyCounter2" /> </appSettings>
Please note that this feature currently needs the application pool user to be an administrator because of the necessary access for managing performance counters in the system.
After configuring your custom counter and adding the necessary code lines to your code you should be able to select the counter in Performance Monitor in the SenseNet category. Performance counters are initialized at IIS site startup time.
There are no references for this article.