Prasad, Kamakshya wrote:

Hi All,

Performance wise which will be the better way of caching for a web
application, using static variables or embedding the object to be cached
in the application context object.



Unless your server is totally CPU bound, it's unlikely to make any difference at all from a performance point fo view. If it is, then any difference is solely in the tradeoffs of how you get to the cached data -- the ServletContext.getAttributes() call is typically a lookup in a HashMap (with synchronization to avoid multithread issues), versus whatever lookup mechanism you use in your static variables.

But, I would suggest focusing on clean architecture and design as the first priority, and optimize stuff like this only if it shows up in your performance measurements. Paying attention to the indexes on your database is likely to give you substantially more benefit for a given amount of time spent on performance tuning than something like this.

KP



Craig


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



Reply via email to