tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DIGLLOYD INC <digllo...@diglloyd.com>
Subject Re: tomcat won't download large files -- out of memory error
Date Fri, 26 Sep 2008 18:07:38 GMT
Thanks to multiple people responding to this!

My site diglloyd.com serves almost entirely static content, with many  
large JPEG files.

I have set:
CATALINA_OPTS=-Xmx1024M

That's limiting the JVM to 1GB of memory. And in tomcat/conf/ 
context.xml, I set:

<Context  cacheMaxSize="1500000" cacheTTL="60000"  
cachingAllowed="true" >

Therein presumably lies the problem.  I'll change CATALINA_OPTS to be  
2GB or so and retry.


Mark, it would be helpful to be able to say "don't cache anything  
larger the N kilobytes/megabytes". I'd probably use a setting of 2MB  
or so for that.

Lloyd

Lloyd Chambers
http://diglloyd.com

[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]




On Sep 26, 2008, at 4:07 AM, Mark Thomas wrote:

> DIGLLOYD INC wrote:
>> I have some large zip files I want to make available for download.   
>> When
>> I try to download a 70MB file, tomcat is trying to cache these huge
>> files (it seems).  The result is that downloading them always  
>> fails.  I
>> *want* caching for most everything eg jpegs, html, etc and I've set
>> tomcat to use up to 1.5GB of memory.
>
> Do you mean you have set cacheMaxSize="1500000" on the context?
>
> Which JVM are you using? Particularly, are you using a 32bit or  
> 64bit JVM?
>
>> Is there a way to limit the size of the file that will be cached?
> Not at present. The maximum (cacheObjectMaxSize) is set to
> (cacheMaxSize/20). I can see a case for making cacheObjectMaxSize
> configurable. The cache should probably use the smaller of
> (cacheMaxSize/20) and cacheObjectMaxSize.
>
>> It's
>> regrettable that failure to cache a file can't gracefully degrade  
>> into
>> just not caching it.
> It isn't possible to handle OOMs gracefully. Once they occur you  
> have to
> assume the JVM is toast and restart it.
>
> Providing you have enough memory configured for the JVM to support the
> cache size you have asked for plus the other memory you need to run  
> Tomcat,
> the cache will be fine and you won't see an OOM.
>
> It appears in this case that the failure is that your JVM doesn't have
> enough memory configured. With sufficient memory head room you  
> should be
> fine. The current cache implementation requires more headroom than  
> is the
> ideal. Limiting cacheObjectMaxSize should reduce the headroom  
> required.
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message