Memcache connection errors

Paul Querna chip at
Thu May 25 03:04:57 UTC 2006

timeless wrote:
> Reinis Rozitis wrote:
>> $mc = new Memcache;
>> if (!$mc->connect('',11212)) { 
>> $mc->connect('',11212); }
> In this case, if the memcached on never answers, you'll wait 2 
> seconds before failing to get the connection?
> To the list, is there a way to get sub-second connection timeouts?
> I'd kind of like to implement exactly this, but our memcached cluster is 
> about 9 hosts, and if any one is down, it would cause executive-level 
> despondancy if the site went from 0.5-second page render times to 
> 2.5-second page render times until we pulled the errant memcached 
> instance out of the pool.

The trick is to store your list of memcache servers in a config file. 
(Or some other configuration method)

Then you have some other process that updates this config file if a 
memcache server is down -- without changing the total size of the 
memcacehe server array, thereby keeping the distribution of most items 
in the cache.

I do this with apr_memecache -- not sure how to do it on other client 


More information about the memcached mailing list