tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: [OT] storing images
Date Fri, 13 May 2011 15:26:26 GMT
Hash: SHA1


On 5/13/2011 11:14 AM, alexis wrote:
> upon new data, what i only build new are the series, then i get the
> object on the servletcontext and set the new data inside this object
> (if exists, if not, the whole chart object is created)

That's good to know, though the series is where the bulk of the data is
stored, of course. I'd be interested to see what the overhead of the
JFreeChart object is with no series data.

Also, if you discard the series data anyway when you re-build, are you
really buying yourself anything by keeping the JFreeChart object laying

> On May 13, 2011, at 11:47 AM, Christopher Schultz wrote:
>> Hopefully not "println" as that may corrupt your image and will
>> definitely add an unnecessary trailing newline.
>> So, you re-encode the image every time it's served to a client. I'm
>> suggesting that when you render the JFreeChart, you go all the way to a
>> JPEG (or image format of your choice) and store /that/ in the
>> ServletContext.
> Yes, you're right 1 encoding against n encodings, no matter how 
> small is the cpu save, it's saved n times so it makes the
> difference.
> And yes, out.print it is and not out.prinln, changed :)

I would use write(byte[]), but that's just me.

>> What profiler are you using? I use YourKit and it tells me the sizes of
>> object trees fairly easily.
> jvisualvm from the standard jdk. i saw that a heap dump can be done
> and then find what uses the dumped [heap].

You could do that. I've never really used VisualVM so I'm unsure of it's

>> If you store the raw bytes of the JPEG image in memory, they will take
>> up exactly the same size as the file does on disk. So if you look at the
>> image information from your web browser and it says, say, 180k for the
>> image, then that's how much memory it will take when it's sitting in
>> your ServletContext.
> Im modifying it right now and testing.

Cool. Let us know how it goes.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message