Stale data handling with memcached/consistent hashing
Asked Answered
P

2

6

Assume I have two memcached nodes (node A, B) at the beginning, and when I add a new node C, a portion of the keys are remapped and thanks to consistent hashing only some of them.

Let's assume a value with key "foo" originally at server A is now being to mapped to server C.

When I finally remove node C, the key should be mapped to node A again, but at that time node A only contains stale data.

So, is flushing the data the only way to solve this issue?

Pleasance answered 19/12, 2012 at 7:41 Comment(0)
C
2

I think the only thing you have to do with stale data is...nothing! you know that if you introduce a new server, part of cache will be invalidated. that's all! let memcached to get rid of stale data for you when that moment comes!

another thing is that you cannot get rid of stale objects by yourself, because you don t know which server store that object(thank to consistent hashing algorithm).

hope to answered your question.

Cleavable answered 21/12, 2012 at 8:57 Comment(0)
A
2

Your problem boils down to "data in your cache is stale"; so how to correct it?

So you need to update the cache with latest value. I don't think there is any alternative to this. You can consider different approaches to optimize it depending on your system requirement.

Ala answered 26/12, 2012 at 9:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.