Skip to content
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

fix(benchmark): make append duration's precision high #522

Merged
merged 1 commit into from
Jul 28, 2023
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
2 changes: 1 addition & 1 deletion internal/benchmark/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (loader *Loader) makeAppendFunc(ctx context.Context, c varlog.Log, am *Appe
recordMetrics := func(dur time.Duration) {
am.bytes += int64(loader.BatchSize * loader.MessageSize)
am.requests++
am.durationMS += dur.Milliseconds()
am.durationMS = float64(dur.Nanoseconds()) / float64(time.Millisecond)
if loader.metrics.ReportAppendMetrics(*am) {
*am = AppendMetrics{}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/benchmark/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type LoaderMetrics struct {
type AppendMetrics struct {
requests int64
bytes int64
durationMS int64
durationMS float64
}

type SubscribeMetrics struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/benchmark/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func NewAppendReportFromMetrics(metrics AppendMetrics, interval time.Duration) A
bps = float64(metrics.bytes) / itv
}
if metrics.requests > 0 {
dur = float64(metrics.durationMS / metrics.requests)
dur = metrics.durationMS / float64(metrics.requests)
}
return AppendReport{
RequestsPerSecond: rps,
Expand Down