This content has been marked as final. Show 4 replies
How long is a piece of string?
That is a bit of a vague question given that you have told us very little about your application or what you think you will gain by adding Coherence to it. Try expanding a bit on what your requirement for using Coherence is.
Our main problem is the data model and we cannot easily change it for obvious reasons. Some of the operations our application expose fetch data spread in significant tables and return large payload that once consumed hit CPU and RAM of the clients (the usual problem).
We have just start gathering some infos to Coherence as it is now part of Weblogic, which is the platform where our applications are deployed.
Now, withouth too many expectations, Coherence is introduced by the guide as In-Memory data grid caching solution .
My question is simple: do I need to modify my existing application in order to get the benefits from Coherence?
I am not asking (yet) how or what I need to change, I just want to know for now if an existing application can benifit somehow from it withouth any change on the code.
Hope it is clearer now.
OK, in most cases, yes you will need to modify your application but how much modification depends on how you want to use Coherence. If you just want to use it as a basic cache to avoid repeated database calls then you can do this with reasonably little modification. If you want to use more features of Coherence then you obviously need more modifications. It also depends very much on how your application has been built in the first place. If it is a nicely designed application with proper separation of concerns - i.e. it has a well built data access layer, then it is straight forward to plug Coherence into that layer. If you DB access code is spread all over your application then it will be a bit harder.
The most simple cache solution would be something called cache aside where when your application needs to read from the DB a it first checks the cache, if the data is there it is used instead of a DB call, if it is not there it is read from the DB and added to the cache. Alternatively, if your DB access code is quite self contained and easy to move you could look at putting that code inside cache stores and using read/write through. Your application then justs reads data from or writes to a cache and Coherence then calls your cache store to do the required DB access.
Other things you need to be aware of (which apply to any caching solution) are whether your application is the only one that does updates to the DB. Keeping the cache and DB in sync if other applications can update the database is something that also needs to be considered. There are plenty of patterns.solutions for this , again depending on the specific use cases.
There are so many ways of doing anything with Coherence that it is a bit difficult to be very specific about what advice to give you. It very much depends on your application, how it has been built and your specific use cases. Don't be put off though, feel free to ask as many questions as you want, regardless of how newbie they sound - that's what the forum is for.