Saturday, February 25, 2012

RS creates Active Sessions too easily

Problem: Can't run a script to test reports over night without running out
of memory because too many Active Sessions are being generated.
We have a Reporting Service test utiltiy that we are trying to run over
night. It gathers up all the possible parameter combinations and runs all of
these. The trouble is the number of Active Sessions increases by one for
each report and eventually the server fails. We added the ability to
generate a script when the test utility runs.
The .rss is compiled and ran against a single rs instance, still a new
session for every report render.
This is the same report getting rendered over and over, just with different
parameters.
Running the same report with the same parameters doesn't generate new Active
Sessions.
Running the reports from the RS Manager, I can change the parameters and not
get an additional Active Session, but when I switch reports and switch back
I get a new Active Session, once for the new report and once again when I
switch back to the report I was just on.
My guess is that this relates to the Web Service keeping my info in Session
State, and releasing it after 10 minutes.
Anyone with any ideas what I should do? I'd like to keep my session state
to 10 minutes, this same machine is used during the day by QA.
Here's my .rss code:
Dim ParentPath As String = "/" + ReportDir
Public Sub Main()
RunReport("myReport", "c:\temp\run1.pdf", "a,b,c", "1,2,3")
RunReport("myReport", "c:\temp\run2.pdf", "a,b,c", "4,5,6")
RunReport("myReport", "c:\temp\run3.pdf", "a,b,c", "4,5,6")
End Sub
Public Sub RunReport(ByVal reportName As String, ByVal FileName As String,
ByVal ParamNames As String, ByVal ParamValues As String)
Dim objReportResult As Byte()
Dim encoding As String
Dim mimeType As String
Dim rptParamsUsed As ParameterValue()
Dim warnings As Warning()
Dim streamIDs As String()
Dim fs As FileStream
Dim Names As String()
Dim Values As String()
Dim rptParamValues As ParameterValue()
Dim Counter As Integer
If ParamNames Is Nothing Then
rptParamValues = Nothing
Else
Names = ParamNames.Split(",")
Values = ParamValues.Split(",")
ReDim rptParamValues(Names.Length - 1)
For Counter = 0 To Names.Length - 1
rptParamValues(Counter) = New ParameterValue()
rptParamValues(Counter).Name = Names(Counter)
rptParamValues(Counter).Value = Values(Counter)
Next Counter
End If
Try
objReportResult = rs.Render(ParentPath + "/" + reportName, "PDF", Nothing,
Nothing, rptParamValues, Nothing, Nothing, encoding, mimeType,
rptParamsUsed, warnings, streamIDs)
fs = new FileStream(FileName, FileMode.OpenOrCreate)
fs.Write(objReportResult, 0, objReportResult.Length)
fs.Close()
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
Here's the documentation on MSRS 2005 Web Service Active Sessions:
Active Sessions
Number of active sessions. This counter provides a cumulative count of all
browser sessions generated from report subscriptions, whether they are still
active or not.
The counter is decremented as session records are removed. By default,
sessions are removed after ten minutes no activity.
Steve MunLeeuwEntered support incident, need to provide stack trace of error. Will do
tomorrow. Took about an hour to get the support incident set up...fun :)
"Steve MunLeeuw" <smunson@.clearwire.net> wrote in message
news:OhBp4jf1GHA.1040@.TK2MSFTNGP06.phx.gbl...
> Problem: Can't run a script to test reports over night without running
> out of memory because too many Active Sessions are being generated.
> We have a Reporting Service test utiltiy that we are trying to run over
> night. It gathers up all the possible parameter combinations and runs all
> of these. The trouble is the number of Active Sessions increases by one
> for each report and eventually the server fails. We added the ability to
> generate a script when the test utility runs.
> The .rss is compiled and ran against a single rs instance, still a new
> session for every report render.
> This is the same report getting rendered over and over, just with
> different parameters.
> Running the same report with the same parameters doesn't generate new
> Active Sessions.
> Running the reports from the RS Manager, I can change the parameters and
> not get an additional Active Session, but when I switch reports and switch
> back I get a new Active Session, once for the new report and once again
> when I switch back to the report I was just on.
> My guess is that this relates to the Web Service keeping my info in
> Session State, and releasing it after 10 minutes.
> Anyone with any ideas what I should do? I'd like to keep my session state
> to 10 minutes, this same machine is used during the day by QA.
> Here's my .rss code:
> Dim ParentPath As String = "/" + ReportDir
> Public Sub Main()
> RunReport("myReport", "c:\temp\run1.pdf", "a,b,c", "1,2,3")
> RunReport("myReport", "c:\temp\run2.pdf", "a,b,c", "4,5,6")
> RunReport("myReport", "c:\temp\run3.pdf", "a,b,c", "4,5,6")
> End Sub
>
> Public Sub RunReport(ByVal reportName As String, ByVal FileName As String,
> ByVal ParamNames As String, ByVal ParamValues As String)
> Dim objReportResult As Byte()
> Dim encoding As String
> Dim mimeType As String
> Dim rptParamsUsed As ParameterValue()
> Dim warnings As Warning()
> Dim streamIDs As String()
> Dim fs As FileStream
> Dim Names As String()
> Dim Values As String()
> Dim rptParamValues As ParameterValue()
> Dim Counter As Integer
> If ParamNames Is Nothing Then
> rptParamValues = Nothing
> Else
> Names = ParamNames.Split(",")
> Values = ParamValues.Split(",")
> ReDim rptParamValues(Names.Length - 1)
> For Counter = 0 To Names.Length - 1
> rptParamValues(Counter) = New ParameterValue()
> rptParamValues(Counter).Name = Names(Counter)
> rptParamValues(Counter).Value = Values(Counter)
> Next Counter
> End If
>
> Try
> objReportResult = rs.Render(ParentPath + "/" + reportName, "PDF", Nothing,
> Nothing, rptParamValues, Nothing, Nothing, encoding, mimeType,
> rptParamsUsed, warnings, streamIDs)
> fs = new FileStream(FileName, FileMode.OpenOrCreate)
> fs.Write(objReportResult, 0, objReportResult.Length)
> fs.Close()
> Catch e As Exception
> Console.WriteLine(e.Message)
> End Try
> End Sub
>
> Here's the documentation on MSRS 2005 Web Service Active Sessions:
> Active Sessions
>
> Number of active sessions. This counter provides a cumulative count of all
> browser sessions generated from report subscriptions, whether they are
> still active or not.
> The counter is decremented as session records are removed. By default,
> sessions are removed after ten minutes no activity.
> Steve MunLeeuw
>

No comments:

Post a Comment