Thursday, March 11, 2010

Sitecore startup time - something that could improve it


One of the things any Sitecore developer had to deal with is startup time. There are tons of reasons why an application pool may restart (file change notification, config change, etc.) so this generally happens pretty often, especially on a development machine.
So I decided to spend some time on the problem and engaged our brilliant technical support into this little project.

For some reason my local results were drastically different from what tech support reported. Most likely configuration-related. I was getting about 45 seconds for the application startup after IISRESET. I noticed that more than half of this time was spent something non-Sitecore related since the log was showing up only after about 25 seconds. Weird.
There are some interesting findings and the numbers I got on my side may not be 100% accurate, but that was not the goal of this exercise. I wanted to find quick and safe ways to remove/disable something that would not affect the development environment.

While monitoring the activity of the w3wp process using Process Monitor, I’ve noticed a lot of checks going against VeriSign service for assembly signature verification. The calls as you can imagine can slow down the startup quite a bit.
It turned out that introducing the following setting in machine.config disables this process.
<runtime>
      <generatePublisherEvidence enabled="false"/>
</runtime>
This single change helped me see the log file created much faster and the total time was decreased to 6-7 seconds total, only 4-5 of them seemed to be Sitecore-related!
It is important to remember that the location of the machine.config file depends on your platform. For 32-bit it can be found here: C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
For 64-bit here: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG
Another thing to try is to disable Performance Counters in web.config as I’ve seen a lot of activity around registry and performance counters.
<setting name="Counters.Enabled" value="false" />
Now this helped me gain another .5 second for the initial startup (before Sitecore log got created).
Sweet!
My local tests on a dual core laptop indicated that Sitecore desktop (http://localhost/sitecore/shell/default.aspx) starts up in about 6 seconds after IISRESET while the front-end (http://localhost/) in approximately 3-4 seconds!
Caveats:
- My tests appear to be specific to my environment, and did not have same results on another machine where I saw anything around 10-13 seconds which appear to be quite normal for a large ASP.NET applicaiton.
- My test installation had default content and configuration. You may get different results due to the whole array of factors, especially there is a lot of data pre-fetching going on. Check our caching reference for more details. 

Let me know if this works for you, please do share your experience.
Here is the official Sitecore support article.
Share |

9 comments:

Tony Jones said...

We had this same problem at a "very large E-commerce" client and the problem can also be alleviated by allowing servers in the DMZ to have internet (outgoing) access. We thought we had a DLL that was digitally signed, and it happened to be that one of the Sitecore DLLs is digitally signed (I forgot which one).

Anyhow, if you have servers in the DMZ that do not have internet access, this problem will plague you unless you use Alex's tip. Thanks for the catch and publishing this - keep up the good work!

Keep up the good work.

Eli Thompson said...

Maybe we can explore this more when you come over for PSS. We'll have Avicode, too, which might give us additional insight.

kaalen said...

Wow Alex, I'll definitely try this today at work. We work on fairly crappy machines and have a large Sitecore solution so start-up times are frustrating.

Lars Nielsen said...

Hi Alex,

This did nothing for me, unfortunately.
In the other hand, I have done all kind of tweaking on my machine to optimize read times which may affect the result as well.

Anonymous said...

Very good to know - loading the homepage on a 6.2 based site took around 43 seconds after invoking an app recycle from IIS. With the machine.config change this dropped to just under 10 seconds. With the counters disabled, it dropped to just under 9 seconds. Many thanks!

Michael Kelland said...

Thanks for the tip, I have been setting up Sitecore on a reasonable sized multi-instance environment and seeing 40 second startup times. After following the machine.config change startup time is around 4 seconds.

Michael Kelland said...

Thanks for the tip, I have been setting up Sitecore on a reasonable sized multi-instance environment and seeing 40 second startup times. After following the machine.config change startup time is around 4 seconds.

Unknown said...

Hi Michael,

Nice, thanks for sharing!

-alex

Anonymous said...

thanks it is working for me