Hi
We're configuring a cluster with a 1st line of nginx-based web servers acting as proxy/cache/memcached/balancer in front of a 2nd line of Tomcat/php-fpm servers. We've developed a Tomcat filter that stores all our pages on the memcached servers, and then the nginx servers first check if the page is already available on memcache, else they proxy the request to the Tomcats.
Everything works OK when we have just one memcache server, but when we have more than one we can't make the nginx memcache hashing algorithm and the spymemcached one match.
On the nginx side we're using this backend to access the memached servers:
And for PHP we use:
And they both match, 100% of the times. But we can't get spymemcached to match that same hashing too, we got roughly a 50% coincidence with 2 memcached servers so the algorithms don't match.
We're initializing spymemcached like this:
DefaultConnectionFactory dfaultConnFctry = new DefaultConnectionFactory( DefaultConnectionFactory.DEFAULT_OP_QUEUE_LEN,
DefaultConnectionFactory.DEFAULT_READ_BUFFER_SIZE,
HashAlgorithm.CRC32_HASH);
c = new MemcachedClient(dfaultConnFctry, AddrUtil.getAddresses(f.getProperty("presentation.staticweb.memcache")));
And of course that getProperty returns the same array of memcached servers and in the same order as we've them on both nginx and PHP.
How could we reconfigure spymemcached to match the others? Or alternatively, anybody knows a memcached consistent hashing algorithm that works 100% on these three implementations, nginx, php and Java/spymemcached?
Thanks in advance.
Regads,