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 Fri, 06 May 2011 13:48:45 GMT
-----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