It's not a secret anymore!
The moose likes General Computing and the fly likes caching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "caching" Watch "caching" New topic


raj joe
Ranch Hand

Joined: Mar 17, 2005
Posts: 99
How are static objects cached in a clustered environment
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Depends on how you implement your cache. Clusterable chaches are difficult things to do. What were you thinking of trying?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Google for "Java distributed cache" and find some solutions. The Apache JCS is one. There is a JSR in progress to put a distributed cache into the JDK or J2EE or somewhere, but it hasn't made much progress in recent years.

I think the most common approach is to broadcast a message any time a cached entry is changed using JMS or RMI or sockets or whatever for the message. The other caches in the cluster mark the key invalid so they are forced to retrieve the value from a common store next time somebody asks for it.

The system I'm using synchronizes values in memory across a cluster but they are not backed up by a database or any external persistent store. So they have to send the actual value any time one cache is updated. And I'm not sure how they bring a server that joins the cluster late up to date.

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
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
Java does not have caching or clustering so you need to refine your question. What cache product/service did you have in mind? What is being clustering?
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

This isn't a Java question, so I'll move it to General Computing, and then take a crack at it myself.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

The shortest definition I can think of for a cluster is "multiple independent processing systems tied to common storage."

There are two general models for clustering. In the Sun environment we've referred to them as HA (high availability) and HPC (high performance computing). Physically, these models are the same, so it's all about what information passes between two or more clustered machines.

In HA clusters, it's pretty simple. Each system wants to know if the other systems are working properly or not. They use the connection between them to determine if the current membership is valid. If not, they attempt to lock out down or failing systems to preserve the whole, and failover applications on the sickie machine to a healthy one. Access to a storage component is 'either-or' based on disk ownership.

In HPC clusters, the goal is to have machines working as an aggregate of processing power (what Oracle calls a 'parallel server' is the same idea). Access to common storage is negotiated by passing tokens between the systems that represent ownership of storage. Access to storage is 'either-or' based on token ownership.

In both cases, however, external storage is the fail-safe element of a failing system. Physical memory is not, unless it's backed by disk storage that another cluster member can access. In other words, it doesn't matter what kind of object you have in memory, unless the cache that contains it is saved to and retrievable from shared storage.
[ September 12, 2005: Message edited by: Michael Ernest ]
I agree. Here's the link:
subject: caching
It's not a secret anymore!