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

Optimize Redis usage #89

Closed
mperham opened this issue Jun 18, 2015 · 2 comments
Closed

Optimize Redis usage #89

mperham opened this issue Jun 18, 2015 · 2 comments

Comments

@mperham
Copy link

mperham commented Jun 18, 2015

Right now the uniqueness check requires three network round trips to Redis for each job pushed:

  1. watch
  2. get
  3. (multi / setex) || unwatch

Redis 2.6.12+ has new flags for set which potentially allow this operation with a single command:

conn.set(payload_hash, 1 || 2, nx: true, ex: expires_at)

You don't document a minimum Redis version but requiring Redis 2.6+ is your choice.

@mperham
Copy link
Author

mperham commented Jun 18, 2015

To be honest, I'm not positive all the semantics are met by this change but the performance win is so big, I think it's something to consider.

@mhenrixon
Copy link
Owner

Didn't really have to change anything except make it simpler. Thanks for the intel @mperham !

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

No branches or pull requests

2 participants