Default library behaviors

Tomash Brechko tomash.brechko at
Thu Nov 15 20:12:43 UTC 2007

On Thu, Nov 15, 2007 at 14:54:22 -0500, Troy Davisson wrote:
> 'get' requests going to a single cache server for a hit/miss seems
> fine but distributing 'set' requests to all cache servers seems to
> be more of a chore, especially if 'get' requests are going randomly
> to single memcached servers and you're left to pray that its the one
> 'set' went to.

Perhaps you'll get more authoritative reply covering PHP, but I looked
in the Perl module recently.  The distribution is not random at all.
Instead, a certain hash function is applied to the key (and I believe
this hash function is the same across all clients, including PHP) to
decide which server to use, thus every key is tied to a particular
server, and get goes to the same server as set went.

And the true power of get_multi() (and delete_multi() if it will be
accepted) is that it first sorts keys by server, and then queries all
servers _in parallel_.  I was touched ;).

   Tomash Brechko

More information about the memcached mailing list