Search code examples
memcachedlibmemcachedconsistent-hashing

Is consistent hashing implemented consistently the same in c and java memcached clients


I want to set the Memcache value in java and get the same through c client.

Is it possible for multiple memcache environment. Does both use same hashing standards?


Solution

  • Yes it should be possible. If you read carefully memcached documentation they state that the data format has no dependencies on Java or C. The key hashing algorithm is the same between c and java client implementations.

    You should go over this nice tutorial:

    Use Memcached for Java enterprise performance, Part 1: Architecture and setup http://www.javaworld.com/javaworld/jw-04-2012/120418-memcached-for-java-enterprise-performance.html

    Use Memcached for Java enterprise performance, Part 2: Database-driven web apps http://www.javaworld.com/javaworld/jw-05-2012/120515-memcached-for-java-enterprise-performance-2.html

    BTW, if you want to use more robust impplementation of memcached you should check Couchbase that was developed by the authors of memcached.