Originally posted by Detlef Folger:
Hi folks,
I am planing an architecture with the typical J2EE tier structuring:
client - presentation - business - integration - resource
wherer one tier can only talk to the next tire below.
The integration tier is not CMP but stateless DAOs.
The business tier only talk to the integration tier to retrieve data.
The business tier also doesn't know (or care) where the data comes from
it just goes to the integration tier an asks for it.
The business tier also has a stateful session facade where to keep
user related session information.
For performance reasons I would like to add some type of cache to my system.
And here is where it all starts. Where do I keep the cache?
Like I said, business only asks integration for data, but integration
is stateless and doesn't know about session information.
The only place that is statefull is the business facade in business,
but I don't want to break my rule and retrieve data from integration (DB) and business (cache).
My first idea is to keep a hashmap in integration with e.g. userId as a key
and the cached data as value. However, I am not quit sure if that is
concidered "Best Practice"....
Any good ideas out there on how to solve this issue?
TIA, Detlef
Originally posted by Annie Zhang:
Just want to confirm if this CacheManager should be singleton, which could be shared by all the clients.
Originally posted by Dhiren Joshi:
Parag ,
In the caching mehanism ,how would the cache manager know when to refresh. Some sort of observer observable type of implementation is needed or what ?
Too much of an over kill to call cache everytime when using the EJB's.
Or are u suggesting to integrate the caching and synch it with the EJB's.
What if the DB is updated like from a fast lane reader or a DAO other then the EJB's ? How would the cache manager synch with that ?
Thanks
Dhiren
I just thought of another question regarding the implementation of the CacheManager. If it is implemented as a session bean, should it use fast lane reader and value list handler to maximize the performance, instead of using DAO directly? (That is what I read from some post). However, fast lane reader is normally called from jsps instead of from EJBs. How could the CacheManager session bean use the fast lane reader?
Originally posted by Annie Zhang:
I just thought of another question regarding the implementation of the CacheManager. If it is implemented as a session bean, should it use fast lane reader and value list handler to maximize the performance, instead of using DAO directly? (That is what I read from some post). However, fast lane reader is normally called from jsps instead of from EJBs. How could the CacheManager session bean use the fast lane reader?
Thanks,
Annie
The solution in the EJB specifications is to recommend modelling of only those tables as Entity Beans which are not to be accessed directly by other sources as this directly has bearing on distributed caching by container. So a third party caching doesn't seems to help anyway here. (Use SB+DAO for fast lane reader there).
Originally posted by Annie Zhang:
I also heard of stateless session bean based FLRs. That confuses me.
Is this fair to say like this? (CacheManager is just a plain class)
Jsp--Servlet--CacheManager--ValueListHandler--FastLaneReader--DAO--DB
| | |<<manages>>
| | |
|------------ Cached objects
Consider Paul's rocket mass heater. |