Yii 1.1.15 - memcached fail with two node if one is down

Hi

I’m using Yii 1.1.15 and php memcached 2.0.7 (not memcache) configured with two nodes as follows:


'cache'=>array(

		'class'=>'system.caching.CMemCache',

		'useMemcached' => true,

		'servers'=>array(

		array('host'=>'10.0.0.17', 'port'=>11211, 'weight'=>50),

		array('host'=>'10.0.0.109', 'port'=>11211, 'weight'=>50),

					),

			),

Both node are working from a application view, both are accepting connects from my application server (when I configure only one). When I take one node down for simulating some memcached crash, it seems the other node does not exists from Yii’s perspective (just when configured as single node). What am I doing wrong?

EDIT:

Did another test this time against pecl php memcache Version 2.2.7 instead of php memcached and it could handle two nodes as well one of the down.

Would say memcached version 2.0.1 has bug or Yii when it should handle more than one node and one of them failing.

EDIT 2:

Assume a Yii bug as I get the exception that one node is down with memcache but not when using memcached php extension.

Shouldn’t that be prevented by Yii to turn my application down:

<h1>PHP Error [8]</h1>

<p>Memcache::get(): Server 10.0.0.17 (tcp 11211) failed with: Connection refused (111)</p>

I get randomly on some requests 500 Internal Server Error as Yii can’t work with Memcached nodes which are down…

EDIT:

Ok solved the problem which is related to the retry interval when occasionally the server connection fails again.

Solution found here:

http://php.net/manual/en/memcache.addserver.php

" retry_interval

Controls how often a failed server will be retried, the default value is 15 seconds. Setting this parameter to -1 disables automatic retry. "

Now my configuration looks like:




'servers'=>array(

   array('host'=>'10.0.0.17', 'port'=>11211, 'weight'=>90, 'status' => true, 'retryInterval' => -1),

   array('host'=>'10.0.0.109', 'port'=>11211, 'weight'=>10, 'status' => true, 'retryInterval' => -1),

					),



I’ve set status and retryInterval. So case almost closed…Yii should catch those retry connection error which leeds to 500 server errors…