Skip to content
March 17, 2011 / kiranpatils

All about Sitecore performance counters — A real hero

Challenge:

Since couple of days we are working on performance stuff. And during this time we found a real hero. Sitecore Performance counters.

Solution:

Sitecore performance counters can provide you counter values like How many Items got accessed? How many PhysicalReads/Writes happened? How many CacheHits/Missed happened? and list goes on. You can have a look at below list for all Sitecore counters along with their descriptions [Please note as per my knowledge this list is exclusively provided by this blog only, I haven’t found this list on any blog/sdn site]:

Performance object

Counter

Counter Description

Sitecore.Caching CacheClearings Total number of times that an instance of a cache has been cleared.
Sitecore.Caching CacheHits Total number of cache hits for all caches.
Sitecore.Caching CacheMisses Total number of cache hits for all caches.
Sitecore.Caching CredentialCacheClearings Total number of times that an instance of a credential cache has been cleared.
Sitecore.Caching CredentialCacheHits Total number of cache hits for all credential caches.
Sitecore.Caching CredentialCacheMisses Total number of cache hits for all credential caches.
Sitecore.Caching DataCacheClearings Total number of times that an instance of a data cache has been cleared.
Sitecore.Caching DataCacheHits Total number of cache hits for all data caches.
Sitecore.Caching DataCacheMisses Total number of cache hits for all data caches.
Sitecore.Caching DataSourceCacheClearings Total number of times that an instance of a data source cache has been cleared.
Sitecore.Caching DataSourceCacheHits Total number of cache hits for all data source caches.
Sitecore.Caching DataSourceCacheMisses Total number of cache hits for all data source caches.
Sitecore.Caching HtmlCacheClearings Total number of times that an instance of a html cache has been cleared.
Sitecore.Caching HtmlCacheHits Total number of cache hits for all html caches.
Sitecore.Caching HtmlCacheMisses Total number of cache hits for all html caches.
Sitecore.Caching PathCacheClearings Total number of times that an instance of a path cache has been cleared.
Sitecore.Caching PathCacheHits Total number of cache hits for all path caches.
Sitecore.Caching PathCacheMisses Total number of cache hits for all path caches.
Sitecore.Caching RegistryCacheClearings Total number of times that an instance of a registry cache has been cleared.
Sitecore.Caching RegistryCacheHits Total number of cache hits for all registry caches.
Sitecore.Caching RegistryCacheMisses Total number of cache hits for all registry caches.
Sitecore.Caching ViewStateCacheClearings Total number of times that an instance of a view state cache has been cleared.
Sitecore.Caching ViewStateCacheHits Total number of cache hits for all view state caches.
Sitecore.Caching ViewStateCacheMisses Total number of cache hits for all view state caches.
Sitecore.Caching XslCacheClearings Total number of times that an instance of a xsl cache has been cleared.
Sitecore.Caching XslCacheHits Total number of cache hits for all xsl caches.
Sitecore.Caching XslCacheMisses Total number of cache hits for all xsl caches.
Sitecore.Data Data.ClientDataReads The total number of client data values that have been read.
Sitecore.Data Data.ClientDataWrites The total number of client data values that have been written.
Sitecore.Data Data.ItemsAccessed The total number of items that have been accessed.
Sitecore.Data Data.PhysicalReads The total number of read operations that have been performed against the physical storage medium (typically a RDBMS).
Sitecore.Data Data.PhysicalWrites The total number of write operations that have been performed against the physical storage medium (typically a RDBMS).
Sitecore.Data Globalization.TextsTranslated The total number of texts that have been translated.
Sitecore.Data Globalization.TranslateFailed The total number of times a translate operation has failed (ie. the text was not in the dictionary).
Sitecore.Data Links.FieldsExamined The total number of fields that have been scanned for links.
Sitecore.Data Links.DataRead The total number of read operations that have been performed against the link database.
Sitecore.Data Links.DataUpdated The total number of update operations that have been performed against the link database.
Sitecore.Data Packager.PackagesBuilt The total number of packages that have been built.
Sitecore.Data Packager.PackagesInstalled The total number of packages tahe have been installed.
Sitecore.Data Shadows.DataRead The total number of read operations that have been performed against the shadows database.
Sitecore.Data Shadows.DataUpdated The total number of update operations that have been performed against the shadows database.
Sitecore.Data SqlServerStream.OpenStreams The number of concurrent open streams from SQL Server.
Sitecore.Data StreamSharer.OpenStreams The number of concurrent shared media streams.
Sitecore.Data Workflow.ActionsExecuted The total number of workflow actions that have been executed.
Sitecore.Data Workflow.SecurityResolved The total number of times the workflow engine has resolved an access request.
Sitecore.Data Workflow.StateChanges The total number of times that a workflow has changed state.
Sitecore.Jobs Jobs.JobsExecuted The total number of jobs that have been executed.
Sitecore.Jobs Pipelines.PipelinesAborted The total number of times a pipeline was aborted.
Sitecore.Jobs Pipelines.PipelinesExecuted The total number of times a pipeline was executed.
Sitecore.Jobs Pipelines.ProcessorsExecuted The total number of processors that have been executed.
Sitecore.Jobs Publishing.FullPublishings The total number of times a full publishing operation has been performed.
Sitecore.Jobs Publishing.IncrementalPublishings The total number of times an incremental publishing operation has been performed.
Sitecore.Jobs Publishing.ItemPublishings The total number of times an item publishing operation has been performed.
Sitecore.Jobs Publishing.ItemsExamined The total number of items that have been examined as candidates for publishing.
Sitecore.Jobs Publishing.ItemsPublished The total number of items that have been published to the web site.
Sitecore.Jobs Publishing.ItemsQueued The total number of items that have been queued for publishing.
Sitecore.Jobs Publishing.Replacements The total number of publishing replacement operations that have been performed.
Sitecore.Jobs Publishing.SmartPublishings The total number of times a smart publishing operation has been performed.
Sitecore.Jobs Publishing.TotalPublishings The total number of publishings that have been performed.
Sitecore.Jobs Tasks.FileCleanups The total number of times the CleanupAgent task has been run.
Sitecore.Jobs Tasks.HtmlCacheClearings The total number of times the HtmlCacheClearAgent task has been run.
Sitecore.Jobs Tasks.ItemsArchived The total number of items that have been archived.
Sitecore.Jobs Tasks.Publishings The total number of times the PublishAgent task has been run.
Sitecore.Jobs Tasks.RemindersSent The total number of reminders that have been sent.
Sitecore.Jobs Tasks.TasksExecuted The total number of tasks that has been run.
Sitecore.Presentation Context.SiteChanged The total number of times the active site has been changed by the API.
Sitecore.Presentation Context.ThreadDataAccessed The total number of times the local thread data has been accessed.
Sitecore.Presentation Media.FastMediaCacheHits Not used in CMS 6 and later. Total number of cache hits for fast media cache.
Sitecore.Presentation Media.FastMediaCacheMisses Not used in CMS 6 and later. Total number of cache misses for fast media cache.
Sitecore.Presentation Media.StandardMediaCacheHits Not used in CMS 6 and later. Total number of cache hits for standard media cache.
Sitecore.Presentation Media.StandardMediaCacheMisses Not used in CMS 6 and later. Total number of cache misses for standard media cache.
Sitecore.Presentation Media.CacheHits Total number of cache hits for media cache.
Sitecore.Presentation Media.CacheMisses Total number of cache misses for media cache.
Sitecore.Presentation Rendering.ControlsRendered The total number of Sitecore controls rendered.
Sitecore.Presentation Rendering.ControlsRenderedFromCache The total number of Sitecore controls rendered from a cache.
Sitecore.Presentation Rendering.PagesGenerated The total number of web pages generated by Sitecore.
Sitecore.Presentation Rendering.RenderingsRendered The total number of Renderings rendered.
Sitecore.Presentation Rendering.SublayoutsRendered The total number of Sublayouts rendered.
Sitecore.Presentation Rendering.XmlControlsCompiled The total number of XmlControls compiled.
Sitecore.Presentation Rendering.XslTransformsRendered The total number of XslTransforms rendered.
Sitecore.Presentation Rendering.XamlControlsCompiled The total number of XAML compiled controls.
Sitecore.Security AccessDenied The total number of access requests that have been denied.
Sitecore.Security AccessGranted The total number of access requests that have been granted.
Sitecore.Security AccessResolved The total number of access requests that have been resolved.
Sitecore.Security CredentialCacheHits The total number of security rquests that have been resolved using a credential cache.
Sitecore.Security CredentialCacheMisses The total number of security rquests that could not be resolved using a credential cache.
Sitecore.Security ModifyRequests The total number of access requests where the desired access would allow the caller to modify data (ie. update or delete an item).
Sitecore.Security ProgrammaticDisabling The total number of times that security has been programmatically disabled (using SecurityDisabler).
Sitecore.Security ProgrammaticEnabling The total number of times that security has been programmatically enabled (using SecurityEnabler).
Sitecore.Security ProgrammaticUserSwitch The total number of times that the current user has been switched programmatically (using SecuritySwitcher).
Sitecore.Security ReadRequests The total number of access requests where the desired access would allow the caller to read data (ie. reading an item).
Sitecore.Security UsersResolved The total number of users that have been resolved.
Sitecore.Security RolesResolved The total number of roles that have been resolved.
Sitecore.Security VirtualUsersBuilt The total number of virutal users that have been built.
Sitecore.System Events.EventsRaised The total number of events that have been raised by the API.
Sitecore.System Exceptions.ExceptionsThrown The total number of exceptions thrown by the API.
Sitecore.System IO.FileWatcherEvents The total number of file watcher events that have been handled by the API.
Sitecore.System Logging.AuditsLogged The number of audit messages that have been sent to the log.
Sitecore.System Logging.ErrorsLogged The number of error messages that have been sent to the log.
Sitecore.System Logging.FatalsLogged The number of fatal messages that have been sent to the log.
Sitecore.System Logging.InformationsLogged The number of information messages that have been sent to the log.
Sitecore.System Logging.WarningsLogged The number of warning messages that have been sent to the log.
Sitecore.System Reflection.MethodsInvoked The total number of methods that have been invoked through reflection.
Sitecore.System Reflection.ObjectsCreated The total number of objects that have been created using reflection.
Sitecore.System Reflection.ObjectsNotCreated The total number of objects where the creation through reflection failed (due to unknown types or constructors).
Sitecore.System Reflection.TypesResolved The total number of types that have been resolved using reflection.
Sitecore.System Reflection.TypesNotResolved The total number of types where the resolving through reflection failed (due to unknown types or other causes).
Sitecore.System Threading.BackgroundThreadsStarted The total number of background threads that have been started by the API.
Sitecore.System Threading.ThreadDataModified The total number of times data in a thread local storage (TLS) slot have been modified.
Sitecore.System Threading.ThreadDataRead The total number of times data in a thread local storage (TLS) slot have been read.
Sitecore.System Xml.ItemNavigatorsCreated The total number of ItemNavigator instances that have been created.
Sitecore.System Xml.PacketsCreated The total number of Packet instances that have been created.

Now, Let me tell how you can check performance counters values.

1.Check that in your Sitecore’s Web.Config “Counters.Enabled” key’s value is set to “true”.

2. Go to Start -> Run -> type “perfmon.msc”

3. Add Performance counter in which  you are interested.

4. Run your application and counter’s values should get updated, If it is not then check below step.

5. Below is the full list of stuff you should know about sitecore performance counters [Source : http://sdn.sitecore.net/scrapbook/working%20with%20sitecore%20performance%20counters.aspx%5D:

Sitecore CMS reads and updates a number of Sitecore-specific performance counters that can be used for troubleshooting of Sitecore issues and analyzing the solution performance.
Below is an overview of the Sitecore performance counters’ related configuration settings.

1. Configuration settings.

There are the following settings in the Sitecore web.config file:

  • Counters.Enabled – Indicates if performance counters are enabled. Setting this to “false” stops the application from updating Sitecore performance counters.
  • Counters.InstanceName – Indicates the counter instance name that will be used when updating and reading Sitecore-specific counters. This setting must be changed if you plan to monitor Sitecore-specific counters while running multiple Sitecore web applications on a single server.
  • Counters.ResetOnStartup – Indicates if performance counters instances will reset their values to 0 on application restarts.

2. Monitoring Sitecore Performance counters.

  • Windows Performance monitor

The Windows performance monitor can be used to monitor Sitecore-specific performance counters. More information about the Windows Performance monitor can be found on the MSDN.

  • Health Monitor

The Sitecore health monitor is a background task that runs the “healthMonitor” pipeline with an interval specified by the “HealthMonitorInterval” setting. One of the processors of this pipeline logs counter values to log files.

Starting from Sitecore 6.2.0 rev. 100104, this processor supports monitoring Sitecore-specific performance counters, Windows and CLR performance counters.

When adding performance counters to the LogCounterStatus processor, you must specify “instanceType” attribute for every counter. For example:

<processor type=”Sitecore.Pipelines.HealthMonitor.HealthMonitor, Sitecore.Kernel” method=”LogCounterStatus”>
<counters hint=”raw:AddCounter”>
<counter category=”Process” name=”Private Bytes” instanceType=”Windows” />
<counter category=”.net CLR Memory” name=”# Bytes in all Heaps” instanceType=”CLR” />
<counter category=”Sitecore.Caching” name=”CacheMisses” instanceType=”Sitecore” />
</counters>
</processor>

The value of the “instanceType” attribute allows Sitecore to determine the name of the counter instance that corresponds to the current web application. This is necessary because running multiple applications on the same machine may have application1 correspond to w3wp counter instance, while application2 will correspond to w3wp#1 instance.

Here’s the sample output caused by the above configuration:

5208 14:46:59 INFO  Health.Counter(w3wp, Process\Private Bytes): 149,172,224
5208 14:47:00 INFO  Health.Counter(w3wp, .net CLR Memory\# Bytes in all Heaps): 49,758,360
5208 14:47:00 INFO  Health.Counter(Default, Sitecore.Caching\CacheMisses): 2,195

  • Counter Dump Agent

The Counter Dump Agent periodically collects data about all Sitecore-specific performance counters using the XML format and writes this data to the files having a path like “/data/diagnosticts/counters.20100428.103711.6060.txt”.
The contents of these files can be used to keep track of Sitecore-specific counters’ values for different time periods.

The agent definition looks like this:

<agent type=”Sitecore.Tasks.CounterDumpAgent” method=”Run” interval=”01:00:00″>
<DumpFile>$(dataFolder)/diagnostics/counters.{date}.{time}.{processid}.txt</DumpFile>
</agent>

3. Known issues and errors related to performance counters.

  • The following message appears in the log files:
    WARN Counter category ‘Sitecore.XXX’ does not exist on this server. Using temporary internal counter for ‘YYY’.

Resolution:
Some Sitecore-specific performance counters are not installed on the server.
Download the sitecorecounters.zip file, unzip it, and run the SitecoreCounters.exe program.

  • The following message appears in the log files:
    Could not create an instance of the counter ‘XXX’ (category: ‘YYY’)
    Exception: System.UnauthorizedAccessException
    Message: Access to the registry key ‘Global’ is denied.

Resolution:
A Sitecore application pool user has to be a member of the system “Performance Monitor Users” group to have access to the mentioned registry key. Adding the user to this group and restarting IIS should solve the problem.

  • The following message appears in the log files:
    “Cannot resolve Instance name for the counter. Category: XXX, Counter name: YYY

Resolution:
When running Windows XP, add “instance=”aspnet_wp” attribute to every <counter> node of HealthMonitor pipeline.
When running Windows 2003, add “instance=”w3wp” attribute to every <counter> node of HealthMonitor pipeline.

Happy performance tuning! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: