What is a Warm-Up Script
In a SharePoint production environment where IIS has been taken as hosting platform, AppPool recycling on daily basis is considered as a good practice. But as an after-effect of AppPool-recycle, when the first user hits the sites of the corresponding SharePoint Web application, slowness is experienced. This is because of the ASP.NET's dynamic page compilation and page caching which happens when the first user hits the page after an IISRESET/AppPool Recycle. But the subsequent users will not face the problem of slowness and pages load faster. To provide a better and faster browsing experience even to the very first user, many organizations take the help of a Warm up script which does the job of hitting the pages for the first time .In this article I am writing a sample warm-up script which can be modified and used as per requirement.
How-To write a Warm Up script
Here I am writing it in VB Script. Once the script is ready, it will be added as a scheduled task in all web servers present in the SharePoint farm. Apart from hitting the mostly visited pages, the script also logs the status into a text file based upon the http response .From the logs one can make out, if the script has run properly or not.
Section 1: Declare variables to hold site urls.Here let's say I have got two sites to warm up.
'Site1
site1=
"http://Web-Application Name:port/Site1/Pages/default.aspx"
'Site 2
site2=
"http://Web-Application Name:port/Site2/Pages/default.aspx"
Function
WarmUp(url)
On
Error
Resume
Next
Dim
objHTTP
Set
objHTTP= CreateObject(
"Microsoft.XMLHTTP"
)
objHTTP.Open
"GET"
,url,
False
,<<userid>>,<<password>>
objHTTP.Send()
If
Err.Number=0
And
objHTTP.Status=200
Then
Hget=url &
"has been warmed up successfully at :"
&
Date
()&
" "
& Time()
Else
"found error at :"
End
objHTTP =
Nothing
'Section for writing into a text file
Const
FOR_APPENDING = 8
strFileName =
"C:\\scriptlogs\service_status.txt"
objFS = CreateObject(
"Scripting.FileSystemObject"
objTS = objFS.OpenTextFile(strFileName,FOR_APPENDING)
objTS.WriteLine Hget
WarmUp(site1)
WarmUp(site2)
yottun8 edited Revision 8. Comment: Removed "(en-US)" in the title.
Jewel Lambert edited Revision 7. Comment: corrected spelling typo
Craig Lussier edited Revision 6. Comment: added en-US to tags and title
Ed Price - MSFT edited Revision 1. Comment: Tags
check this out: www.gokanozcifci.be/.../warm-up-script-for-sharepoint-2010.html