On a production server box with 8GB of RAM, we are running a windows service which retrieves image format bytes of a particular report which results in pages ranging from 10 to 300 using Reporting Services 2005 Web Service.
Problem is when image bytes are being retrieved by using Render method for a report with more than around 30-40 pages,
Report Web Service throws an exception of type System.OutOfMemoryException. This does not happen with reports with smaller pages. Please note that we are retrieving high DPI image and we have no option but to do so.
Since the production server has 8 GB of RAM and we have even enabled the 3GB switch in boot.ini of Windows Server 2003, This problem still exists.
I have already read the contents of the article http://support.microsoft.com/kb/909678 but as i mentioned even the large physical memory does not seem to help and shortening the report is not an option.
Also note that large number of records is also not a problem as our application works fine when we generate excel files instead of images.
Follwing is the detailed exception that we receive.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
at System.Text.StringBuilder.set_Capacity(Int32 value)
at System.Xml.XmlTextReaderImpl.ReadElementContentAsBase64(Byte buffer, Int32 index, Int32 count)
at System.Xml.XmlTextReader.ReadElementContentAsBase64(Byte buffer, Int32 index, Int32 count)
at System.Xml.Serialization.XmlSerializationReader.ReadByteArray(Boolean isBase64)
at System.Xml.Serialization.XmlSerializationReader.ToByteArrayBase64(Boolean isNull)
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer25.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object parameters)
at ReportExecution2005.ReportExecutionService.Render(String Format, String DeviceInfo, String& Extension, String& MimeType, String& Encoding, Warning& Warnings, String& StreamIds)
This error might be caused by the memory limit. There are two settings that will affect the memory configuration.
When you render a report through the Reporting Services Web service, the Reporting Services Web service obtains the "MemoryLimit" setting from the Machine.config file.
A scheduled report is rendered by the Report Server Windows service. The Report Server Windows service obtains the "MemoryLimit" setting from the RSReportServer.config file.
These values represent a percentage of physical memory. You can adjust them to change the memory limit.
If there are any more questions, please let me know.
Thnak you very much for your reply.
We have a box with 8 GB of RAM.
I have already tried assigning 60% to 80% of the physical memory to the worker process from the machine.config file, since i am using Report Server Web Service. This does not seem to work even with a 40-50 page report being rendered as image on 300x300 DPI.
I have also tried reducing the DPI value and it reduces the failure threshold. But, even that fails for slightly larger reports.
If we render on excel it works like a charm and is very fast even though microsoft has listed excel rendering extension to be slower than image rendering extension.
I wonder what somebody from microsoft has to say about it.
It seems you are rendering through SOAP, and the OOM exception occurs because the way the SOAP protocol works internally it has to put everything into a byte in memory before sending it over the network - SOAP does not have streaming abilities.
I'd recommend to try to render the report via Url Access (http://msdn.microsoft.com/en-us/library/ms153586.aspx) - does it work then?
Thnaks for your reply Robert.
I know SOAP reservers at least 24 additional bytes for each byte in a byte array. In my case this happens to reports starting from about 10 MB in size. That means 10 x 24 = 240 MB reserved in memory for the byte array of report rendering results. I am using a box with 8 GB of RAM so can SOAP still become a bottleneck?
Secondly, the program used to generate report files is a windows service hence is non interactive. Can we render a report in particular format through url access programmatically and without opening a Save As dialog box.
Hameer Saleem Khawaja