tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: storing images
Date Wed, 11 May 2011 19:05:30 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexis,

On 5/6/2011 10:52 AM, alexis wrote:
> I understand, but i have top 12 images of 35kbytes, no more.

Fair enough.

> Encoding load is an issue yes, but the images are reflecting
> callcenters call queues and some stuff related so the need to refresh
> and rebuild the images is a requirement.

You might consider going all the way down to the byte-level encoding and
store the raw bytes of the JPEG or PNG that you want to use. You didn't
say what you were doing, but it's certainly possible to store a
java.awt.Image in memory and re-encode it for every request. You may as
well encode it once and serve the bytes directly with those requests.

> What im thinking is to avoid the generation upon servlet calls
> (servlet only reads and presents the image to callers) and start a
> different thread with a listener in charge to periodically rebuild
> images.

I think you're better-off doing lazy up-to-date checking, but that's
just me... it depends on what your requirements truly are. I always hate
having background threads running in a webapp.

> Do you believe regarding memory it can cause a big issue? In worst
> case it's 450kbytes when all images are created and stored.

Just be sure to test your caching algorithm and make sure the purge is
working you expect. Image data can take up memory in a hurry if you have
a bug in there.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3K3fkACgkQ9CaO5/Lv0PB81gCdE84v3o2RhjwQo+EL1cT5pHBY
1PUAoLAulZdm+nlzKsRfPFdWKjPRK/R9
=b465
-----END PGP SIGNATURE-----

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


Mime
View raw message