Sitecore Slow Performance on First Launch Could Be Your Performance Counters Not Having Appropriate Permission

When setting up a greenfield project I just love to see the sea of standard Sitecore home pages cascaded across my monitors as every instance in every environment comes online. I feel like Tom Hanks yelling, “Look what I have created!”, and after the first 20 times of doing so in the office I got “The talk”. But it's not unusual to see a slow start which typically boils down to a connection or permission error. This can be quickly identified and dealt with by just checking the logs, and performance counters is no stranger to this exercise.

It's not hard to spot the issue with performance counters, because your log will be inundated with entries like these: 

4580 13:03:19 WARN Sitecore has no necessary permissions for reading/creating counters.  
4580 13:03:19 WARN Sitecore has no necessary permissions for reading/creating counters.
4580 13:03:19 WARN Sitecore has no necessary permissions for reading/creating counters.
4580 13:03:19 WARN Sitecore has no necessary permissions for reading/creating counters.
4580 13:03:20 WARN Sitecore has no necessary permissions for reading/creating counters.
4580 13:03:20 WARN Sitecore has no necessary permissions for reading/creating counters.

 What do we do about this? Well it's really quite simple. You can choose to disable counters or provide the appropriate permissions the App Pool needs. I usually disable these as they add overhead, so let's start with that. 

Disabling Performance Counters

The following patch file will disable performance counters. Some people have reported that the dump files are still being created after disabling counters which I find hard to believe, but setting the agent (or any agent for that matter) to 00:00 will disable it, so I've included it here. 

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
 <sitecore>
   <settings>
     <setting name="Counters.Enabled">
       <patch:attribute name="value">false</patch:attribute>
     </setting>
   </settings>
   <sceduling>
     <agent type="Sitecore.Tasks.CounterDumpAgent" method="Run" interval="00:00:00">
       <DumpFile>$(dataFolder)/diagnostics/counters.{date}.{time}.{processid}.txt</DumpFile>
     </agent>
   </sceduling>
 </sitecore>
</configuration>

Remember any config change restarts Sitecore so, you know, make sure no one's going to lose work or hit you with a nerf gun.

Providing Permissions to the App Pool

If you'd like to keep performance counters running just grant the appropriate permissions to the App Pool by following these steps:

  1. In the Sitecore's server, go to Start -> Run -> compmgmt.msc
  2. In System Tools -> Local Users and Groups -> Groups, right click on Performance Log Users and choose Add to Group.
  3. In this new window click Add, and enter “iis apppool\APPNAME”, with replacing APPNAME with your Sitecore instance's App Pool name and no quotations. You can use the Check Names button to the right if you wan to validate you got the name right, because this matters.
  4. Hit Ok, Ok on the child window, and run and an iisreset command to restart your Sitecore site.
  5. Review the new log file being made to validate no errors are appearing.