Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Can Coherence update cache from 2 sources and how it works

Posted on 2013-05-30
4
Medium Priority
?
468 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 28

Assisted Solution

by:dpearson
dpearson earned 1500 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 28

Accepted Solution

by:
dpearson earned 1500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

876 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