System architecture best practices - memcached + webfarms

Brad Fitzpatrick brad at danga.com
Mon Jul 2 23:39:05 UTC 2007


On Mon, 2 Jul 2007, Dustin Sallings wrote:

>
> On Jul 2, 2007, at 15:16 , Brad Fitzpatrick wrote:
>
> > But even without that, your web nodes should already have all the TCP
> > connections open to all the memcaches (or most of them), so then your
> > get_multi implementation should just do a non-blocking write to all of
> > them "at once" (actually in serial, but you're not waiting for a
> > reply, so
> > network latency, so it's pretty much "immediate"), then you select/
> > epoll
> > on them all at once, reading from them in order.  If your
> > implementation
> > does a serial get_multi to each one, then the network latency over 100
> > requests will kill you, and you should fix the client API you're
> > using.
>
> 	What do you do if you get responses back for a single key from more
> than one server?

You don't, because you ask each server only for what you want from it.

If you're doing a get_multi(A,B,C) in your app, that translates on the
wire to, say:

     10.0.0.1:11211 "get A B"
     10.0.0.2:11211 "get C"


- Brad



More information about the memcached mailing list