Hi, I have a servlet which generates Excel files using POI and serves them as downloads. I've hit a heap space issue generating large(ish) files.
A file that ends up as 20MB, 300,000 rows causes a memory spike of about 1.3GB. A smaller 1MB file with a few thousand rows causes a 30 or 40 MB jump. I've done everything I can think of so far: I use the streaming excel generation class SXSSFWorkbook which I understand is low memory, buffering to disk. There are two methods, one to generate the Excel and one to serve it. I save a temporary file to disk rather than transfer data directly in memory between the methods The second method to serve the content uses buffered input and output streams. Anything else you can think of? The code is here: https://github.com/okohll/agileBase/blob/master/gtpb_server/src/com/gtwm/pb/servlets/ReportDownloader.java getSessionReportAsExcel generates the spreadsheet and serveSpreadsheet serves it. Oliver Kohll www.agilebase.co.uk --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
