tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alexis" <alz...@gmail.com>
Subject Re: storing images
Date Fri, 06 May 2011 14:52:50 GMT
I understand, but i have top 12 images of 35kbytes, no more.

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. 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.

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


Enviado desde blackberry

-----Original Message-----
From: Christopher Schultz <chris@christopherschultz.net>
Date: Fri, 06 May 2011 09:48:45 
To: Tomcat Users List<users@tomcat.apache.org>
Reply-To: "Tomcat Users List" <users@tomcat.apache.org>
Subject: Re: storing images

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexis,

On 5/5/2011 8:19 PM, alexis wrote:
> Im storing the images as servletcontext attribute.

Uh... in memory? That's a bad idea IMO for two reasons:

1. Large memory requirements

2. Likely repeated encoding into a file format like JPEG, PNG, etc.

If you store the files on the disk, you can stream them as often as
you'd like. If you get a request for an image that already exists, you
can serve it up, otherwise, you can create it.

You can even create a hash of lock objects or something so that you can
"lock" the file as it's being written so that the file is only written
once even if multiple clients are requesting it.

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

iEYEARECAAYFAk3D/D0ACgkQ9CaO5/Lv0PAYQQCcCy9k9SxH3YSHxekqSzJQKwPz
nPAAn3XrYoxXE3E3+FXZ1XfBu3/v9pmW
=rQaQ
-----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