-
Notifications
You must be signed in to change notification settings - Fork 29
Work On A Way To Avoid Blocking For 1ms When Sequence Wraps #2
Comments
Another command that can be useful is "block until a key is expired" (= "block while a key exists")? That will replace your original EXISTS call at the top of the Lua script. I looked at the Instragram solution and it seems to me that:
So in that sense I don't think we can learn from their solution. |
Hmm, but if we "wait until expired" and there's only one script that executes at once, then we'll have a deadlock. Scratch that. |
It's worth asking if this is actually an issue under real world conditions. A quick benchmark suggests that, on a relatively powerful workstation (4Ghz i7), I can generate about 50 ids per millisecond using the default Jedis implementation. That's some way short of causing a wraparound. |
@philmes seuqences keep increasing even as time advances. So let's say you produce 20 new IDs each millisecond: The first IDs will have sequences 0-19, then on the next millisecond the sequence part will be 20-39, and so on. At some point you're going to hit the 4095 limit, which will start returning errors for one whole millisecond. |
Ah, yes... and because of the purity constraints, it's not possible to check to see if the sequence should be reset and act accordingly. |
It is very likely that the new Redis v4 modules may be the solution to this. https://redis.io/topics/modules-intro We may at some point look at converting Icicle to a Redis module for Redis > 4. |
Inspired by a discussion with @dubek, I would like to keep investigating any ways we can possibly avoid blocking ID generation on a host for 1ms when the sequence wraps. Here's an excerpt of the conversation I had with @dubek:
The text was updated successfully, but these errors were encountered: