-
Notifications
You must be signed in to change notification settings - Fork 593
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
improve performance of json marshalling #1312
Comments
I have been reading through the sdk code to understand how the kinesis client puts records onto a stream, and I ended up in Out of curiosity, what is the reason to have an alternative json marshalling framework just for AWS requests? Was there a limit to what the stdlib could achieve? |
We did an extensive amount of benchmarking and optimization prior to the release of the SDK is detailed in the launch blog post here. This includes a link to the DynamoDB benchmarking program that can be used to test and review the results. V2 made significant performance improvements over the V1 SDK, and there is certainly the ability to continue to derive new improvements based on the flexibility in our design. As a side note the V2 SDK does not currently support the event streaming protocol, which is why you were not able to find the KinesisEvent type. With that said, I am going to move to mark this ticket for closure unless there is no further responses as it would appear this ticket was cut in haste. |
Oh that's excellent news, thanks! I read the v2 release notes but didn't see anything about the change to the way json works, or anything about the lambda events. As an aside: I've not been able to upgrade to v2 because it is quite difficult to track down all the modules and new imports I have to use, but that's a completely separate issue to this. |
|
As a follow-up, there is a migration guide available for moving from V1 to V2 here. We attempted to capture the significant locations of where features were moved to as part of the broader restructure. If there is anything missing or you would like to see added to the guide that is making the migration difficult please do not hesitate to cut us an issue. |
I see what happened re: v2, I assumed that the lambda runtime library was released in tandem with the sdk v2 and the inability to find v2 lambda stuff threw me off. I think I should have raised this ticket over at https://github.com/aws/aws-lambda-go ! |
Is your feature request related to a problem? Please describe.
As detailed in the fantastic article at https://yalantis.com/blog/speed-up-json-encoding-decoding/ the default json marshaling / unmarshaling in Go uses reflection and is quite slow compared to what is possible.
It is possible to provide a custom marshaler for a type by implementing a stdlib inferface. However it is quite tedious. Thankfully, the tool ffjson does all the codegen!
Describe the solution you'd like
For the SDK to ship optimised marshallers and unmarshallers for types that are sent over JSON.
Describe alternatives you've considered
easyjson is a similar alternative if for some reason ffjson doesn't do the job. The linked article also includes a summary of other alternatives, but neither are a drop in replacement.
Additional context
The benchmark results in the article conclude
easyjson and ffjson offer the biggest win for "large" and "extra large" objects, and are no worse than the stdlib for small objects.
However, as with everything, it would make sense to perform some benchmarks on typical AWS data, e.g. I am particularly interested in
events.KinesisEvent
(link to v1 because I can't find it in v2) and everything involved in writing events out to kinesis (PutRecordsInput
and its dependencies), which could make for an excellent pilot study. The true test would be if my lambda invocations get smaller as a result of using a non-reflective decoder.The text was updated successfully, but these errors were encountered: