Warm Up your SharePoint Servers...
Avoid that COLD, SLOW request that baffles users...
Ever thought things on ASP.NET were a bit slow the first time accessing them? Many of you are aware that ASP.NET from a web admin perspective know that things have to recompile and things just aren't as fast the first time. In fact some times things are incredibly slow the first time and are incredibly slow. Ever had users say, for some odd reason some times 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. That's because it's not a user issue, its simply compiling, caching, etc... on the server after an IISReset or app pool reset or worker process cycle.
If you're doing demos of an ASP.NET app such as WSS or SPS or Office SharePoint Server 2007, or you simply want your home page to load faster after an IISReset so it's not your users hitting the page for the first time, you may be *very* interested in this post.
The scripts attached to this post are warm up scripts. I did not write them. I asked the guy (Bryan Hart) who built our awesome VPCs (virtual images) if he wrote them. He did some work on them, but he doesn't claim to have originally authored them. They are shared via the SharePoint beta 2 Resource DVD (handed out at TechEd 2006 and the World Wide Partner Conference as part of the SharePoint Server VPC image. I think they're super cool so I'm attaching them for use on your environments. None of the scripts are compiled so you can feel free to modify them, make them even greater and share them back out to the world.
Let's say you know that you cycle your app pools at 1am, what if you executed this script to "warm up" the common pages following the cycle? I'm sure you'll find other creative uses of this script outside of demos which is our most common usage of this script. I do recommend you compare an iisreset and hit your home page, then try an iisreset and run this script then hit the page. HUGE difference. I personally think the warmupscript is more efficient than a browser request in terms of "warming" things up.
Here's the gist of the attached batch and command line executed vbscript...
In the words of the script itself... "This script will run stsadm to warmup the admin interfaces [and] hit each page in the portal to force their JIT."
warmupserver.zip contains the following 3 files:
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
Added 8/21:
I recommend checking out some additional tips on this topic from Andrew Connell
I'd say these tips are beyond just for developers. It's very efficient to cycle just an app pool, or isolate a worker process and kill the process rather than cycling IIS.
I also recommend having the path to the /bin directory in your path variables. (More insight in andrew's post.
One of the first things I do when installing a sharepoint server is creating a command short cut to the bin directory, even though I like to have it in my path.
1. Right click desktop, choose "shortcut"
2. Put in this path: "c:\winnt\system32\cmd.exe" click next
3. Enter "STSADM" or shortcut to bin or something like that and click "next" (Now you've got a command prompt looking icon on your desktop)
4. Choose the new icon on the desktop. Right click choose properties, change "start in" path to the path to the bin directory: "c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin" (path may be slightly different based for x64)
Double click the shortcut... You now are at the path where you can run stsadm commands, prescans, etc...