Re: Reviewing a script to demo memcache get-set race conditions problems if it is used for distributed locking.

2016-06-04 Thread Nishant Varma
I did see Thread 1 and Thread 2 as well. It also has some resources on this topic. Anyway, isn't the below pattern simple enough? Do we need any more

Re: Reviewing a script to demo memcache get-set race conditions problems if it is used for distributed locking.

2016-06-04 Thread Nishant Varma
I am reading https://github.com/memcached/memcached/wiki/ProgrammingTricks#ghetto-central-locking, it seems to deal with a slightly different lock scenario of getting some expensive item from Database to avoid "Stampeding" In my case its slightly different lock that I need. I show regular

Re: Reviewing a script to demo memcache get-set race conditions problems if it is used for distributed locking.

2016-06-04 Thread Nishant Varma
Excellent I rely on you. I guess this is the reason you say I am over-engineering this problem. Makes sense :-) I will again check the link you gave me. I will go through the documentation this weekend. On Saturday, June 4, 2016 at 1:33:04 PM UTC+5:30, Dormando wrote: > > Hey, > > You really

Re: Monitoring specific key patterns in Memcache server

2016-06-04 Thread Nishant Varma
Thanks. Can you please tell me why you say that I am overengineering. Maybe I am but I wanted good reasons so that I convince myself. The problem is some times locks are not happening like say 2-3 times out of 3000 requests, and I have only 4 reasons so far - 1) get-set race 2) memcache client

Re: Monitoring specific key patterns in Memcache server

2016-06-04 Thread dormando
Hey, Memcached can't do that easily right now. You can use the STDOUT logging but that requires reading everything the server is doing directly. I started a branch for a better logging situation a few months ago, and am picking it up to finish over the next few weeks

Re: Reviewing a script to demo memcache get-set race conditions problems if it is used for distributed locking.

2016-06-04 Thread dormando
Hey, You really don't need to test this: I'm telling you flatly, as an author of this software and all of the documentation for it, that you should absolutely not rely on that pattern. I'm trying to save you some time. The pattern that is slightly better is written explicitly in pseudocode in

Re: Monitoring specific key patterns in Memcache server

2016-06-04 Thread Nishant Varma
Real time of offline solutions would be helpful. If I can profile in background and query it later that is one option. However the only concern with profiling is that I don't need to profile everything. Or does memcache do this by default? Can anyone guide me? On Saturday, June 4, 2016 at

Monitoring specific key patterns in Memcache server

2016-06-04 Thread Nishant Varma
I am trying to troubleshoot an issue which could happen because of get-set race condition. I can monitor the entire memcache operations but I guess it is going to be huge because its a small percentage of the DB itself, so I need to filter only the keys I am interested in. We have a namespacing

Reviewing a script to demo memcache get-set race conditions problems if it is used for distributed locking.

2016-06-04 Thread Nishant Varma
Can anyone help me peer review this script https://gist.github.com/varmanishant/0129286d41038cc21471652a6460a5ff that demonstrate potential problems with get set if it is used to implement distributed locking. I was suggested to modify from get set to add in this thread