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

[chore] [exporter/splunkhec] Reuse jsoniter stream/buffer #22016

Merged
merged 1 commit into from
May 16, 2023

Conversation

dmitryax
Copy link
Member

@dmitryax dmitryax commented May 16, 2023

This improves performance by avoiding buffer allocation for every json encoded HEC event.

Before:

Before:

goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter
Benchmark_pushLogData_10_10_1024
Benchmark_pushLogData_10_10_1024-10    	   35157	     35594 ns/op	   30895 B/op	     450 allocs/op
Benchmark_pushLogData_10_10_8K
Benchmark_pushLogData_10_10_8K-10      	   12478	     96064 ns/op	   87443 B/op	    1264 allocs/op
Benchmark_pushLogData_10_10_2M
Benchmark_pushLogData_10_10_2M-10      	   12481	     97948 ns/op	   90148 B/op	    1299 allocs/op
Benchmark_pushLogData_10_200_2M
Benchmark_pushLogData_10_200_2M-10     	     571	   2220018 ns/op	 1825808 B/op	   26002 allocs/op
Benchmark_pushLogData_100_200_2M
Benchmark_pushLogData_100_200_2M-10    	      70	  14679068 ns/op	14020439 B/op	  198538 allocs/op
Benchmark_pushLogData_100_200_5M
Benchmark_pushLogData_100_200_5M-10    	      55	  18776145 ns/op	18467160 B/op	  259916 allocs/op
BenchmarkConsumeLogsRejected
BenchmarkConsumeLogsRejected-10        	    1147	   1066386 ns/op	  912826 B/op	   13004 allocs/op

After:

pkg: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter
Benchmark_pushLogData_10_10_1024
Benchmark_pushLogData_10_10_1024-10    	   37986	     32484 ns/op	   25432 B/op	     416 allocs/op
Benchmark_pushLogData_10_10_8K
Benchmark_pushLogData_10_10_8K-10      	   13611	     88131 ns/op	   71820 B/op	    1167 allocs/op
Benchmark_pushLogData_10_10_2M
Benchmark_pushLogData_10_10_2M-10      	   13221	     90941 ns/op	   74053 B/op	    1199 allocs/op
Benchmark_pushLogData_10_200_2M
Benchmark_pushLogData_10_200_2M-10     	     603	   1919072 ns/op	 1483452 B/op	   24000 allocs/op
Benchmark_pushLogData_100_200_2M
Benchmark_pushLogData_100_200_2M-10    	      79	  13570264 ns/op	11297322 B/op	  183258 allocs/op
Benchmark_pushLogData_100_200_5M
Benchmark_pushLogData_100_200_5M-10    	      60	  19903358 ns/op	14860723 B/op	  239911 allocs/op
BenchmarkConsumeLogsRejected
BenchmarkConsumeLogsRejected-10        	    1239	    979921 ns/op	  740291 B/op	   12002 allocs/op

@dmitryax dmitryax requested a review from a team May 16, 2023 17:36
@dmitryax dmitryax requested a review from atoulme as a code owner May 16, 2023 17:36
@dmitryax dmitryax force-pushed the hec-exp-reuse-json-streams branch 2 times, most recently from 583814d to 17013c9 Compare May 16, 2023 17:50
@dmitryax dmitryax changed the title [chore] [exporter/splunk/hec] Reuse jsoniter stream/buffer [chore] [exporter/splunkhec] Reuse jsoniter stream/buffer May 16, 2023
This improves performance by avoiding buffer allocation for every json encoded HEC event.
@dmitryax dmitryax force-pushed the hec-exp-reuse-json-streams branch from 17013c9 to 55a2d88 Compare May 16, 2023 19:39
@dmitryax dmitryax merged commit 3a7c7f2 into open-telemetry:main May 16, 2023
@github-actions github-actions bot added this to the next release milestone May 16, 2023
@dmitryax dmitryax deleted the hec-exp-reuse-json-streams branch May 16, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants