Implementing Coherence Cache-Aside pattern using Coherence Goldengate Adapter
By Satyajith Nair on Mar 08, 2013
A common requirement in Enterprise SOA Initiatives is to create a Business Look-up data cache which contains business look-up data. This data is used across the organization and controls the behavior of various organization processes, business calculations and is also used for populating drop-down lists in the Business Application User Interfaces.
This look-up data also requires to be maintained because as the Business changes, there is change to this look-up data. Hence a business friendly user interface needs to be designed for this look-up data.
Oracle Coherence can be used to store this data in memory for efficient and fast look-ups. The data can be persisted in an Oracle Database. It is recommended to have the entire data set being stored in the cache so that there are no cache misses. This kind of a solution typically ends up using a Cache-Aside Pattern. In this pattern the cache data is entirely managed by the application developer. A representation of this pattern is given here.
One of the key challenges in this architecture is identifying what data has changed in the persistent store and updating the cache with the changed data. As represented above, this requires complex custom programming for each data element. This is a very brittle integration and will become a maintenance nightmare as the data structure changes over time.
This is where the Coherence Goldengate Adapter (yet to be released as of the date of writing this blog) will play a big role. Instead of having some kind of custom programming, triggers etc on the persistent data store, Goldengate can extract the changed data from the persistent data store database logs and update the coherence cache directly. This greatly simplifies the architecture and makes the implementation of the Cache-Aside Pattern very easy. The new pattern is represented here.
Benefits of this architecture –
1. Simplify development of Cache-Aside Pattern for Coherence implementations
2. Maintenance of the Cache-Data Store integration becomes simpler and easier
3. Update the cache without firing any query on the persistent data store
4. Capture the changes in real-time and update the cache automatically
References and further reading-