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

Issue with using Rings + Pipelines in v9 #3009

Open
notcool11 opened this issue May 31, 2024 · 0 comments
Open

Issue with using Rings + Pipelines in v9 #3009

notcool11 opened this issue May 31, 2024 · 0 comments

Comments

@notcool11
Copy link

We were previously using client v7 with server v4 and everything was fine. But after upgrading to client v9 and server v7 things are not working right.

We initialize our ring like this (same in v7 and v9):

	redisClient := redis.NewRing(&redis.RingOptions{
		Addrs:              shardMap,
		Password:           "",
		DB:                    idb, 
		MaxRetries:         2,
		MinIdleConns:   10,
		PoolSize:           10,
		HeartbeatFrequency: 5 * time.Second,
	})

Then at runtime we use a pipeline like this:

ctxClient := redisClient.WithContext(ctx)
p := ctxClient.WithContext(ctx).Pipeline()
p.Set(key1, value1, ttl)
p.Set(key2, value2, ttl)
.
.
.
p.Exec()

After the v9 upgrade the ring configuration stayed the same but the pipeline code changed slightly:

p := redisClient.Pipeline()
p.Set(ctx, key1, value1, ttl)
p.Set(ctxm key2, value2, ttl)
.
.
.
p.Exec(ctx)

Everything compiles and runs fine (no errors), but we are getting very inconsistent results in our shards. There seems to be a big delay from when the p.Exec(ctx) is called until the data shows in the shards. Even more worrisome, sometimes the data never shows up. 🤷

Is this a known issue with v9? Is there a better solution? Thanks!

=== EDIT 1 ===

So did a couple more tests to narrow down the issue.

First, removed the usage of the pipeline and just did basic sets on the client:

redisClient.Set(ctx, key1, value1, ttl)
redisClient.Set(ctxm key2, value2, ttl)

This works just fine, we see the data in the shards and the cache hit rate is normal.

Second test was to remove the ring and just push to a single instance:

	redisClient := redis.NewRing(&redis.RingOptions{
		Addrs:              shardMap[0],
		Password:           "",
		DB:                    idb, 
		MaxRetries:         2,
		MinIdleConns:   10,
		PoolSize:           10,
	})

This also works just fine...so, I think this is actually an issue and not a question. Because it definitely looks like there is an issue when using rings + pipelines in v9.

Originally posted by @notcool11 in #3006

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

1 participant