Md5 cache keys in Memcache
In this reddit blog post, the author talks about MD5ing the cache keys and hence the reason why they find it very difficult to scale out.
Can someone tell me why one would want to md5 cache keys? I didn’t understand the reason even though they explained it as
“A few years ago, we decided to md5 all of our cache keys. We did this because at the time memcached (which is what memcachedb is based on) could only take keys of a certain length. In fact, the version it is based on still has this limitation. MD5ing the keys was a good solution开发者_如何学C to this problem, so we thought.”
The key size back then was probably shorter than it is now (currently 250 bytes - and 250 bytes is a pretty huge key name) meaning a sensible key naming convention may not have been possible, so they just used the sensible naming convention and md5'd it.
We did this because at the time memcached (which is what memcachedb is based on) could only take keys of a certain length
I guess that since some keys where larger than the max length the server allowed, they decided to create a md5 of the key to store it.
However, I'm not sure there is a relation between this and the fact that they can't easily add new servers (since memcached also use hashing to even repartition .. maybe memcachedb doesn't)
精彩评论