Looking at memcached_get() in libmemcached-0.5 the 6th argument is
    memcached_return *error

which can have many values

MEMCACHED_SUCCESS

MEMCACHED_WRITE_FAILURE

MEMCACHED_NOTFOUND

MEMCACHED_PROTOCOL_ERROR

MEMCACHED_NO_SERVERS

MEMCACHED_HOST_LOCKUP_FAILURE

MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE

Any of these errors except SUCCESS might mean the memcached node

your data is on is down at the moment.

 

Brian Beuning

 

-----Original Message-----
From: yayu xie [mailto:[EMAIL PROTECTED]
Sent: Friday, December 07, 2007 1:17 AM
To: Troy Davisson
Cc: [email protected]
Subject: Re: How do I judge the value does not exist or there are problems
in the server?


I agree with your point of view.
 
but..........I just want to know whether the server is normal when execute a
program.
 
2007/12/7, Troy Davisson < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> >: 

I'm not sure you'll get much information from any client library that
would tell you much.  Instead of having that kind of logging in place 
within your main application (which could slow down and even reverse
what you're trying to accomplish with memcached), it may be better to
run a scheduled task in the background that attempts to grab
information from your memcached server on a regular basis.  Within 
that monitoring program, you could check for request timeouts or
anything else you'd need that may take longer than what you want a
user to have to sit through.

I think most people apply memcached towards the following situation 
when using a database:

- check cache for data
- if cache data exists, use cache data
- if cache data doesn't exist, use database data and save in cache



On Dec 6, 2007 11:30 PM, yayu xie < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:
> oh, yes! the memcached is just a cacha, if it down we will get data from
> mysql.
>
> In fact, my intention is to know what is happen when I can't get data from

> memcached. When I can't get data for the server down, I will log it for
> tracing the cause of the problem. Of cource, monitor the memcached servers
> can do it.
>
>
> 2007/12/7, Brian Moon < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>:
>
> > yayu xie wrote:
> > > I also work in PHP, and C/C++ needs some.
> > >
> > > I just have to consider the issue of when the server down, procedures
on 
> > > how to handle.
> >
> > The clients should have built in failover.  I know PHP does unless you
> > tell it not to.  It will just save to another server and get from
> > another server until the correct server comes back online.  Some people 
> > don't like that as stale cache can happen if a server is flapping (going
> > up and down over and over).  I personally don't have that issue in my
> > use case.
> >
> > -- 
> >
> > Brian Moon
> > Senior Developer
> > ------------------------------
> > When you care enough to spend the very least.
> > http://dealnews.com/  <http://dealnews.com/> 
> >
> >
>
>
>
>
> --
> My WebSite : http://www.yayu.org <http://www.yayu.org> 





-- 
My WebSite : http://www.yayu.org <http://www.yayu.org>  


No virus found in this incoming message.
Checked by AVG.
Version: 7.5.503 / Virus Database: 269.16.15 - Release Date: 12/6/2007


Reply via email to