First hit to Reporting services is slow


Problem:

First hit to Reporting services is slow


Proposed Explanation and solution:
This is because IIS is a demand-driven web server, i.e. IIS does things only when asked for. For example: an IIS worker process spawns up only when requests arrive for the sites that are hosted in this worker process. So when someone hit the reporting service for first time then it will perform some of the initialization activities such as:
  • Initialization of data structures
  • Loading data from a datastore into memory  (caching)
  • Compilation of code, e.g. .NET applications
  • Establishing database connections
Recommendations:
1 – Spinning up an app pool can take some time and make the application less responsive so keeping them up for longer can help performance, so may be changing default recycle time from 720 min (12 hours) to 2880 min (48 hours) will help the performance
2 – Create and run simple scheduled report to keep SSRS active running every hour. For example: A simple report to display current date using GetDate() or a simple query will work
3 - You can also use Powershell Script which stops and starts the SSRS service (which has the same effect as the application domain restart) and after the restart it makes a request to the report manager URL which forces the reporting services to load all the configurations etc. Then all the subsequent request to SSRS are immediate.

Powershell script as below:

Stop-Service "SQL Server Reporting Services (MSSQLSERVER)"
Start-Service "SQL Server Reporting Services (MSSQLSERVER)"
$wc = New-Object system.net.webClient
$cred = [System.Net.CredentialCache]::DefaultNetworkCredentials
$wc.Credentials = $cred
$src = $wc.DownloadString("http://localhost/Reports/Pages/Folder.aspx")

And you can create a scheduled task using the Scheduled Tasks GUI or execute a below command to create the scheduled task from within a command prompt. The command prompt needs to be running with elevated administrative privileges.

schtasks /create /tn "SSRS Warmup" /ru UserName /rl highest /np /sc daily /sd 12/12/2013 /st 02:00 /tr "powershell.exe -noprofile -executionpolicy RemoteSigned -file c:scriptsSSRSWarmup.ps1"


Some nice refereed blogs as below:

http://msdn.microsoft.com/en-us/library/bb736357(v=vs.85).aspx

http://www.pawlowski.cz/2011/07/solving-issue-long-starting-report-ssrs-2008/


Comments

Popular posts from this blog

Calculating Age of the person in T-SQL

How to Troubleshoot Subscription issue in Reporting Services

MDX Queries - Current Day - Month and Year