PECL memcache extension

Don MacAskill don at
Mon Feb 6 00:46:59 UTC 2006

What about the case where a new child spawns which doesn't know that the 
server was offline?  It sees that it can connect, and assumes the data 
is up-to-date.

If it's the first client to connect, though, it's getting stale data and 
doesn't know that it needs to flush.  Whenever another client connects 
which DOES know that it's stale, of course, it'll get flushed - but 
there's still that window during which stale data could pollute things.

Which is why the only solution I've been able to think of is to 
externally track the state.  Since you check the external state tracker 
first, before building connections, you know which servers are "offline" 
and can react accordingly.

Make sense?


Jehiah Czebotar wrote:
> I have to offer my opinion; because i think changing the client
> extension will only fix some of the cases where you may get stale data
> in memcached due to failover / disconnects.
> Consider a scenareo like this : (for simplicity assume you use
> persistant connections on the client side)
> server A is a consumer of memcached data only
> server B is a consumer, and provider of memcache data.
> some issue causes server B to be unable to update memcached cached
> data (but it still updates the back end data source).
> server A gets stale data because it doesn't know it should be failling
> back to db because that logic was implemented only in the client code
> on server B
> In a senario like this (which is the absolute worst case I can think
> of) the only way to be 100% sure memcached has no stale data is to (on
> the memcached side) flush the data after every disconnect.
> Yeah that sounds drastic but think it through. Even though not all
> disconnects are un-intentional (and leading to stale data) this would
> reliable catch 100% of the cases where you could get stale data. Yes
> it could significantly lower your hit ratio; but that might be a small
> price to pay for peace of mind.
> If nothing else, it sounds like it would be a usefull command line
> switch to me, and i'll be adding it to my java memcached port.
> Thoughts?
> --
> Jehiah at

More information about the memcached mailing list