|
|
|
|
|
by kijin
4741 days ago
|
|
> Q: What about data invalidation if I move servers, change the config etc. > A: It's minimum. At least better than: Node = Hash(key) MOD N Seriously? Redis is not just a cache. Let me repeat that. Redis is not just a cache. Lots of people use Redis as a primary data store. If Redis is your primary data store, you can't afford to have any of your keys invalidated, ever. "Minimum" might be good enough when you're talking to Memcached, but it's not enough when you're taking to Redis. Consistent hashing has been a solved problem for a long time if you can afford to misplace a few keys from time to time, which will happen every time a node is added to or removed from the pool. There are Redis client libraries implementing consistent hashing in nearly every language, and most of them work just fine if you use Redis as a cache or if your pool size never changes. Solving this problem again isn't particularly interesting. What really would be interesting is a server that sits between Redis nodes and clients and intelligently moves keys from one node to another in the background so that no key is ever invalidated even when the pool size changes. I believe that project is called Redis Cluster or something. That might be worth an extra TCP connection. But right now, I'm not seeing why I should prefer Redis-Router to any tried-and-true client library with built-in lossy consistent hashing. |
|
"minimum" is enough for the people who use redis for cache, since a lot of people use it for just, plain, simple, old "caching".