Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default Redis timeout to 100ms. #4

Closed
wants to merge 1 commit into from

Conversation

maltoe
Copy link
Collaborator

@maltoe maltoe commented Mar 25, 2015

See commit, not sure if we want to mangle in the TTL per lock() call or not.

As indicated in the algorithm description [0], an implementation should
set the Redis communication timeout to something small compared to the
maximum validity time (TTL). As @antirez stated [1] it should be about
two order of magnitude smaller. Given expected TTL times in the 1 - 10
seconds range (depending on the amount of code to be executed in a
caller's critical section), this should be in the 10 - 100 ms range. Set
to 100ms per default.

[0] http://redis.io/topics/distlock
[1] antirez/redlock-rb#3
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 0ea33bb on decrease-redis-timeout into 26de0ab on master.

@leandromoreira
Copy link
Owner

@maltoe I think it's useful to let people set TTL per lock, if they want. I use a TTL of 20s for 2 projects.

@maltoe
Copy link
Collaborator Author

maltoe commented Mar 25, 2015

@leandromoreira I agree. We could provide a default TTL, but in the end it is the users duty to estimate the lock time needed for his critical code to complete, so I guess it's actually quite good to require this information in lock(). I also think the 100ms redis timeout should be reasonable, for now.

@leandromoreira
Copy link
Owner

@maltoe totally agree with default 100ms

@maltoe maltoe closed this Mar 25, 2015
@maltoe maltoe deleted the decrease-redis-timeout branch March 25, 2015 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants