views:

2199

answers:

6

Our team has built a site using Sharepoint and a few custom webparts. We've noticed that the site takes a while to load when first accessing the site in the morning. Subsequent accesses are fine. We suspect that Sharepoint is reindexing its lists, etc.

Has anyone else seen this problem with Sharepoint? Does anyone have a suggested fix?

+2  A: 

No. I would guess that the compiled components in the application have been unloaded from memory and have to be reloaded into the cache. This happens with my ASP.NET web apps, too. I especially notice it on the QA sites which don't get hit nearly as often and thus are almost always flushed from the cache when I go to access them.

You could look at increasing the amount of time the app pool for your site waits before recycling an idle worker process.

tvanfosson
+2  A: 

Agree with tvanfosson that it sounds a lot like that start up lag that you get with aspnet apps.

A quick and dirty fix might be to set up a scheduled task to point a WebClient at the site and kick it into life every morning before people start using it.

seanb
+13  A: 

By default an IIS application will recycle its worker processes during the night. You can turn this off in IIS manager, but a better option may be to just add a warmup script to a timed job. You can do this in SharePoint but simpler is probably to just add a scheduled task in Windows to fire off the a warmup script after the recycling is done.

A google for "sharepoint warmup script" will yield several results, including this, which actually also explains the same situation :-)

Bjørn Furuknap
+2  A: 

My guess is that the application pool's worker processes are set to recycle at a certain time every night in IIS, which causes the delay first thing in the morning. Right-click the application pool in IIS -> Properties -> and look under where it says "Recycle worker processes at the following times:" to see for yourself.

You could disable this option to fix your problem but I don't recommend it because having the worker processes recycle every night will reclaim any memory that may have leaked. Memory leaks are especially possible during SharePoint development because as you may know many of the objects in the SharePoint object model perform most of their work in unmanged memory. If these objects are not properly disposed of a large amount of memory may be occupied while adding little memory pressure on the .NET garbage collector, delaying garbage collection.

Best Practices: Using Disposable Windows SharePoint Services Objects

I agree with seanb's suggestion of setting up a scheduled task to load the site in the morning to solve the delay problem. Just make sure you schedule it for a time after the worker processes have recycled obviously.

wcmiker
+1  A: 

Of course, Bjorn highlight the main cause of the "issue". Application pool get recycled during the night.

However, this should take something like 30 seconds.

If it takes something like 2 or 3 minutes, consider reading this. If you server don't have access to internet, it main explain why it's so slow. Just try to download the certificate revocation list from microsoft.com to see if it makes a difference.

Nico
A: 

If you're running Windows Server 2008 R2, there is now an Application Warm-Up extension for IIS 7.5 available for free. At the time of writing it's in beta.

This "warms up" an application pool directly configured from IIS and can also be extended with custom initialization logic.

Alex Angas