Performance Counters

From Sense/Net Wiki
Jump to: navigation, search
  • 100%
  • 6.1
  • Enterprise
  • Community
  • Planned


Performance counters
On this wiki page system operators and developers can learn about how to configure and analyze performace counters in Sense/Net. Performance counters can be used to provide information as to how well an application, in our case Sense/Net is performing. Sense/Net performace counters can help determine bottlenecks and fine-tune application performance. For more details about performance counters in general check out this 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.

Built-in counters

Sense/Net has built-in performance counters that you can use to monitor the behavior of the system. The current list of counters:

  • GapSize
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.
  • IncomingMessages
Current number of items in the message store (maintained by the system) that were received from MSMQ but not processed yet.
  • TotalMessagesToProcess
Incoming messages (see above) plus number of messages that the system is currently processing.
  • DelayingRequests
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.

Custom counters

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", longValue);
CounterManager.SetRawValue("MyCounter1", Convert.ToInt64(result));

Error handling

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.

    <add key="PerformanceCountersEnabled" value="true" />
    <add key="CustomPerformanceCounters" value="MyCounter1;MyCounter2" />

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.

Custom counters

Related links


There are no references for this article.