PANVEGA’s Blog

DotNet Development, SharePoint Customizing, Silverlight, MS Infrastructure and other tips and tricks

SharePoint using a Warm Up Script

Posted by PANVEGA on November 13, 2008

Ever had to wait a long time before a SharePoint page loads the first time? You really want to have the pages load fast if you click through a SharePoint page. When I hit my SharePoint site it takes 30 seconds to load, then after a refresh it goes sub second, even clearing their cache the page is fast.

Why is that so slow?

So, the curse of the .NET web applications (and then some blessing) is the JIT that impacts the performance for the first -unfortunate- user to access the application first time in the morning, or just after an inconsiderate administrator/developer installed something on the server.

Every web application in IIS need and Application Pool to run. The Application Pool recycle itself at one given time everyday and that’s when all the compiled code in the cache goes to hell. But this recycling is needed, or else the process will eat your server memory to death… and that’s not an option in a real production server!

So, after the Application Pool is recycled, when any user access the web application, by making an HTTP request (that mean, by typing the URL of the Web Application in their browser), the application begins the compilation process. Some of this is cached, so when a second user access the web application is faster for him.

Another proccess that causes the Application Pool to be recycled is when you stop and restart the Internet Information Services, as a whole or any given web application. And this task is very common when you’re implementing new features on SharePoint or even creating new Web Sites.

A warm up script hits all of your sites to start the Just in Time (JIT) compiler for faster site access. You don’t need it but every time you hit your site(s) for the first time there will be a significant delay. This script automates that process for convenience.

Download standard Warm Up Script

warmupserver.zip contains the following 3 files:

This is a simple application that touches each site and site collection on a Sharepoint server to rebuild the IIS cache.

Startup.bat – Calls the warmupserver.cmd script and passes in the servername parameter (modify this to fit the hostname of your server)

Warmupserver.cmd – checks for servername parameter then leverages the HttpRequest.vbs script to hit the relevant admin pages (change the pages and ports to the relevant ones)

HTTPRequest.vbs – This script executes an HTTP query using the XMLHTTP object

Normally IIS discards its cache overnight (applicaion pool recycling), which means that each Sharepoint site must be rebuilt the first time it is accessed. This can be very slow. This script will seek out every site and site collection on a sharepoint server, going as deep as you like, and send them an HTTP request, so that the site remains in cache.

Tip:

If you didn’t know already, all the Application Pools that get created are scheduled to reset themselves at a certain time. Usually around 2 AM in the morning.

So if you want, take this script and put it in a CMD or BAT file and put an IISRESET right in front of it.

Read more about recycling pool in my previous post:

https://panvega.wordpress.com/2008/10/21/updating-files-after-application-pool-recycling

here I found a very good power shell solution:

############################################################################
#Assumptions:
#-Running on machine with WSS/MOSS
#-C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN in path
############################################################################

$output=stsadm -o enumzoneurls
$x=[xml]$output
$x.ZoneUrls.Collection|
foreach-object -process {$y=stsadm -o enumsites -url $_.Default;$sites=[xml]$y;$sites.Sites.Site}|
foreach-object -process {write-host $_.Url; $html=[System.Net.WebRequest]::Create($_.Url);}

It loops through all the web applications and then site collections and hits them all.

Another good warm up script:

http://code.msdn.microsoft.com/spwakeup/Release/ProjectReleases.aspx?ReleaseId=884

http://kirkhofer.wordpress.com/2008/10/18/sharepoint-warm-up-script

Warm up Job Solution:

The purpose of the custom timer job is to act as a replacement for the Windows SharePoint Services warmup scripts.

http://www.konfabulieren.com/2008/06/24/sharepoint-warmup

A simple .NET console application that can perform an HTTP get request using credentials:

http://mphacker.spaces.live.com/Blog/cns!8040CC624DDC5404!218.entry

There many different ways how to solve the warm up process. So try out yourselve what is your apropriate solution.

More Information:

http://www.pptspaces.com/sharepointreporterblog/Lists/Posts/Post.aspx?ID=24

Advertisements

2 Responses to “SharePoint using a Warm Up Script”

  1. gary b said

    Link to download script leads to some unknown website asking user to ‘login’:
    http://phion.pxpgroup.com/Style%20Library/XSL%20Style%20Sheets/JS/NewLink.js

    Is this an error? If not, you should make users aware of the link to an unknown/foreign website and the login requirement.

  2. carmen said

    Hello Gary B,

    You can downloaded from here:

    http://www.jeremytaylor.net/2009/05/19/sharepoint-slow-start-warm-up-script/warmupserver/

    I hope it works (i downloaded).

    Carmen

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: