Closed sugmanue closed 2 months ago
Failed conditions
41.6% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)
See analysis details on SonarCloud
Catch issues before they fail your Quality Gate with our IDE extension SonarLint
Motivation and Context
The current unmarshalling process is split into two phases. During the first phase the input is parsed into a
JsonNode
instance that represents the whole JSON input. The second phase uses thisJsonNode
to unmarshall the nodes into SDK pojos.For a regular JSON input the input, numeric values are represented as strings (e.g.,
3.14
,"17"
), therefore we need to parse the strings to convert them into a numeric type. For Smithy RPCv2 we don't need this, the values in the CBOR payload are already encoded in a way that's a lot cheaper to convert than parsing the string.This change makes it possible to read from the CBOR input the encoded values without having to convert them into strings and back into numbers. For that it changes the two phases of the unmarshalling process:
JsonNode
, we create aEmbeddedObjectJsonNode
which can carry anyObject
with the numeric value. For that, we introduce a new abstractionJsonValueNodeFactory
which is used to create nodes for simple types which creates plainJsonNode
by default but a different implementation createsEmbeddedObjectJsonNode
for CBOR payloads.Benchmarks
The benchmarks results show below are from unmarshalling a single value of a shape similar to
GetMetricData
(see here), similar to getting a set of datapoints from a time series (each datapoint is a pair of the time and a floating point value). For the test we labeled 3 samples with "small", "medium", and, "big", and those vary by the amount of datapoints. The labeled "small" has 17, the one labeled "medium" has 37, and, finally the one labeled "big" has 157 datapoints.The full benchmark results are shown below (showing only for unmarshall, no changes in the marshall results). The summary of how Smithy RPCv2 implementation compares with AWS-JSON is:
After
Before
After this change
Before this change
Modifications
Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License