-
Notifications
You must be signed in to change notification settings - Fork 378
Feature: net package valkey ring client implementation #3819
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
base: master
Are you sure you want to change the base?
Conversation
36b312d to
e746986
Compare
Signed-off-by: Sandor Szücs <[email protected]>
…uration Signed-off-by: Sandor Szücs <[email protected]>
Signed-off-by: Sandor Szücs <[email protected]>
refactor: sort imports Signed-off-by: Sandor Szücs <[email protected]>
doc: fix valkeytest package doc Signed-off-by: Sandor Szücs <[email protected]>
…drop t.Helper() Signed-off-by: Sandor Szücs <[email protected]>
nop: cleanup feature: enable users to pass metrics interfae for example for tests passing mockmetrics Signed-off-by: Sandor Szücs <[email protected]>
feature: valkey lua script Signed-off-by: Sandor Szücs <[email protected]>
Signed-off-by: Sandor Szücs <[email protected]>
Signed-off-by: Sandor Szücs <[email protected]>
feature: optional OTel client Signed-off-by: Sandor Szücs <[email protected]>
Signed-off-by: Sandor Szücs <[email protected]>
Signed-off-by: Sandor Szücs <[email protected]>
… implemented feature Signed-off-by: Sandor Szücs <[email protected]>
Signed-off-by: Sandor Szücs <[email protected]>
…aths feature: tracing and add default tracer test: add tests for valkey.Hook Signed-off-by: Sandor Szücs <[email protected]>
29d58b4 to
59ea15d
Compare
… net package Signed-off-by: Sandor Szücs <[email protected]>
|
|
||
| // maps int to client for sharding, trades memory for concurrent access | ||
| // most operations only have to use this lock-free structure | ||
| shards [ringSize]valkey.Client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this data structure is the key for the lock free access
| if i%shardSize == 0 { | ||
| cur++ | ||
| } | ||
| vr.shards[i] = clients[cur] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we set the values of the lock free data structure, if we get called by SetAddr() , for example scliang-out valkey instances
|
|
||
| // shardForKey does the lookup for valkey most operations to find the valkey ring shard | ||
| func (vr *valkeyRing) shardForKey(key string) valkey.Client { | ||
| return vr.shards[xxhash.Sum64String(key)%ringSize] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the O(1) lock free lookup of the valkey client connected to the right shard
Feature: net package valkey ring client implementation
This is the basic block to have another Swarmer implementation to implement for example
cluster*Ratelimitfilters.In order to allow migration from redis to valkey, this is the first step out of two.
ref #3799
valkey command sheet: https://valkey.io/commands