-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Use encoding/json as JSON decoder instead of mapstructure #6680
Conversation
Here are before/after benchmarks per endpoint. These values == Note the last value in particular (the original bug).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this is looking good. I left a handful of questions inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I am late to the party, but the numbers are exciting!! |
Hey there, This issue has been automatically locked because it is closed and there hasn't been any activity for at least 30 days. If you are still experiencing problems, or still have questions, feel free to open a new one 👍. |
After research and benchmarking, I have determined that using the Go standard library's
encoding/json
as a JSON decoder instead ofmitchellh/mapstructure
will yield massive performance gains, particularly in the case where we are passing around large JSON values (benchmarks are showing ~300x speed improvement in this particular case).In this PR, I have changed JSON decoding in our agent code to use only the standard library's
encoding/json
.Users should see immediate performance improvements for most HTTP agent endpoints with a request body. Most endpoints should see a 1x-10x improvement in decoding time per request, regardless of the request body. K/V writes (Txn endpoint) should see O(100x) decoding time improvements for large Values.
Resource utilization for agent JSON decoding should also improve with this PR, ~same order of magnitude per endpoint.
Fixes #6147