Is it possible to cache data in server to boost performance(HTTPsession?Application scope?)?
Or shall we only depend on DB caching?
Can anybody give good links on the topic?
Entity beans cache objects in memory to boost performance.
http://java.sun.com/developer/onlineTraining/EJBIntro/EJBIntro.html explains the concept very well:
Containers will manage many beans simultaneously in the same fashion that the Java WebServer manages many servlets. To reduce memory consumption and processing, containers pool resources and manage the lifecycles of all the beans very carefully. When a bean is not being used, a container will place it in a pool to be reused by another client, or possibly evict it from memory and only bring it back when its needed. Because client applications don't have direct access to the beans--the container lies between the client and bean--the client application is completely unaware of the containers resource management activities. A bean that is not in use, for example, might be evicted from memory on the server, while its remote reference on the client remains intact. When the client invokes a method on the remote reference, the container simply re-incarnates the bean to service the request. The client application is unaware of the entire process.
In blueprints, catalog is in Shopping cart session bean. Catalog is directly read via DAO (no entity bean)for browsing purposes (Fast lane reader).
Can Catalog be stored in some read only cache ( given that product information does not change as often) for better performance?
[ August 25, 2004: Message edited by: D. Rose ]
How would you index the cached data? You don't want to reinvent the database functionality... You could cache the data for a query and if the same query comes up again you could give the same results (assuming tha data doesn't change that often). Ask yourself whether the same query is likely to happen many times and if not what is the point of caching?
Originally posted by Louise Elliott:
You could cache the data for a query and if the same query comes up again you could give the same results (assuming tha data doesn't change that often). Ask yourself whether the same query is likely to happen many times and if not what is the point of caching?
Taking this as a quite good explanation why not to cache data at all for the purposes given in the requirements.
As a side note, this doesn't obsoletes the utilisation of Fast Lane Readers, right?
If you have a cluster and want to cache data that is not user-specific, you may want to use some distributed cache solution.