Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Cache replication

$
0
0

I'm using EhCache 2.10.2. Synchronous replication (replicateAsynchronously=false) between two servers (S1 and S2).

I have next situation:

  1. First HTTP request going to S1
  2. S1 can't find object in cache and loads it from DB with state "A" and puts to cache
  3. S1 changes object's state to "B", saves to DB and puts to cache
  4. S1 sends success response
  5. Next request going to S2
  6. S2 finds obect in cache with state "A"
  7. S2 sends error response, because object must have state "B" on second request.

When server puts object to cache, thread blocked on put operation only to send serialized object to another server, and don't wait while another server deserialize and put element to cache. So at point 6 can be state "A" or "B", if we get lucky.

Is it possible to configure EhCache to block operations until changes replicated on all nodes?

May be I need to replace EhCache with other cache implementation, or change everything?


Viewing all articles
Browse latest Browse all 17268

Trending Articles