-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from redis-performance/tool.revamp
Included ZRANGE/ZREVRANGE benchmark. Added OSS cluster API support
- Loading branch information
Showing
4 changed files
with
504 additions
and
687 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.