Skip to content

Commit

Permalink
Merge pull request #4 from redis-performance/tool.revamp
Browse files Browse the repository at this point in the history
Included ZRANGE/ZREVRANGE benchmark. Added OSS cluster API support
  • Loading branch information
filipecosta90 authored Mar 9, 2023
2 parents ccb1f05 + a3394df commit 93e75f0
Show file tree
Hide file tree
Showing 4 changed files with 504 additions and 687 deletions.
33 changes: 33 additions & 0 deletions cluster_conn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"github.com/mediocregopher/radix/v3"
"log"
)

func getOSSClusterConn(addr string, opts []radix.DialOpt, clients uint64) *radix.Cluster {
var vanillaCluster *radix.Cluster
var err error

customConnFunc := func(network, addr string) (radix.Conn, error) {
return radix.Dial(network, addr, opts...,
)
}

// this cluster will use the ClientFunc to create a pool to each node in the
// cluster.
poolFunc := func(network, addr string) (radix.Client, error) {
return radix.NewPool(network, addr, int(clients), radix.PoolConnFunc(customConnFunc), radix.PoolPipelineWindow(0, 0))
}

vanillaCluster, err = radix.NewCluster([]string{addr}, radix.ClusterPoolFunc(poolFunc))
if err != nil {
log.Fatalf("Error preparing for benchmark, while creating new connection to %v. error = %v", []string{addr}, err)
}
// Issue CLUSTER SLOTS command
err = vanillaCluster.Sync()
if err != nil {
log.Fatalf("Error preparing for benchmark, while issuing CLUSTER SLOTS. error = %v", err)
}
return vanillaCluster
}
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ go 1.16

require (
github.com/HdrHistogram/hdrhistogram-go v1.1.0
github.com/golangci/golangci-lint v1.40.0 // indirect
github.com/mediocregopher/radix/v3 v3.7.0
github.com/google/go-cmp v0.5.9 // indirect
github.com/mediocregopher/radix/v3 v3.8.1
github.com/mitchellh/gox v1.0.1 // indirect
github.com/tcnksm/ghr v0.13.0 // indirect
github.com/tcnksm/ghr v0.16.0 // indirect
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
)
Loading

0 comments on commit 93e75f0

Please sign in to comment.