Redis Sorted Sets Benchmark
This repo contains code to trigger load
( ZADD
) or query
(ZRANGEBYLEX key min max
) benchmarks,
with/without transaction, with/without pipelining, and with diversified ways of controlling the per-key size and total keyspace length.
If you don't have go on your machine and just want to use the produced binaries you can download the following prebuilt bins:
https://github.com/redis-performance/redis-zbench-go/releases/latest
OS | Arch | Link |
---|---|---|
Linux | amd64 (64-bit X86) | redis-zbench-go-linux-amd64 |
Linux | arm64 (64-bit ARM) | redis-zbench-go-linux-arm64 |
Darwin | amd64 (64-bit X86) | redis-zbench-go-darwin-amd64 |
Darwin | arm64 (64-bit ARM) | redis-zbench-go-darwin-arm64 |
Here's how bash script to download and try it:
wget -c https://github.com/redis-performance/redis-zbench-go/releases/latest/download/redis-zbench-go-$(uname -mrs | awk '{ print tolower($1) }')-$(dpkg --print-architecture).tar.gz -O - | tar -xz
# give it a try
./redis-zbench-go --help
The easiest way to get and install the benchmark utility with a Go Env is to use
go get
and then go install
:
# Fetch this repo
go get github.com/redis-performance/redis-zbench-go
cd $GOPATH/src/github.com/redis-performance/redis-zbench-go
make
To get a full grasp of the tool capabilities please check the --help
output
$ ./redis-zbench-go --help
Usage of ./redis-zbench-go:
-a string
Password for Redis Auth.
-c uint
number of clients. (default 50)
-d uint
Data size of each sorted set element. (default 10)
-debug int
Client debug level.
-h string
Server hostname. (default "127.0.0.1")
-key-elements-max uint
Use zipfian random-sized items in the specified range (min-max). (default 10)
-key-elements-min uint
Use zipfian random-sized items in the specified range (min-max). (default 1)
-mode load
Bechmark mode. One of [load,query]. load will populate the db with sorted sets. `query` will run the zrangebylexscore command .
-multi
Run each command in multi-exec.
-n uint
Total number of requests. Only used in case of -mode=query (default 10000000)
-p int
Server port. (default 12000)
-pipeline uint
Redis pipeline value. (default 1)
-r uint
keyspace length. (default 1000000)
-random-seed int
random seed to be used. (default 12345)
-rps int
Max rps. If 0 no limit is applied and the DB is stressed up to maximum.
Sample output - 1M Keys keyspace, 100K issued commands, pipeline of 100 with transaction enabled, while querying at a limit of @10K RPS
$ ./redis-zbench-go -mode load -r 1000000 -p 6379
Total clients: 50. Commands per client: 20000 Total commands: 1000000
Using random seed: 12345
Test time Total Commands Total Errors Command Rate p50 lat. (msec)
18s [100.0%] 1000000 0 [0.0%] 1370.82 0.81
#################################################
Total Duration 18.000 Seconds
Total Issued commands 1000000
Total Errors 0
Throughput summary: 55555 requests per second
Latency summary (msec):
p50 p95 p99
0.808 1.200 1.582
$ ./redis-zbench-go -mode query -p 6379 -pipeline 100 -c 10 -multi -rps 10000 -n 100000 -r 1000000
Total clients: 10. Commands per client: 10000 Total commands: 100000
Using random seed: 12345
Test time Total Commands Total Errors Command Rate p50 lat. (msec)
9s [100.0%] 100000 0 [0.0%] 9095.29 2.53
#################################################
Total Duration 9.001 Seconds
Total Issued commands 100000
Total Errors 0
Throughput summary: 11110 requests per second
Latency summary (msec):
p50 p95 p99
2.529 3.509 6.083
#################################################
Printing reply histogram
Size: 0 Count: 51962. (% 51.96)
Size: 1 Count: 9774. (% 9.77)
Size: 2 Count: 5124. (% 5.12)
Size: 3 Count: 5276. (% 5.28)
Size: 4 Count: 5088. (% 5.09)
Size: 5 Count: 5152. (% 5.15)
Size: 6 Count: 4943. (% 4.94)
Size: 7 Count: 4694. (% 4.69)
Size: 8 Count: 4547. (% 4.55)
Size: 9 Count: 3440. (% 3.44)
--------------------------------------------------
Total processed replies 100000