File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes cache expensive data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "cache expensive data" Watch "cache expensive data" New topic
Author

cache expensive data

John Molitor
Ranch Hand

Joined: Nov 08, 2004
Posts: 39
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

Joined: Jan 29, 2003
Posts: 8791
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?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29253
    
140

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
John Molitor
Ranch Hand

Joined: Nov 08, 2004
Posts: 39
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cache expensive data
 
Similar Threads
Need to refresh internally cached data
Regarding JCS Cache replication .....Please Help
Session Question
Can I cache the global data in weblogic
EJB entity bean or JDBC?