Skip to content

Commit

Permalink
Introduce client side caching benchmark capabilities. Enable rueidis/…
Browse files Browse the repository at this point in the history
…radix underlying vanilla client selection (#31)

* First CSC POC using a fork of ruedis

* Added replica test to CI. Enabled all features on the rueidis variation

* Fixed CI service image
  • Loading branch information
filipecosta90 authored Sep 28, 2023
1 parent 2eda50c commit c05af62
Show file tree
Hide file tree
Showing 10 changed files with 272 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist
*.json
dump.rdb
.coverdata
.DS_Store
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GIT_DIRTY:=$(shell git diff --no-ext-diff 2> /dev/null | wc -l)
endif

.PHONY: all test coverage
all: test build
all: build

build-coverage:
$(GOBUILD) -cover \
Expand Down
91 changes: 91 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package main

var readOnlyCommands = map[string]bool{
"LLEN": true,
"DUMP": true,
"PTTL": true,
"GEOHASH": true,
"HEXISTS": true,
"GROUPS": true,
"GET": true,
"SSCAN": true,
"TOUCH": true,
"CONSUMERS": true,
"BITCOUNT": true,
"MGET": true,
"SUBSTR": true,
"HVALS": true,
"TTL": true,
"FREQ": true,
"XREAD": true,
"PFCOUNT": true,
"ZREVRANGEBYSCORE": true,
"HMGET": true,
"LINDEX": true,
"XLEN": true,
"GEODIST": true,
"ZLEXCOUNT": true,
"LPOS": true,
"ZREVRANK": true,
"GEORADIUS_RO": true,
"GETRANGE": true,
"STRLEN": true,
"REFCOUNT": true,
"IDLETIME": true,
"SCARD": true,
"EXPIRETIME": true,
"ZRANGE": true,
"LOLWUT": true,
"SINTER": true,
"XREVRANGE": true,
"ZRANGEBYSCORE": true,
"SUNION": true,
"GETBIT": true,
"BITFIELD_RO": true,
"ZDIFF": true,
"HGETALL": true,
"ZSCORE": true,
"ZREVRANGE": true,
"ZREVRANGEBYLEX": true,
"SINTERCARD": true,
"SMISMEMBER": true,
"KEYS": true,
"LCS": true,
"SORT_RO": true,
"ZRANK": true,
"HSTRLEN": true,
"LRANGE": true,
"PEXPIRETIME": true,
"RANDOMKEY": true,
"SMEMBERS": true,
"ZMSCORE": true,
"HKEYS": true,
"ZCOUNT": true,
"ZSCAN": true,
"GEOSEARCH": true,
"ZUNION": true,
"XPENDING": true,
"HRANDFIELD": true,
"HLEN": true,
"ZRANDMEMBER": true,
"DBSIZE": true,
"SDIFF": true,
"STREAM": true,
"ZINTER": true,
"SCAN": true,
"TYPE": true,
"USAGE": true,
"ZINTERCARD": true,
"SISMEMBER": true,
"HGET": true,
"SRANDMEMBER": true,
"ENCODING": true,
"EXISTS": true,
"GEOPOS": true,
"XRANGE": true,
"ZRANGEBYLEX": true,
"GEORADIUSBYMEMBER_RO": true,
"BITPOS": true,
"ZCARD": true,
"HSCAN": true,
}
2 changes: 2 additions & 0 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

var totalCommands uint64
var totalCached uint64
var totalErrors uint64
var latencies *hdrhistogram.Histogram
var benchmarkCommands arrayStringParameters
Expand All @@ -23,6 +24,7 @@ const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
type datapoint struct {
success bool
duration_ms int64
cachedEntry bool
}

func stringWithCharset(length int, charset string) string {
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ require (
github.com/HdrHistogram/hdrhistogram-go v1.1.0
github.com/mattn/go-shellwords v1.0.12
github.com/mediocregopher/radix/v4 v4.1.2
github.com/rueian/rueidis v0.0.100
github.com/redis/rueidis v1.0.19
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
)

require (
github.com/tilinna/clock v1.0.2 // indirect
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 // indirect
)

replace github.com/redis/rueidis => github.com/filipecosta90/rueidis v0.0.0-20230927221707-2d17d4ee82e3
12 changes: 7 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/filipecosta90/rueidis v0.0.0-20230927221707-2d17d4ee82e3 h1:slwoBsdbPe8JqOhlEaEZzkog/PLSwAQGuW3QtkIRsNM=
github.com/filipecosta90/rueidis v0.0.0-20230927221707-2d17d4ee82e3/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand All @@ -22,11 +24,11 @@ github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lL
github.com/mediocregopher/radix/v4 v4.1.2 h1:Pj7XnNK5WuzzFy63g98pnccainAePK+aZNQRvxSvj2I=
github.com/mediocregopher/radix/v4 v4.1.2/go.mod h1:ajchozX/6ELmydxWeWM6xCFHVpZ4+67LXHOTOVR0nCE=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/gomega v1.27.5 h1:T/X6I0RNFw/kTqgfkZPcQ5KU6vCnWNBGdtrIx2dpGeQ=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rueian/rueidis v0.0.100 h1:22yp/+8YHuWc/vcrp8bkjeE7baD3vygoh2gZ2+xu1KQ=
github.com/rueian/rueidis v0.0.100/go.mod h1:ivvsRYRtAUcf9OnheuKc5Gpa8IebrkLT1P45Lr2jlXE=
github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo=
github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
Expand All @@ -52,14 +54,14 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
Loading

0 comments on commit c05af62

Please sign in to comment.