The easy workaround is not store *many* objects into the servletContext but to store a "holder object" into the servletContext.

Rehashing is a non-issue if at initialization time all the information is loaded into the servletContext. If not future writes are done into the servlet context, then no rehashing is done.

In fact, you can have one object in your servletContext which holds ALL of your data. Then you have full control of the hashing issues and don't need to worry about excessive calls to (CAST)servletContext.getAttribute() or worry about static variables.

-Tim

Peter Guyatt wrote:

Hi there,

I beleive that using the setAttribute adds the object to a hashtable.

If when the hashtable reaches a certian limit (usually 75% of its total
size) it re-hashs which can be expensive and cause performance problems. The
solution is to ensure that the limit is never reached. Is there a way to set
the initial limit for the context?

Pete

-----Original Message-----
From: Tim Funk [mailto:[EMAIL PROTECTED]
Sent: 07 October 2003 12:33
To: Tomcat Users List
Subject: Re: Accessing objects with any servlets, where the object is
already pre-created


I can't see why there would be a difference.


-Tim

Vidar Langberget wrote:


Have you noticed any performance problems with storing large amounts of

data


in the servlet context?

I'm developing a cache for my webapp, and I can't decide if I want to use

a


static class or store cache instances in the servlet context.


Vidar


----- Original Message -----
From: "Tim Funk" <[EMAIL PROTECTED]>


My preference is to store the data into the servlet context (using
setAttribute). Then no static variables are needed.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to