tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <>
Subject Re: tomcat won't download large files -- out of memory error
Date Fri, 26 Sep 2008 20:12:31 GMT

----- Original Message ----- 
To: "Tomcat Users List" <>
Sent: Friday, September 26, 2008 8:07 PM
Subject: Re: tomcat won't download large files -- out of memory error

> Thanks to multiple people responding to this!
> My site serves almost entirely static content, with many 
> large JPEG files.
> I have set:
> 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

Ah I see what you up to... memory management is trick... theres a tool 
called VisualGC that you may be able to get running on Apple, just for 
interest sake.
The memory management is quite complex and is split into aging heaps... so 
you dont really get that clump of memory, its pro rata'd out...
There are advanced settings if you read up on it... but you also need to see 
it... to see what the JRE is actually up to...

Thats just of interest... but u into serious media so maybe you should try 
something like this...

Make a servlet, read the files from disk yourself.... its not hard... 
something like this... but google for more

can also do interesting stuff like this

So its pretty cool having your own servlet...

but heres what you can try and it will give you alot of control...

Map the servlet to say.... *.jpg

So... that means your servlet overrides the Default servlet

but now do this...

.... look at that size of the file... if its huge... you do it... and send 
if its "normal static content"... forward it to the Default servlet...

Its a kind of filter... and it will give you the ability to use TC's caching 
and that very smart default servlet... or bypass it...

I think something like that will give you all the control you need...

It seems on Apple you dont really have too many choices when it comes to 
JRE's... the machine model is more or less going to determine when you on 64 
... but I think you can play a little and make it work efficiently anyway... 
possibly just letting thumb nails cache... and you can control the browser 
side caching to the nth degree as well.... by making a fronting servlet

.... maybe... have fun ;)

The most powerful application server on earth.
The only real POJO Application Server.
See it in Action :

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message