Skip to content

Commit 3fbe0a7

Browse files
committed
[add] initial commit
0 parents  commit 3fbe0a7

File tree

6 files changed

+892
-0
lines changed

6 files changed

+892
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
coverage.txt
3+
redis-benchmark-go

Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Go parameters
2+
GOCMD=GO111MODULE=on go
3+
GOBUILD=$(GOCMD) build
4+
GOINSTALL=$(GOCMD) install
5+
GOCLEAN=$(GOCMD) clean
6+
GOTEST=$(GOCMD) test
7+
GOGET=$(GOCMD) get
8+
GOMOD=$(GOCMD) mod
9+
GOFMT=$(GOCMD) fmt
10+
11+
.PHONY: all test coverage
12+
all: test coverage build
13+
14+
build:
15+
$(GOBUILD) .
16+
17+
checkfmt:
18+
@echo 'Checking gofmt';\
19+
bash -c "diff -u <(echo -n) <(gofmt -d .)";\
20+
EXIT_CODE=$$?;\
21+
if [ "$$EXIT_CODE" -ne 0 ]; then \
22+
echo '$@: Go files must be formatted with gofmt'; \
23+
fi && \
24+
exit $$EXIT_CODE
25+
26+
get:
27+
$(GOGET) -t -v ./...
28+
29+
test: get
30+
$(GOFMT) ./...
31+
$(GOTEST) -race -covermode=atomic ./...
32+
33+
coverage: get test
34+
$(GOTEST) -race -coverprofile=coverage.txt -covermode=atomic .
35+
36+
37+
release:
38+
$(GOGET) github.com/mitchellh/gox
39+
$(GOGET) github.com/tcnksm/ghr
40+
GO111MODULE=on gox -osarch "linux/amd64 darwin/amd64" -output "dist/redistimeseries-ooo-benchmark_{{.OS}}_{{.Arch}}" .
41+
42+
fmt:
43+
$(GOFMT) ./...
44+

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# redis-benchmark-go
2+
3+
## Overview
4+
5+
This repo contains code to mimic redis-benchmark capabilities in go solely for OSS redis cluster.
6+
7+
## Installation
8+
9+
The easiest way to get and install the Subscriber Go program is to use
10+
`go get` and then `go install`:
11+
```bash
12+
# Fetch this repo
13+
go get github.com/filipecosta90/redis-benchmark-go
14+
cd $GOPATH/src/github.com/filipecosta90/redis-benchmark-go
15+
make
16+
```
17+
18+
## Usage of redis-benchmark-go
19+
20+
```
21+
$ redis-benchmark-go --help
22+
Usage of redis-benchmark-go:
23+
-a string
24+
Password for Redis Auth.
25+
-c uint
26+
number of clients. (default 50)
27+
-d uint
28+
Data size of the expanded string __data__ value in bytes. The benchmark will expand the string __data__ inside an argument with a charset with length specified by this parameter. The substitution changes every time a command is executed. (default 3)
29+
-debug int
30+
Client debug level.
31+
-h string
32+
Server hostname. (default "127.0.0.1")
33+
-l Loop. Run the tests forever.
34+
-n uint
35+
Total number of requests (default 100000)
36+
-p int
37+
Server port. (default 12000)
38+
-r uint
39+
keyspace length. The benchmark will expand the string __key__ inside an argument with a number in the specified range from 0 to keyspacelen-1. The substitution changes every time a command is executed. (default 1000000)
40+
-random-seed int
41+
random seed to be used. (default 12345)
42+
```
43+
44+
## Sample output - 10M commands
45+
46+
```
47+
$ redis-benchmark-go -p 20000 --debug 1 hset __key__ f1 __data__
48+
Total clients: 50. Commands per client: 200000 Total commands: 10000000
49+
Using random seed: 12345
50+
Test time Total Commands Total Errors Command Rate p50 lat. (msec)
51+
42s [100.0%] 10000000 0 [0.0%] 172737.59 0.17
52+
#################################################
53+
Total Duration 42.000 Seconds
54+
Total Errors 0
55+
Throughput summary: 238094 requests per second
56+
Latency summary (msec):
57+
p50 p95 p99
58+
0.168 0.403 0.528
59+
```
60+
61+
62+
## Sample output - running in loop mode ( Ctrl+c to stop )
63+
64+
```
65+
$ redis-benchmark-go -p 20000 --debug 1 -l hset __key__ f1 __data__
66+
Running in loop until you hit Ctrl+C
67+
Using random seed: 12345
68+
Test time Total Commands Total Errors Command Rate p50 lat. (msec)
69+
^C 10s [----%] 2788844 0 [0.0%] 254648.64 0.16
70+
received Ctrl-c - shutting down
71+
72+
#################################################
73+
Total Duration 10.923 Seconds
74+
Total Errors 0
75+
Throughput summary: 274843 requests per second
76+
Latency summary (msec):
77+
p50 p95 p99
78+
0.162 0.372 0.460
79+
```

go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/filipecosta90/redis-benchmark-go
2+
3+
go 1.14
4+
5+
require (
6+
github.com/filipecosta90/hdrhistogram v0.1.1
7+
github.com/mediocregopher/radix/v3 v3.5.2
8+
)

0 commit comments

Comments
 (0)