Skip to content

chore: add benchmark for prometheusmetrics.MetricsAggregator #8066

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

Merged
merged 3 commits into from
Jun 16, 2023

Conversation

johnstcn
Copy link
Member

$ go test -run=XXX -bench=. -benchmem
goos: linux
goarch: amd64
pkg: github.com/coder/coder/coderd/prometheusmetrics
cpu: AMD EPYC 7502P 32-Core Processor               
Benchmark_MetricsAggregator_Run-16            44          43735448 ns/op         1297092 B/op      31282 allocs/op
--- BENCH: Benchmark_MetricsAggregator_Run-16
    aggregator_test.go:214: N=1 generating 1024 metrics
    aggregator_test.go:220: N=1 sending 1024 metrics
    aggregator_test.go:233: N=1 got 1024 metrics
    aggregator_test.go:214: N=44 generating 1024 metrics
    aggregator_test.go:220: N=44 sending 1024 metrics
    aggregator_test.go:233: N=44 got 1024 metrics
    aggregator_test.go:214: N=44 generating 1024 metrics
    aggregator_test.go:220: N=44 sending 1024 metrics
    aggregator_test.go:233: N=44 got 1024 metrics
    aggregator_test.go:214: N=44 generating 1024 metrics
        ... [output truncated]
PASS
ok      github.com/coder/coder/coderd/prometheusmetrics 3.020s

@johnstcn johnstcn requested a review from mtojek June 16, 2023 12:50
@johnstcn johnstcn self-assigned this Jun 16, 2023
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Are you investigating any specific issue or do you intend to modify the aggregation?

@johnstcn
Copy link
Member Author

LGTM 👍

Are you investigating any specific issue or do you intend to modify the aggregation?

I was investigating a heap dump captured during a load test and I saw this:

image

Figured it would be good to add a benchmark now so we can assess future improvements.

@johnstcn johnstcn merged commit 751c050 into main Jun 16, 2023
@johnstcn johnstcn deleted the cj/prometheusemtrics-aggregator-bench branch June 16, 2023 13:04
@github-actions github-actions bot locked and limited conversation to collaborators Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants