bigdata4u / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

Spymemcache Hashing Algoritham #229

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Platform: spymemcached-2.7.3.jar, 64 bit Windows 7 OS

We have two membase servers (Non Clustered Environment) and we are using 
spymemcached java client for setting and getting data from memcache. We are not 
using any replication between two membase servers.

We are using following code to set data in memcache. Looks like MemcachedClient 
always first try to put/get data in server1 if its available. If server1 is 
down, then MemcachedClient put/get from server2.
Does spymemcached uses any hashing algoritham to decide from which server it 
needs to set/get data? Any documentation available which explains how it works?

code
====

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

import net.spy.memcached.MemcachedClient;

public class Main {

  public static void main(String[] args)
    throws IOException, URISyntaxException {

    MemcachedClient client;

    URI server1 = new URI("http://192.168.100.111:8091/pools");
    URI server2 = new URI("http://127.0.0.1:8091/pools");
    ArrayList<URI> serverList = new ArrayList<URI>();
    serverList.add(server1);
    serverList.add(server2);
    client = new MemcachedClient(serverList, "default", "");

    client.set("spoon", 50, "Hello World!");
    client.shutdown(10, TimeUnit.SECONDS);

    System.exit(0);
  }
}

Original issue reported on code.google.com by mnrat...@gmail.com on 18 Jan 2012 at 10:17

GoogleCodeExporter commented 8 years ago
Please don't post questions about Spymemcached in the issues section. I saw 
that your question was also posted on StackOverflow and answered it there. If 
that answer is not sufficient or you would like to have a discussion about this 
issue please post it on the Spymemcached google group. 

Original comment by mikewie...@gmail.com on 18 Jan 2012 at 6:29