Skip to content
Merged
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
3 changes: 2 additions & 1 deletion cmd/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var consumerCmd = &cobra.Command{
numberRequests, _ := cmd.Flags().GetUint64("n")
auth, _ := cmd.Flags().GetString("a")
verbose, _ := cmd.Flags().GetBool("verbose")
loop, _ := cmd.Flags().GetBool("loop")
seed, _ := cmd.Flags().GetInt64("seed")
nameserver, _ := cmd.Flags().GetString("nameserver")
streamPrefix, _ := cmd.Flags().GetString("stream-prefix")
Expand Down Expand Up @@ -139,7 +140,7 @@ var consumerCmd = &cobra.Command{

tick := time.NewTicker(time.Duration(client_update_tick) * time.Second)

closed, _, duration, totalMessages, messageRateTs, percentilesTs := updateCLI(tick, c, numberRequests, false, datapointsChan)
closed, _, duration, totalMessages, messageRateTs, percentilesTs := updateCLI(tick, c, numberRequests, loop, datapointsChan)
messageRate := float64(totalMessages) / float64(duration.Seconds())
avgMs := float64(latencies.Mean()) / 1000.0
p50IngestionMs := float64(latencies.ValueAtQuantile(50.0)) / 1000.0
Expand Down
10 changes: 5 additions & 5 deletions cmd/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var producerCmd = &cobra.Command{
betweenClientsDelay, _ := cmd.Flags().GetDuration("between-clients-duration")
jsonOutFile, _ := cmd.Flags().GetString("json-out-file")
clientKeepAlive, _ := cmd.Flags().GetDuration("client-keep-alive-time")
loop, _ := cmd.Flags().GetBool("loop")

if nClients > uint64(keyspaceLen) {
log.Fatalf("The number of clients needs to be smaller or equal to the number of streams")
Expand Down Expand Up @@ -126,7 +127,7 @@ var producerCmd = &cobra.Command{
}
defer client.Close()

go benchmarkRoutine(client, streamPrefix, value, datapointsChan, samplesPerClient, &wg, useRateLimiter, rateLimiter, gen, randSource, streamMaxlen, streamMaxlenExpireSeconds)
go benchmarkRoutine(client, streamPrefix, value, datapointsChan, samplesPerClient, &wg, useRateLimiter, rateLimiter, gen, randSource, streamMaxlen, streamMaxlenExpireSeconds, loop)

// delay the creation for each additional client
time.Sleep(betweenClientsDelay)
Expand All @@ -137,7 +138,7 @@ var producerCmd = &cobra.Command{
signal.Notify(c, os.Interrupt)

tick := time.NewTicker(time.Duration(client_update_tick) * time.Second)
closed, _, duration, totalMessages, messageRateTs, percentilesTs := updateCLI(tick, c, numberRequests, false, datapointsChan)
closed, _, duration, totalMessages, messageRateTs, percentilesTs := updateCLI(tick, c, numberRequests, loop, datapointsChan)
messageRate := float64(totalMessages) / float64(duration.Seconds())
avgMs := float64(latencies.Mean()) / 1000.0
p50IngestionMs := float64(latencies.ValueAtQuantile(50.0)) / 1000.0
Expand Down Expand Up @@ -167,10 +168,10 @@ var producerCmd = &cobra.Command{
},
}

func benchmarkRoutine(client rueidis.Client, streamPrefix, value string, datapointsChan chan datapoint, samplesPerClient uint64, wg *sync.WaitGroup, useRateLimiter bool, rateLimiter *rate.Limiter, gen *generator.Zipfian, randSource *rand.Rand, streamMaxlen int64, streamMaxlenExpireSeconds int64) {
func benchmarkRoutine(client rueidis.Client, streamPrefix, value string, datapointsChan chan datapoint, samplesPerClient uint64, wg *sync.WaitGroup, useRateLimiter bool, rateLimiter *rate.Limiter, gen *generator.Zipfian, randSource *rand.Rand, streamMaxlen int64, streamMaxlenExpireSeconds int64, loop bool) {
streamMessages := make(map[int64]int64, 0)
defer wg.Done()
for i := 0; uint64(i) < samplesPerClient; i++ {
for i := 0; uint64(i) < samplesPerClient || loop; i++ {
ctx := context.Background()
if useRateLimiter {
r := rateLimiter.ReserveN(time.Now(), int(1))
Expand Down Expand Up @@ -205,7 +206,6 @@ func benchmarkRoutine(client rueidis.Client, streamPrefix, value string, datapoi
err = client.Do(ctx, client.B().Expire().Key(keyname).Seconds(streamMaxlenExpireSeconds).Build()).Error()
}
}

}

}
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func init() {
rootCmd.PersistentFlags().Duration("client-keep-alive-time", time.Second*60, "keepalive time (in every keepalive we send a PING).")
rootCmd.PersistentFlags().Bool("version", false, "Output version and exit")
rootCmd.PersistentFlags().Bool("verbose", false, "Output verbose info")
rootCmd.PersistentFlags().Bool("loop", false, "Run benchmark in a loop.")
rootCmd.PersistentFlags().String("resp", "", "redis command response protocol (2 - RESP 2, 3 - RESP 3). If empty will not enforce it.")
rootCmd.PersistentFlags().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.")
rootCmd.PersistentFlags().String("json-out-file", "", "Results file. If empty will not save.")
Expand Down