Return-Path: X-Original-To: apmail-poi-user-archive@www.apache.org Delivered-To: apmail-poi-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6C07EDACD for ; Fri, 10 Aug 2012 12:36:30 +0000 (UTC) Received: (qmail 52821 invoked by uid 500); 10 Aug 2012 12:36:30 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 52629 invoked by uid 500); 10 Aug 2012 12:36:29 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 52613 invoked by uid 99); 10 Aug 2012 12:36:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2012 12:36:28 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.213.46] (HELO mail-yw0-f46.google.com) (209.85.213.46) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2012 12:36:24 +0000 Received: by yhmm54 with SMTP id m54so1600004yhm.33 for ; Fri, 10 Aug 2012 05:36:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=Rk6jKYPvfcg3TYp+xUTlbPh+Es09P4FO3xv9DGSOOxs=; b=mOTEPvR3s3ZYgULngru0wBciWPQhTQ+SjHYBWl4Q+bnu5WkMwxO/06fPtOKbdZLwoH ZPQ6o7NetfbgEKS0S4xHMdC5Yzyrqylr0qpCy/Be+1rgVjO9V83HmOsHqhjF5XBcgBZR i0NQ7UoFaxqhw/tU+WPStvKTCI7JuZS0oNFystUiYUp1aVomW2ReTq3IbXKj3fsbgkvm qh71k7Pto7CmSYMmM1Rv3excLdRBcdb46P8cXSyFz+/oz0X0SfRFkdFp6Mbu7DEvM63r iC/xd7zzEq7j5wDgJ4l21lwP6QtBXfVThSfTbB377UYE9LrPNe8CPlLZJZGMm2S72wIm oXsw== MIME-Version: 1.0 Received: by 10.50.104.228 with SMTP id gh4mr1491378igb.71.1344602163080; Fri, 10 Aug 2012 05:36:03 -0700 (PDT) Received: by 10.64.48.71 with HTTP; Fri, 10 Aug 2012 05:36:03 -0700 (PDT) In-Reply-To: <81D805B2-5E92-4F15-BD13-6DAC9D8FB6AC@gtwm.co.uk> References: <81D805B2-5E92-4F15-BD13-6DAC9D8FB6AC@gtwm.co.uk> Date: Fri, 10 Aug 2012 16:36:03 +0400 Message-ID: Subject: Re: Memory consumption From: Yegor Kozlov To: POI Users List Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmNFI9Sjao6nayF6PhzwxQHYILU01fyvT139iDzO2rK1kYGm2gXePg5+2XJpCXzx0DRi1Mi X-Virus-Checked: Checked by ClamAV on apache.org You are reading data from a database, can it be the bottleneck? SXSSF is a low-memory footprint API and I doubt it cause spikes up to 1.3GB. Can your application cache objects ? Also, check settings of the JDBC driver and make sure it streams data and does not accumulate it in memory. Yegor On Fri, Aug 10, 2012 at 1:13 PM, Oliver Kohll - Mailing Lists wrote: > 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: user-unsubscribe@poi.apache.org > For additional commands, e-mail: user-help@poi.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org