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 12:13

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 the

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 (https://github.com/memcached

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: 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 do

Re: Monitoring specific key patterns in Memcache server

2016-06-04 Thread Nishant Varma
Forget this one, I understood why you say I am overengineering this in the other post. I read this one first since it gets listed on top in the forum. So let me try to get the Ghetto Locking in place. On Saturday, June 4, 2016 at 3:40:09 PM UTC+5:30, Nishant Varma wrote: > > Thanks. Can you plea

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 file

Re: Windows

2016-06-04 Thread Nishant Varma
There are some links like this that might help http://stackoverflow.com/questions/14777857/how-to-install-and-use-memcached-in-windows-for-php. However you could also deploy this as a Linux service in case you want to avoid these hassles. On Wednesday, June 1, 2016 at 6:52:47 PM UTC+5:30, Rafa

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 dormando
The pattern is identical between the one in the wiki and yours. Simply move the delete of the key until you're done using the lock, which would be in a separate request. In your case, you would probably set the contents of the key to be the name of the user who has it locked. In the original pseu

Re: Monitoring specific key patterns in Memcache server

2016-06-04 Thread dormando
The main reason why you're overengineering is because you already have one verified problem: Your lock routine is absolutely guaranteed known to be wrong. In the general practice of troubleshooting software, if you have known issues fix those right away. Removing one known bug will help isolate an