memcached client way of working
reffael at yahoo.com
Sun May 6 11:13:26 UTC 2007
I went over the memcached client code (in .NET but it is the same in Java) to understand how it works.
I saw that in Get and Set methods one of the first things being done is:
SockIO sock = SockIOPool.GetInstance(_poolName).GetSock(key, hashCode);
Getting a socket from the chosen bucket/server using one of the HashingAlgorithm functions, if no socket available on the chosen bucket the hash function is being called again with a different key to choose another bucket.
After we get the socket, on the Set method we send the key:value to the relevant bucket and on the Get method we send a key for the chosen bucket and wait for the returned value.
1 I don’t understand how we can be sure we get the same bucket on the get and set, if on the Set operation we get the available socket from the first chosen bucket and on the Get operation we get another socket from another bucket because there were no avialble sockets on the first choice.
2 Also I don’t understand, how it is aligned with what Brad is saying on the article - http://www.linuxjournal.com/article/7451
“Step 2: the Memcached client sends parallel requests to all relevant Memcached servers.”
I don’t see where the client sends parallel requests to all the buckets.
What do I miss?
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
More information about the memcached