Simple questions from memcached newbie

Jeetendra Mirchandani jeetum at gmail.com
Wed Oct 11 18:29:32 UTC 2006


Going a little off topic here, has somebody worked on writing a data
redundancy layer over memcached?

What I would love to have is memcached servers talking to each other
maintaining replicas, so that even if a server goes down, the data is
not lost.

I know this involves lot of complication, if the servers have to talk
between themselves, but ideally the client could also do this.

Let me propose a simple algorithm here:

Suppose my key is 'k', and I have n equal instances of memcached

* the client picks server s1=hash(k) % n to have the first copy, 
and s2=hash(k) % (n-1), leaving out s1 selected earlier.

* On read access, randomly distribute reads between s1 and s2.

* All writes/deletes will go to both s1 and s2

* Let LRU decide when is the record flushed out from each s1 and s2.

Does anybody see any drawbacks in such a approach. This way, the servers
dont really have to talk to themselves. The consequence being that if s1
and s2 both go down, you loose the data, but that is fine to start with.

Any thoughts?

Jeetu


On Wed, 2006-10-11 at 12:38 -0400, Jeremy Blain wrote:
> howard chen wrote:
> 
> > 1. If the memcached server goes down, the time is finding where the
> > server is alive will be a bottom neck to your application?
> >
> > e.g.
> >
> > my $obj = $::MemCache->get("foo:$foo_id"); // your application will
> > eventually die at this, if memcached down?
> >
> You should just get back undefined.  Your application should not die.
> 
> >
> > 2. How to calculate the efficiency of memcached server, e.g. given
> > 1000 KB of memory allocated, how many % are actually used for storing
> > the data itself?
> >
> It depends on what you're storing really.  Our use is at about  75%.
> (1 gig = 750mb stored).  Your usage can vary depending on the size of 
> objects
> you store.  Newer memcached code is supposedly more efficent, but I havn't
> tested it personally.
> 
> > 3. in a distributed environment, i have say 2 memcached server, if the
> > item is no longer valid on one server, how much time is needed for
> > another server to know this?
> >
> Your data will only be in one server.  Which server to put the item in 
> is chosen by
> the client.
> 
> 



More information about the memcached mailing list