Ok, I've left it set to True.

A quick comment about a couple of tests I did regarding RedisSession (that 
also has a "with_lock" argument).
To the test, I updated web2py locally to version 
2.16.1-stable+timestamp.2017.11.14.05.54.25
And then I run my apps using:

   - RedisSession(..., with_lock=False)
   This is the way that I was already using it, and apps run normally 
   (pretty fast because they do simple tasks)
   
   - RedisSession(..., with_lock=True)
   Using this, the apps start responding with hughe delay; the same 
   requests that usually took less than a second to complete, start tooking 
   between 6 and 10 seconds.

I was testing locally, with only one user, one session. 
After switching with_lock argument I always did a "flushall" at redis and 
restarted uwsgi, just in case.
I switched several times to confirm, and the difference is significant. 

Having seen this, I'll keep using Redis this way:
RedisCache(..., with_lock=True)
RedisSession(..., with_lock=False)


Thank you very much Anthony for your help.
Regards,
Lisandro.

PS: I would like to change this thread subject to something more 
appropiate, but I'm not allowed to do it. Sorry for having created it with 
that ugly title, I'll do better next time.

El viernes, 20 de abril de 2018, 15:32:15 (UTC-3), Anthony escribió:
>
> On Friday, April 20, 2018 at 11:58:47 AM UTC-4, Lisandro wrote:
>>
>> I see what you mean. 
>> But still, if my interpretation is correct, in those cases we should see 
>> the *__lock key stored.
>> What is weird about my specific issue is that there was no *__lock key.
>>
>> Anyway, regardless upgrading web2py, now I'm wondering if I should set 
>> with_lock True or False. Do you have any suggestion? The book says:
>> "*Redis cache subsystem allows you to prevent the infamous "thundering 
>> herd problem": this is not active by default because usually you choose 
>> redis for speed, but at a negligible cost you can make sure that only one 
>> thread/process can set a value concurrently.*" 
>>
>> I haven't found comments regarding when is best to use with_lock=True and 
>> when to use with_lock=False.
>>
>
> Probably safest to set it to True unless that slows things down 
> noticeably. Or go with False if you can tolerate the occasional race 
> condition.
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to