Reduce allocs in ReadMessage (unix transport)#347
Merged
guelfey merged 6 commits intogodbus:masterfrom Dec 17, 2022
Merged
Conversation
9625d0b to
610d8b4
Compare
Context cancelled, server emitted 2670 signals. panic: read unix @->/run/user/1001/bus
610d8b4 to
cc6e0c0
Compare
35cb2ef to
925ecbb
Compare
Contributor
Author
|
I figured out why there was an extra memory consumption per operation after refactoring and resolved the problem. |
925ecbb to
a8c1d8f
Compare
Contributor
Author
|
Down to 606 allocs from 907, also the benchmark shows 8.17KB less memory usage. |
Contributor
Author
|
I will try these changes on some realistic workload to make sure there is no regression. |
Contributor
Author
|
I have tested the changes on Parca Agent and posted memory profiles here parca-dev/parca-agent#1037 (comment). |
guelfey
approved these changes
Dec 17, 2022
Member
guelfey
left a comment
There was a problem hiding this comment.
Thanks for the work and detailed stats!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It appeared to me that certain decoding performed in
ReadMessagewas repeated inDecodeMessageWithFDs, so I got rid of it. That yielded 58 less allocs, though consumed 5.63KB more per operation according to the benchmark.It seems more memory is spent at
syscall.anyToSockaddrafter refactoring, see the profiles below.new
Details
old
Details