Tuesday, July 27, 2010

Re: [Java] Having Shared Data among servlets

1. Synchronization:
It all depends on how active your application is. If you have quite a
few users that will be accessing the application at once, I'd look for
an alternative to Java synchronization. Also, keep your synchronized
blocks short.

2. Efficiency
1,000,000 records? How big is each record? If the answer is 100 bytes
(which is not that hard to do), your looking at your application always
taking up over 100 megabytes of memory; I'd classify this as a memory hog.

Think. How often will you access those profiles? I mean, get a fresh
one? I'd guess when the person logs in. Solution: put your 1,000,000
records in a database, and look up a single record when the user signs
in, and keep it in session memory.

-Java Guy


On 7/26/2010 1:56 PM, Muhammad Moeen uddin wrote:
>
> I want to have some HashMaps and Lists be shared among the servlets. Some
> servlet could follow a sleep and wake cycle, and some will handle request
> and end.
>
> two things i can do:
>
> 1. Singleton data model (which i m using) with synchyrozied....
> 2. Some say to save it in the servlet context?
>
> Question is: Can Servlet context can have an object with one million
> records
> of like user profiles? How efficient is this? Please Comment.
>
> Regards
>
> Moeen
>
> [Non-text portions of this message have been removed]
>
>


------------------------------------

Visit http://aiaiai.com or http://jgame.org for more groups to join.
Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
Whoever posts spam / ads / job related message will be BANNED IMMEDIATELYYahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Java_Official/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/Java_Official/join
(Yahoo! ID required)

<*> To change settings via email:
Java_Official-digest@yahoogroups.com
Java_Official-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
Java_Official-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

No comments:

Post a Comment