Skip to content

add Dockerfile #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:latest AS builder
COPY . /
WORKDIR /
RUN make

FROM ubuntu:24.10
LABEL Description="redis-benchmark-go"
COPY --from=builder /redis-benchmark-go /usr/local/bin

ENTRYPOINT ["redis-benchmark-go"]
CMD [ "--help" ]
21 changes: 17 additions & 4 deletions redis-bechmark-go.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ package main

import (
"context"
"crypto/tls"
"flag"
"fmt"
hdrhistogram "github.com/HdrHistogram/hdrhistogram-go"
radix "github.com/mediocregopher/radix/v4"
"github.com/redis/rueidis"
"golang.org/x/time/rate"
"log"
"math/rand"
"net"
Expand All @@ -16,6 +13,11 @@ import (
"strings"
"sync"
"time"

hdrhistogram "github.com/HdrHistogram/hdrhistogram-go"
radix "github.com/mediocregopher/radix/v4"
"github.com/redis/rueidis"
"golang.org/x/time/rate"
)

func benchmarkRoutine(radixClient Client, ruedisClient rueidis.Client, useRuedis, useCSC, enableMultiExec bool, datapointsChan chan datapoint, continueOnError bool, cmdS [][]string, commandsCDF []float32, keyspacelen, datasize, number_samples uint64, loop bool, debug_level int, wg *sync.WaitGroup, keyplace, dataplace []int, readOnly []bool, useLimiter bool, rateLimiter *rate.Limiter, waitReplicas, waitReplicasMs int, cacheOptions *rueidis.CacheOptions) {
Expand Down Expand Up @@ -212,6 +214,8 @@ func main() {
nameserver := flag.String("nameserver", "", "the IP address of the DNS name server. The IP address can be an IPv4 or an IPv6 address. If empty will use the default host namserver.")
flag.Var(&benchmarkCommands, "cmd", "Specify a query to send in quotes. Each command that you specify is run with its ratio. For example:-cmd=\"SET __key__ __value__\" -cmd-ratio=1")
flag.Var(&benchmarkCommandsRatios, "cmd-ratio", "The query ratio vs other queries used in the same benchmark. Each command that you specify is run with its ratio. For example: -cmd=\"SET __key__ __value__\" -cmd-ratio=0.8 -cmd=\"GET __key__\" -cmd-ratio=0.2")
tlsEnabled := flag.Bool("tls", false, "Use TLS")
tlsSkipCertCheck := flag.Bool("tls-skip", false, "Ignore TLS certificate check")

flag.Parse()
totalQueries := len(benchmarkCommands)
Expand Down Expand Up @@ -288,6 +292,15 @@ func main() {
opts.Protocol = "3"
alwaysRESP2 = false
}
if *tlsEnabled {
conf := &tls.Config{
InsecureSkipVerify: *tlsSkipCertCheck,
}
opts.NetDialer = &tls.Dialer{
NetDialer: nil,
Config: conf,
}
}

ips := make([]net.IP, 0)
if *nameserver != "" {
Expand Down
Loading