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

refactor(sumologicexporter): optimize compressor using sync.Pool #518

Merged
merged 2 commits into from
Apr 4, 2022

Conversation

pmalek-sumo
Copy link
Contributor

This PR tries to address unnecessary creation of data compressor instances on every push(Logs|Metrics|Traces) invocation using sync.Pool

$ go test -v -count 1 -run ^$ -bench Benchmark_ExporterPushLogs -benchmem -count 5 -benchtime 200x . > old.txt
$ git(5651893) gco -
Previous HEAD position was 5651893 tests(sumologicexporter): add exporter logs sending benchmark
Switched to branch 'optimize-compression'
$ go test -v -count 1 -run ^$ -bench Benchmark_ExporterPushLogs -benchmem -count 5 -benchtime 200x . > new.txt
$ benchcmp old.txt new.txt
benchcmp is deprecated in favor of benchstat: https://pkg.go.dev/golang.org/x/perf/cmd/benchstat
benchmark                         old ns/op     new ns/op     delta
Benchmark_ExporterPushLogs-16     2396758       2079249       -13.25%
Benchmark_ExporterPushLogs-16     2558661       2250972       -12.03%
Benchmark_ExporterPushLogs-16     3170924       2782736       -12.24%
Benchmark_ExporterPushLogs-16     2857462       2505237       -12.33%
Benchmark_ExporterPushLogs-16     3131852       2938191       -6.18%

benchmark                         old allocs     new allocs     delta
Benchmark_ExporterPushLogs-16     24928          24744          -0.74%
Benchmark_ExporterPushLogs-16     24923          24732          -0.77%
Benchmark_ExporterPushLogs-16     24928          24735          -0.77%
Benchmark_ExporterPushLogs-16     24935          24741          -0.78%
Benchmark_ExporterPushLogs-16     24933          24734          -0.80%

benchmark                         old bytes     new bytes     delta
Benchmark_ExporterPushLogs-16     13578172      3824937       -71.83%
Benchmark_ExporterPushLogs-16     13575409      3562536       -73.76%
Benchmark_ExporterPushLogs-16     13575177      3666318       -72.99%
Benchmark_ExporterPushLogs-16     13579142      3653744       -73.09%
Benchmark_ExporterPushLogs-16     13576525      3586314       -73.58%

@pmalek-sumo pmalek-sumo self-assigned this Apr 4, 2022
@github-actions github-actions bot added the go label Apr 4, 2022
@pmalek-sumo pmalek-sumo force-pushed the optimize-compression branch 2 times, most recently from eb6e0e9 to e447dfa Compare April 4, 2022 09:12
@pmalek-sumo pmalek-sumo marked this pull request as ready for review April 4, 2022 09:29
@pmalek-sumo pmalek-sumo requested a review from a team as a code owner April 4, 2022 09:29
@pmalek-sumo pmalek-sumo changed the title Optimize compression refactor(sumologicexporter): optimize compressor using sync.Pool Apr 4, 2022
@pmalek-sumo pmalek-sumo force-pushed the optimize-compression branch from e447dfa to eaf9e36 Compare April 4, 2022 13:23
@pmalek-sumo pmalek-sumo enabled auto-merge (squash) April 4, 2022 13:24
@pmalek-sumo pmalek-sumo merged commit ca20b4d into main Apr 4, 2022
@pmalek-sumo pmalek-sumo deleted the optimize-compression branch April 4, 2022 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants