• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cache expensive data

 
John Molitor
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application that has 4 servers total on two different boxes. I need to get a list of data from another system via remote EJB. It is too expensive to call this EJB over and over again. I would like to cache the data, but the data is not static, so if cached I would need to expire the cache on all 4 servers when the data changes. Any suggestions?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you're stuck with the best reason to cache - expensive calls - and the best reason not to - data changes.

Can you get the other server to tell you when the data goes stale? JMS pub-sub is good for that. Or make an inexpensive call to ask it?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
How up to date does the data need to be. On a frequently used system, expiring the cache after a minute (or X seconds) will still yield some improvement.
 
John Molitor
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I might be able to get away with the flagging the data as expired after an hour. That would help I'm sure. It sounds like there isn't really a great way to do it. I was also considering a view of data in my schema to the other schema, but I would rather not do that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic