I attended a seminar yesterday that was all about the Oracle Coherence product. What is Coherence? In short Coherence is a scalable, distributed object cache with added functionality to provide filtering, triggers and updates. There is also the capability to write objects from the cache to a backing database store using Hibernate or JPA. The scaling and fault tolerance are particularly impressive with each cache object having an easily determined location meaning no single points of failure for a registry server and little, if any, performance degradation when servers are added.

I foresee Coherence being useful for applications that need to scale significantly and that need to use an in memory cache to speed performance.

The programming model, though, is more problematic. Basic cache access is achieved through a Map interface where objects are associated with keys. Added to this are methods to listen to events, filter the cache and update it. The API for these operations reminded me a lot of Groovy closures and their operations on collection classes. The issue comes with object relationships. The API, as far as I can see, makes no provision for the storing of relationships between objects in the cache. This means that domain objects stored in the cache need to be aware of how to obtain related objects from the cache. Serialization methods need to know what the serialization boundaries between objects are and how to save related objects. No doubt there would be ways to encapsulate this access into a framework to remove the dependencies from the domain objects but be aware that this is a very different kettle of fish from the ease and convenience that we are used to from Hibernate and JPA.

All in all Coherence seems like an interesting addition to the Architect’s toolkit that may just be the right choice for interesting performance and scaling challenges.

Tags: , , , , ,