Solved

Can Coherence update cache from 2 sources and how it works

Posted on 2013-05-30
4
448 Views
Last Modified: 2013-06-09
I have a Rest Based Java application which creates and gets data from SAP Gateway for sales order. The Order in SAP keeps updating with status of order such as dispatch/closed/canceled from messages.

The application is expected to be slow. Introducing coherence in java to SAP layer is expected to improve the performance but there is a risk that the data in coherence layer will be stale and so order data on UI will be old due to cached data.

How can we handle coherence cached order detail data which is getting updated from 2 sources?

Should we upgrade to SAP Hana (which is not popular or yet stabilized) in comparison to Coherence/Giga Spaces/Data Grid. Which is the best caching mechanism and how to handle  stale data.
0
Comment
Question by:jgdvishnu
  • 2
  • 2
4 Comments
 
LVL 26

Assisted Solution

by:dpearson
dpearson earned 500 total points
ID: 39212372
Are you saying that you are updating the order status without always doing this through the coherence layer?

If so, stale data in the cache is inevitable - as the cache is unaware of some updates and will only see them when you read through the cache to the data store.  If you always do this read through then you'd get no stale data - but you'd also get no benefit from the cache.

The only way to ensure the cache is not storing stale data is to ensure that any time the data being cached changes, that the new value is explicitly sent to the caching layer (coherence or whatever you choose to use).  If you do that, there should never be a problem with stale data.

However, for many applications having stale data is not a huge problem.  You may for instance decide that it's acceptable for the data to be up to 1 minute out of date.  You can support that by having the cache layer only cache the data for 1 minute before evicting it.  That can still give you a lot of performance benefits if the same data set is frequently requested, but occasionally you will be viewing out of date information.

You would of course then need to handle that if a user attempts updates based on that out of date information.  E.g. You could store a 'last-update-timestamp' in the data set, and send that in with any updates.  If the data later receives a timestamp which doesn't match the current value it knows that somebody changed the data and the request is based on out of date information and should be rejected.

If your application cannot ever allow that to happen then you need to ensure that the cache sees all updates.

Hope that helps,

Doug
0
 

Author Comment

by:jgdvishnu
ID: 39233217
Doug,

thanks a lot.
One part of the answer still needs clarification.
In coherence, Is it possible to update some table frequently compared to other tables.
if yes then how
0
 
LVL 26

Accepted Solution

by:
dpearson earned 500 total points
ID: 39233504
I'm not familiar with the specifics of how you configure Coherence, but generally you can support this only if you create 2 logical caches - one that updates frequently (and is used to cache table set #1) and one that updates less frequently (and is used to cache table set #2).  

How hard that is to support (having 2 caches to the same db) depends on your application, but it may be significant work to add it in.
0
 

Author Closing Comment

by:jgdvishnu
ID: 39233557
this is a good insight into the problem.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now