Skip to content

Add OTLP write handler benchmark #6378

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

Conversation

SungJin1212
Copy link
Member

@SungJin1212 SungJin1212 commented Nov 27, 2024

This PR adds a benchmark for the OTLP write handler.

The result is as follows:

BenchmarkOTLPWriteHandler
BenchmarkOTLPWriteHandler/json_with_no_compression
BenchmarkOTLPWriteHandler/json_with_no_compression-10         	   57388	     19514 ns/op	   21898 B/op	     355 allocs/op
BenchmarkOTLPWriteHandler/json_with_gzip
BenchmarkOTLPWriteHandler/json_with_gzip-10                   	   36260	     33121 ns/op	   68106 B/op	     365 allocs/op
BenchmarkOTLPWriteHandler/proto_with_no_compression
BenchmarkOTLPWriteHandler/proto_with_no_compression-10        	   77604	     15191 ns/op	   19700 B/op	     263 allocs/op
BenchmarkOTLPWriteHandler/proto_with_gzip
BenchmarkOTLPWriteHandler/proto_with_gzip-10                  	   49032	     24456 ns/op	   64703 B/op	     270 allocs/op
PASS

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

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

CI doesn't run this. I am curious what are the numbers you are getting. do you mind sharing as a comment?

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 27, 2024
@SungJin1212
Copy link
Member Author

@friedrichg
Sure, I add it to the PR description.

Copy link
Member

@CharlieTLe CharlieTLe left a comment

Choose a reason for hiding this comment

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

Could we reuse some of the setup and timing parts of each test type to keep the code DRY?

@SungJin1212 SungJin1212 force-pushed the Add-OTLPWriteHandler-Benchmark branch from 79e6a7f to 3073ff5 Compare November 28, 2024 04:52
@SungJin1212
Copy link
Member Author

SungJin1212 commented Nov 28, 2024

@CharlieTLe
I have refactored the test code!

Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
@SungJin1212 SungJin1212 force-pushed the Add-OTLPWriteHandler-Benchmark branch from 3073ff5 to 3af142e Compare November 28, 2024 07:49
@SungJin1212
Copy link
Member Author

@CharlieTLe
Could you take a look when you have time?

Copy link
Member

@alanprot alanprot left a comment

Choose a reason for hiding this comment

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

Thanks

@CharlieTLe
Copy link
Member

I was also able to reproduce a similar benchmark

goos: darwin
goarch: arm64
pkg: github.com/cortexproject/cortex/pkg/util/push
cpu: Apple M1 Pro
BenchmarkOTLPWriteHandler
BenchmarkOTLPWriteHandler/json_with_no_compression
BenchmarkOTLPWriteHandler/json_with_no_compression-10         	   58062	     19842 ns/op	   21834 B/op	     353 allocs/op
BenchmarkOTLPWriteHandler/json_with_gzip
BenchmarkOTLPWriteHandler/json_with_gzip-10                   	   35395	     33751 ns/op	   68043 B/op	     363 allocs/op
BenchmarkOTLPWriteHandler/proto_with_no_compression
BenchmarkOTLPWriteHandler/proto_with_no_compression-10        	   75156	     15652 ns/op	   19636 B/op	     261 allocs/op
BenchmarkOTLPWriteHandler/proto_with_gzip
BenchmarkOTLPWriteHandler/proto_with_gzip-10                  	   46663	     26699 ns/op	   64640 B/op	     268 allocs/op
PASS

@CharlieTLe CharlieTLe merged commit 81321dc into cortexproject:master Dec 18, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size/L
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants