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

Make rueidis store to be more user-friendly and be more performant #188

Merged
merged 1 commit into from Dec 11, 2022

Conversation

rueian
Copy link
Contributor

@rueian rueian commented Dec 10, 2022

Hi @eko, @rwrz,

Following #187, I made some breaking changes in this PR:

  1. Make Get() and GetWithTTL() return go string instead of rueidis.RedisResult to be more user-friendly.
  2. Make Set() only accept go string value, since Get() also returns go string.
  3. Make GetWithTTL() retrive client-side TTL without additional network roundtrip.

And some improvements:

  1. Pipeline SADD and EXPIRE while setting key tags to reduce network roundtrips.
  2. Not to cache SMEMBERS while doing Invalidate(), since it will also be invalidated soon.

I also re-run the BenchmarkRueidisSet:

BEFORE:

goos: darwin
goarch: arm64
pkg: github.com/eko/gocache/store/rueidis/v4
BenchmarkRueidisSet
BenchmarkRueidisSet/1
BenchmarkRueidisSet/1-10  	   18704	     61512 ns/op
BenchmarkRueidisSet/2
BenchmarkRueidisSet/2-10  	    9661	    124730 ns/op
BenchmarkRueidisSet/4
BenchmarkRueidisSet/4-10  	    4776	    247294 ns/op
BenchmarkRueidisSet/8
BenchmarkRueidisSet/8-10  	    2469	    491906 ns/op
BenchmarkRueidisSet/16
BenchmarkRueidisSet/16-10 	    1213	    982676 ns/op
BenchmarkRueidisSet/32
BenchmarkRueidisSet/32-10 	     607	   1964616 ns/op
BenchmarkRueidisSet/64
BenchmarkRueidisSet/64-10 	     303	   3930002 ns/op
BenchmarkRueidisSet/128
BenchmarkRueidisSet/128-10         	     152	   7860255 ns/op
BenchmarkRueidisSet/256
BenchmarkRueidisSet/256-10         	      74	  15707281 ns/op
BenchmarkRueidisSet/512
BenchmarkRueidisSet/512-10         	      37	  31525639 ns/op
BenchmarkRueidisSet/1024
BenchmarkRueidisSet/1024-10        	      18	  63099289 ns/op
PASS

AFTER:

goos: darwin
goarch: arm64
pkg: github.com/eko/gocache/store/rueidis/v4
BenchmarkRueidisSet
BenchmarkRueidisSet/1
BenchmarkRueidisSet/1-10  	   27085	     42312 ns/op
BenchmarkRueidisSet/2
BenchmarkRueidisSet/2-10  	   14272	     84054 ns/op
BenchmarkRueidisSet/4
BenchmarkRueidisSet/4-10  	    7027	    167840 ns/op
BenchmarkRueidisSet/8
BenchmarkRueidisSet/8-10  	    3525	    330211 ns/op
BenchmarkRueidisSet/16
BenchmarkRueidisSet/16-10 	    1774	    660522 ns/op
BenchmarkRueidisSet/32
BenchmarkRueidisSet/32-10 	     891	   1321188 ns/op
BenchmarkRueidisSet/64
BenchmarkRueidisSet/64-10 	     445	   2615865 ns/op
BenchmarkRueidisSet/128
BenchmarkRueidisSet/128-10         	     224	   5278540 ns/op
BenchmarkRueidisSet/256
BenchmarkRueidisSet/256-10         	     100	  10586973 ns/op
BenchmarkRueidisSet/512
BenchmarkRueidisSet/512-10         	      54	  21222888 ns/op
BenchmarkRueidisSet/1024
BenchmarkRueidisSet/1024-10        	      27	  42436995 ns/op
PASS

1. Make Get() and GetWithTTL() return go string instead of rueidis.RedisResult to be more user-friendly.
2. Make Set() only accept go string value, since Get() also returns go string.
3. Make GetWithTTL() retrive client-side TTL without additional network roundtrip.
4. Pipeline SADD and EXPIRE while setting key tags to reduce network roundtrips.
5. Not to cache SMEMBERS while doing Invalidate(), since it will also be invalidated soon.
@eko eko merged commit 24ff431 into eko:master Dec 11, 2022
@eko
Copy link
Owner

eko commented Dec 11, 2022

Thank you so much @rueian!

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

2 participants