<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Constantin B wrote:
<blockquote
 cite="midd98b323f0606071227v6681c48ep71fdc2adb61e258c@mail.gmail.com"
 type="cite">How do you manage the tcptimeout to connect to memcache
server when its "half/down" , the timeout must be very low ?<br>
  <br>
  <div>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Actually,
what you want to do is keep the server in the pool, but flag<br>
it as down</blockquote>
  </div>
</blockquote>
That's where the "flag it as down" becomes important. Make your
memcached server list something like:<br>
<br>
("10.0.0.1," 11211, "up"),<br>
("10.0.0.2", 11211, "up"),<br>
("10.0.0.3", 11211, "up")<br>
<br>
Change "up" to "down" when a server goes down. Write your memcached
client so the hashing algorithm entirely ignores "up" or "down" -- But
the get(), set(), etc *DO* pay attention such that every operation
fails on a "down" server without even attempting to make a call to the
Memcached server.<br>
<br>
Thus the key always hashes to the same server, but the client doesn't
hang waiting on a Memcached server that doesn't exist to answer the
get() calls.<br>
<br>
Others have recommended that if the hash lands on a server that's
"down" that you rehash on the remaining servers and store the key
there. I personally lean toward the "make everything a cache miss"
solution because, as noted, flapping servers will cause inconsistent
results in the cache.<br>
<br>
--<br>
timeless<br>
<br>
</body>
</html>