Hi Adam, One thing i missed here is that i am using "Memcache" and not "Memcached" client library.
Memcache library doesn't have CAS operation. So is either of libraries are same or one have advantages over other? Which library is advisible to use? Regards, Sagar Sonawane On Jan 25, 11:08 am, nEosAg <[email protected]> wrote: > Hie.. Thanx for the reply. > > I have few doubts with CAS operation (it was same problem with pseudo- > lock), > > In CAS apporoach also i have to loop indefinitely till my SET > operation is done, so what if Memcache Server goes down ( by any > possible means ) , then our code will loop indefinitely till it gets > Up. > > so do we have any option by which we can check if server is up, also, > we can't use getServerStatus as it is Host based. I mean we have to > pass Host IP and port to get its status. But our major problem is we > dont know which server will be selected by Hash Algorithm. > > I havent used persistent connections in my case, haven't tried yet. I > don't know how much it will impact the performance. > > Thanks again. > > Regards, > Sagar Sonawane > > On Jan 22, 11:41 pm, Adam Lee <[email protected]> wrote: > > > Why are you using the pseudo-lock operations around the set? Memcached is > > itself atomic, in that no two sets can corrupt each other and get is always > > guaranteed to return exactly what was set. > > > Plus, if you want to do locking, I'd recommend doing it with CAS instead. > > > 50 clients should be no problem at all for 8 servers. Are you using some > > sort of connection pooling? It sounds like you probably have a lot of > > unused connections hanging around or something. I believe in PHP this is > > called "persistent connections." > > > Also, if you do a stats on the servers, how many connections do they think > > that they have? And how many were they configured to handle? > > > On Fri, Jan 22, 2010 at 10:31 AM, nEosAg <[email protected]> wrote: > > > I have 8 memcache instances running and used default hashing policy > > > with failover set to False. > > > > So, after lots of monitoring i came to know that some of my memcache > > > instances gets down/ connection refused to client. > > > > I m using PHP client Library. > > > > At times, when i checked Stats for servers then there were few > > > thousand connections. Then i changed my code to make connection when i > > > need to SET or GET any Key and after the operation close the > > > connection. > > > > My Approach is Get LOCK (pseudo like adding key with lock prefix) on > > > Key then SET data then delete LOCK key. > > > > Then, it minimized close to no flapping. But still there is another > > > problem. > > > Now, i wanted to knwo the status of the server before doing any GET / > > > SET operation as there are almost 50-100 concurrent(users) hits to > > > Cache so obviously there will be Data Integrity issues. So to > > > implement atomicity i need to know if Server is up and running then > > > only perform update Cahe operation otherwise do nothing to cache. > > > > I have gone in infinite loop might over thinking it!! But as per my > > > requirement i need 100% consistency in Real Time :) > > > > Please help me or guide me if my approach is wrong. > > > > Regards, > > > Sagar > > > -- > > awl
