Revisiting an old SSRS performance topic again…

Almost three years ago, I posted about why Reporting Services takes so long to respond to the first request if it has been sitting idle for a long time (like overnight).  The original post can be found at https://blogs.msdn.com/b/sqlblog/archive/2007/11/09/reporting-services-staaaarrrrrtttt-up.aspx.  For those of you who don’t want to read it, the core conclusion was that (at least on my hardware), SSRS was taking about 30 seconds to start up after the application domain had been recycled.  The post was in response to the question I was getting (and still get) about why SSRS takes so long to start up.  The answer (for those of you who don’t want to bother reading the old article), was that SSRS has to do a ton of work to load all of the required dependencies, plus read the configuration files and decrypt the data in the catalog database.

I recently set up a new installation of SSRS 2008 R2, so I thought I would do the same comparison.  I had figured to see similar results, so you can imagine my surprise when the numbers averaged about 15 seconds!!!  I attribute some of that to a better machine, but my primary machine is not too much better than my server machine was back in those days (quad-core vs. dual-core, but similar RAM and clock speeds).  In fact, some quick benchmarks confirmed my thoughts – the new machine is better at higher workloads, but at the relatively low level of work I am doing for these tests, they are about the same.

Here is the updated code:

 

     Sub Main(ByVal args() As String)
        Dim sr As New IO.StreamWriter(IO.Path.Combine(Environment.CurrentDirectory, "ReportingServicesMetrics.txt"))

        'let's loop through 5 times
        For i As Integer = 0 To 4
            Dim ts As DateTime
            Dim te As DateTime

            If args(0).ToUpper = "IIS" Then
                'let's reset IIS to make sure everything has to start from scratch
                sr.WriteLine("Doing an IISReset - Loop #" & (i + 1).ToString)
                Dim proc As New Diagnostics.Process
                proc.StartInfo.FileName = "iisreset"
                proc.Start()
                proc.WaitForExit()
                sr.WriteLine("IIS has been reset")

                'dummy web service
                sr.WriteLine("Getting ready to instantiate the dummy web service that just returns an empty DataSet")
                ts = Now()
                Dim dws As New DummyWebService.Service
                dws.ReturnBlankDataSet()
                sr.WriteLine("Instantiated the dummy web service")
                te = Now()
                sr.WriteLine("The dummy web service took " & te.Subtract(ts).TotalMilliseconds.ToString)
            End If

            If args(0).ToUpper = "SSRS" Then
                sr.WriteLine("Doing an SSRS restart - Loop #" & (i + 1).ToString)
                Dim srv As New System.ServiceProcess.ServiceController("SQL Server Reporting Services (R2)")
                srv.Stop()
                Do While srv.Status <> ServiceProcess.ServiceControllerStatus.Stopped
                    Console.WriteLine(srv.Status)
                    Threading.Thread.Sleep(5000)
                    srv.Refresh()
                Loop
                srv.Start()
                Do While srv.Status <> ServiceProcess.ServiceControllerStatus.Running
                    Console.WriteLine(srv.Status)
                    Threading.Thread.Sleep(5000)
                    srv.Refresh()
                Loop
                sr.WriteLine("SSRS has been reset")

                'RS
                sr.WriteLine("Getting ready to instantiate the RS web service")
                ts = Now()
                Dim rs As New RS2005.ReportingService2005
                Dim creds As New Net.NetworkCredential
                creds = Net.CredentialCache.DefaultCredentials
                rs.Credentials = creds
                rs.Url = "https://localhost/reportserver_r2/reportservice2005.asmx"
                rs.ListChildren("/", False)
                sr.WriteLine("Instantiated the RS web service")
                te = Now()
                sr.WriteLine("RS took " & te.Subtract(ts).TotalMilliseconds.ToString)
            End If

        Next
        sr.Close()
    End Sub

In summary, even though I would love to see some improvement in this area, my own testing shows that SSRS 2008 R2 starts up from a cold start in about half the time is took SSRS 2005.

Your mileage and results will vary depending on your hardware configuration, so don’t take my results to use in a proposal to your management.  If you do, I will disavow any knowledge of the above testing!!

Do your own testing, but please share your results.  I would love to hear if other people see similar startup improvements between the two versions.