Skip to content

Commit

Permalink
Use valid samples to discard invalid results in summary (#32)
Browse files Browse the repository at this point in the history
* Use valid samples to discard invalid results in summary

Signed-off-by: Raul Sevilla <[email protected]>

* Convert to ms and add termination type to log message

Signed-off-by: Raul Sevilla <[email protected]>

* Add http errors and timeouts to summary msg

Signed-off-by: Raul Sevilla <[email protected]>

---------

Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 authored Sep 11, 2023
1 parent 9320af1 commit a3ff153
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pkg/runner/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var lock = &sync.Mutex{}

func runBenchmark(cfg config.Config, clusterMetadata ocpmetadata.ClusterMetadata) ([]tools.Result, error) {
var aggAvgRps, aggAvgLatency, aggP99Latency float64
var timeouts, httpErrors int64
var benchmarkResult []tools.Result
var clientPods []corev1.Pod
var wg sync.WaitGroup
Expand Down Expand Up @@ -92,14 +93,24 @@ func runBenchmark(cfg config.Config, clusterMetadata ocpmetadata.ClusterMetadata
aggAvgRps += result.TotalAvgRps
aggAvgLatency += result.AvgLatency
aggP99Latency += result.P99Latency
log.Infof("Rps=%.0f avgLatency=%.0f μs P99Latency=%.0f μs", result.TotalAvgRps, result.AvgLatency, result.P99Latency)
timeouts += result.Timeouts
httpErrors += result.HTTPErrors
log.Infof("%s: Rps=%.0f avgLatency=%.0fms P99Latency=%.0fms", cfg.Termination, result.TotalAvgRps, result.AvgLatency/1e3, result.P99Latency/1e3)
benchmarkResult = append(benchmarkResult, result)
if cfg.Delay != 0 {
log.Info("Sleeping for ", cfg.Delay)
time.Sleep(cfg.Delay)
}
}
log.Infof("Scenario summary %s: Rps=%.0f avgLatency=%.0f μs P99Latency=%.0f μs", cfg.Termination, aggAvgRps/float64(cfg.Samples), aggAvgLatency/float64(cfg.Samples), aggP99Latency/float64(cfg.Samples))
validSamples := float64(len(benchmarkResult))
log.Infof("Scenario summary %s: Rps=%.0f avgLatency=%.0fms P99Latency=%.0fms timeouts=%d http_errors=%d",
cfg.Termination,
aggAvgRps/validSamples,
aggAvgLatency/validSamples/1e3,
aggP99Latency/validSamples/1e3,
timeouts,
httpErrors,
)
return benchmarkResult, nil
}

Expand Down Expand Up @@ -150,7 +161,7 @@ func exec(ctx context.Context, wg *sync.WaitGroup, tool tools.Tool, pod corev1.P
lock.Lock()
result.Pods = append(result.Pods, podResult)
lock.Unlock()
log.Debugf("%s: avgRps: %.0f avgLatency: %.0f μs", podResult.Name, podResult.AvgRps, podResult.AvgLatency)
log.Debugf("%s: avgRps: %.0f avgLatency: %.0f ms", podResult.Name, podResult.AvgRps, podResult.AvgLatency/1000)
}

func genResultSummary(result *tools.Result) {
Expand Down

0 comments on commit a3ff153

Please sign in to comment.