Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

caching

 
raj joe
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are static objects cached in a clustered environment
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on how you implement your cache. Clusterable chaches are difficult things to do. What were you thinking of trying?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rick O'Shay
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a Java question, so I'll move it to General Computing, and then take a crack at it myself.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic