File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes distributed entity beans and caching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "distributed entity beans and caching" Watch "distributed entity beans and caching" New topic
Author

distributed entity beans and caching

paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20526
    ∞

A few years ago I remember that this was a big promise of EJB that no implementation supported.
In other words, you could have an entity bean and clustered server A and the same entity bean on clustered server B. If you change a property on server A, server B will be alerted that it's cached copy is no longer any good. BUT! The servers didn't do this and shops that depended on it decided to not use entity beans at all.
For the project that I'm working on, there is some debate about our needs for caching and whether entity beans are the solution. The alternative that has been offered is to have a stateless session bean with a cache. Under the right circumstances, when a change is made, we can use JMS to spread the word that the record with ID number 45333 is now dirty. Pretty much doing what a BMP entity bean would do.
Have modern servers fixed this problem with entity beans?


permaculture Wood Burning Stoves 2.0 - 4-DVD set
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Paul Wheaton:
Have modern servers fixed this problem with entity beans?

The short answer is for the most part no. None of the major EJB Containers support distributed caching out of the box.
Originally posted by Paul Wheaton:
For the project that I'm working on, there is some debate about our needs for caching and whether entity beans are the solution. The alternative that has been offered is to have a stateless session bean with a cache. Under the right circumstances, when a change is made, we can use JMS to spread the word that the record with ID number 45333 is now dirty. Pretty much doing what a BMP entity bean would do.

I urge you not to write this yourself!!! The problem is not trivial and it is certainly not a risk you want to accept for your project. There are many third-party products that provide distributed caching that you can hook into your EJB Container (provided you are using BMP) and achieve your goals. There are even some OSS solutions available (though I would hesistate to use them in a production environment) and a full-fledged Specification is in the works called JCache. Again, I strongly suggest you do not go with a homegrown solution... the cost in development and maintainence is going to be 50x the cost of an buying a product over the lifetime of the application.
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20526
    ∞

Thanks Chris. You are now a celebrity at my company.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
I beg to differ. WebSphere actually supports distributed caching of Entity beans as of WebSphere 5.02. Take a look in the WebSphere InfoCenter under "Persistence Manager Cache invalidation API".
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Kyle Brown:
I beg to differ. WebSphere actually supports distributed caching of Entity beans as of WebSphere 5.02. Take a look in the WebSphere InfoCenter under "Persistence Manager Cache invalidation API".
Kyle

Sorry Kyle. I haven't worked with Websphere since 5.0 was first released and I didn't realize that you guys added a distributed cache to Websphere. This is definitely good to know.
Do you know of any clients that are making use of it yet? How has performance and stability been in production environments?
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by Chris Mathews:
I urge you not to write this yourself!!!

Indeed! While an interesting project, this is definitely a solved problem.
We are using Tongosol's Coherence (only in the webapp so far as we just got started with it), and it has a distributed cache (though we're not using it yet). Hopefully I will be able to work it into the EJB layer as part of our next release. If so, I'll post my findings.
BTW, we first tried OSCache (OpenSymphany), but there were deadlock issues and I don't believe it had a distributed option.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by David Harkness:

Indeed! While an interesting project, this is definitely a solved problem.
We are using Tongosol's Coherence (only in the webapp so far as we just got started with it), and it has a distributed cache (though we're not using it yet). Hopefully I will be able to work it into the EJB layer as part of our next release. If so, I'll post my findings.
BTW, we first tried OSCache (OpenSymphany), but there were deadlock issues and I don't believe it had a distributed option.

Tangosol Coherence is a great product! Definitely my choice for distributed caching. The OSS caching products (like OSCache and JCS) are nice toys but they all have serious problems and don't cut it in production environments.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: distributed entity beans and caching