• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Caching solution required to cache the data in memory.

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Profiling our app has revealed that a significant chunk of time is spent in database calls (all of them are basic select SQLs with differnt attributes). DB trips to fetch the data is ofcourse a performance hit.

Now to avoid this frequent db trips we are planning to keep the entire data in the temporary cache.

Can someone plese point me about any freeware caching solutions provideded that i can use to cache the db data so that i can fetch the data from the cache in a same way
like it is fetched from the DB and which also provides a efficient storage capability.

Moreover the cache that we would be maintaining is not a static cache and data will be added and deleted in it very frequently.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Moreover the cache that we would be maintaining is not a static cache and data will be added and deleted in it very frequently.


How do you avoid your database and cache diverging fairly significantly quite quickly? If the cache is you primary point of data access, should you not abandon the DB altogether and use a caching implementation that has a secondary disk cache? There are loads: EHCache, JCS, OSCache, Terracotta etc.
 
john sal
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are thinking of designing in such a way that data is stored back in the db periodically means we will do batch update of the data stored in the cache.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then something like Hibernate using a second level cache might be a way to go. You can pull data into the second level cache on demand and flush the cache periodically and the caching is configurable declaratively.

This might not be a solution if you need custom code to handle conflicts in your batch update (i.e. when someone else has updated the database or the cached data diverges from the data model constraints (by accident or design)). That would need to be bespoke.
 
john sal
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya using ORM tool like hibernate is always a better solution for such kind of scenario but unfortunately due to the large migration issues don't have luxury to use the hibernate. As of now we have to either implement it seperately or have to use some external API's for caching the data.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic