Cache::Memcached question

Joachim Bauernberger joachim@bauernberger.org
Mon, 3 May 2004 22:53:40 +0200


Hi Brad,

On Monday 03 May 2004 18:47, Brad Fitzpatrick wrote:
> That's not desirable behavior when you have 40 memcached servers.  It's
> okay (and expected) for hosts to be down.
>

Thx for the reply.

I agree that it can happen for hosts to be down, but why is it expected for 
hosts to be down?

IMHO one should be able to know which connections failed. (- Maybe it was just 
a typo in a config.)
 
Not knowing, makes debugging harder than it needs to be.

The current implementation gives me no way of knowing. I could place anything 
into the servers array and get away with it.

I think that one should be able to at least "trap" failed connections. 
In my case I depend on the connection being OK (and if not I must know about 
it ...)

Regards & thanx again,
~/joachim

> On Mon, 3 May 2004, Joachim Bauernberger wrote:
> > Hi,
> >
> > ... just had look at Memcached.pm ...
> >
> > From what I could see, the connections aren't made when calling
> > new Cache::Memcached
> > ... which would explain why I didn't get the errors (silly me).
> >
> > In order to get what I want I modified Memcached.pm and simply called
> > sock_to_host in set_servers() for every server:ip in @list
> >
> > Think this is the correct way since the sockets are kept global in the
> > %cache_sock hash, no?
> >
> > Regards,
> > ~/joachim
> >
> > On Monday 03 May 2004 12:37, Joachim Bauernberger wrote:
> > > Hi,
> > >
> > > How do you guys check if the connection to memcached was successful?
> > > No matter what I put into $config_memcachedhost below and no matter if
> > > memcached is running, the following would always result in a defined
> > > $memd object returned. Also $@ is empty.
> > >
> > > How do you trap errors in connection setup?
> > >
> > > sub init_memcached
> > > {
> > >     eval {
> > >         $memd = new Cache::Memcached {
> > >         'servers' =>  @config_memcachedhosts ,
> > >         'debug' => $config_memcached_debug,
> > >         'compress_threshold' => $config_compress_threshold,
> > >         }
> > >     };
> > >     die localtime()." Error connecting ($!) Cache::Memcached: $@\n" if
> > > ($@
> > >
> > > || !defined ($memd));
> > >
> > >     return;
> > > }
> > >
> > > Thanks & best regards,
> > >
> > > Is there a cvs for this too?
> > > Brad wanted to do something like $memd->errstr() IIRC in future
> > > releases.
> > >
> > >
> > > Thanks & Best regards,
> > > ~/joachim
> >
> > --
> > Web: http://www.bauernberger.org/

-- 
http://www.bauernberger.org/
mailto:joachim@bauernberger.org
Tel/Fax: +(49)-0-89/1588 3874
HP: +(49)-0-179/674 3611