CHECK WHAT I'M USING WITH PECL: (i just work with one memcache server)
it removed all wrong return from pecl library, since it's don't return
sometimes and i retry again, if the status of servers are ok and i
didn't get any return it's because i don't have anything to get
<?php
class Memcache_ext{
private $m;
private $host;
private $hostcount=0;
function Memcache_ext(){
$this->m=new Memcache;
}
function __call($f, $p){
$m=&$this->m;
if ($f!='get' && $f!='set' && $f!='add' && $f!='replace'){
$c=count($p);
if ($f=='connect' || $f=='pconnect'){
$this->host=$p;
$this->host[3]=$f;
$this->hostcount=1;
}elseif($f=='addServer')
$this->hostcount++;
if ($c==0)
return(call_user_func(array(&$m,$f)));
elseif ($c==1)
return(call_user_func(array(&$m,$f),$p[0]));
elseif ($c==2)
return(call_user_func(array(&$m,$f),$p[0],$p[1]));
elseif ($c==3)
return(call_user_func(array(&$m,$f),$p[0],$p[1],$p[2]));
elseif ($c==4)
return(call_user_func(array(&$m,$f),$p[0],$p[1],$p[2],$p[3]));
elseif ($c==5)
return(call_user_func(array(&$m,$f),$p[0],$p[1],$p[2],$p[3],$p[4]));
elseif ($c==6)
return(call_user_func(array(&$m,$f),$p[0],$p[1],$p[2],$p[3],$p[4],$p[5]));
return;
}
if ($this->hostcount!=1){
if ($f=='set')
return($m->set($p[0],$p[1],$p[2],$p[3]));
elseif ($f=='add')
return($m->add($p[0],$p[1],$p[2],$p[3]));
elseif ($f=='replace')
return($m->replace($p[0],$p[1],$p[2],$p[3]));
return($m->get($p[0]));
}
$ret=false;
$h=$this->host[0];
$pt=$this->host[1];
$to=$this->host[2];
$fc=$this->host[3];
while ($ret===false){
if ($f=='set')
[EMAIL PROTECTED]>set($p[0],$p[1],$p[2],$p[3]);
elseif ($f=='add')
[EMAIL PROTECTED]>add($p[0],$p[1],$p[2],$p[3]);
elseif ($f=='replace')
[EMAIL PROTECTED]>replace($p[0],$p[1],$p[2],$p[3]);
else
[EMAIL PROTECTED]>get($p[0]);
#if ($f=='set'){
# echo "ret=";var_dump($ret);
#}
if ($ret!==false)
break;
[EMAIL PROTECTED]>getExtendedStats();
#echo "st=";var_dump($st);
#echo "$h:$pt\n";
if (!isset($st["$h:$pt"])){
}elseif ($st["$h:$pt"]==false){
}else
break;
@$m->close();
if ($fc=='connect')
@$m->connect($h,$pt,$to);
else
@$m->pconnect($h,$pt,$to);
$m->setServerParams($h,$pt,$to,15, true);
}
return($ret);
}
function __destruct(){
@$m->close();
}
}
#$m=new Memcache_ext;
#$m->connect('172.16.0.1',11211);
#print_r($m->getExtendedStats());
#while(1){
# $m->set('a','b');
# print_r($m->get('a'));
#}
?>
Don MacAskill escreveu:
So we're having rare (maybe a dozen errors per multiple billion
requests) errors with the PECL memcached client. The server failed
callback is fired, but the server in question is up, has lots of open
connections, etc etc. Other clients, like our custom PHP client,
aren't showing any errors whatsoever.
Others at the hackathon mentioned similar issues, again only at large
scale.
Since the failback callback only accepts host/port and not other
useful data like an error message or even the command that was issued,
it's been hard to debug and reproduce in a fixable manner.
But I'd be all over it if someone could help me track it down. :)
Thanks!
Don
Mikael Johansson wrote:
Hi, pecl/memcache is maintained and the new NON_BLOCKING_IO branch
adds many new features, one of which is more specific error messages.
Other features include UDP support, pipelining and consistent
hashing. But yes, during the summer not much work has been done so
help with stabilizing the new branch and addressing bugs that crop up
would be welcome. //Mikael On Wed Aug 22 11:46 , dormando sent: >-
pecl/memcached needs work, but no one's maintaining it? Are there
>alternatives? The PHP client frontier is mired. I tried to look into
an >error but found the same error message was copy/pasted in nine
different >places in the code. Not worth it. [snip]
Esta mensagem foi verificada pelo E-mail Protegido Terra.
Scan engine: McAfee VirusScan / Atualizado em 23/08/2007 / Versão:
5.1.00/5104
Proteja o seu e-mail Terra: http://mail.terra.com.br/