On Fri, Oct 12, 2012 at 9:18 AM, Kiran Kumar <krn1...@gmail.com> wrote:
> I have written a sample application as shown
>
> String location = "localhost:11211,122.34.5:11211";
> MemcachedClientBuilder builder = new
> XMemcachedClientBuilder(AddrUtil.getAddressMap(location));
>             mcc.set("a", 0, "Hello,xmemcached");
>
>
> Now i have memcache installed on both the IP addresses defined above . and i
> observed that if the local host server is down , data is fetched from the
> 2nd defined server .
>
> Please let me know , is there any difference between the Clustering and
> Replication here ??
>
> And i see a lot of buzz on using Repcached with memcached for replication
> purpose , please let me know if i am missing something regarding the
> difference between clustering and memcache ??
>
> Being a newbie to memcache , Plese correct me if i am wrong .

First, note that memcache is intended to be used only as a cache in
front of a slower but reliable data store where on a cache miss, the
client will pull the data from the backend store and refresh it in the
cache. Memcache itself does not do any replication, although you may
see 3rd party tools that attempt to keep redundant copies of the data.
 What is supposed to happen is that if a client notices that one of
the configured severs is down it will adjust its hashing to evenly
spread the keys over the remaining set.  Then the first cache miss
will update it in the new still-working location so other than having
a smaller capacity and possibly evicting things sooner, things
continue normally.   Alternatively you can use a hash computation that
doesn't change and just always fail on the portion of the keyspace
that the failing server handles until it comes back.  With a large
number of memcache servers, this results in a small percentage of
requests always hitting the data store directly when a cache server is
down, but avoids the chance of inconsistency if the clients notice the
outage/recovery at slightly different times.

-- 
   Les Mikesell
     lesmikes...@gmail.com

Reply via email to