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

DynamoDB unmarshalling slow #3551

Open
1 task
michelemottini opened this issue Nov 16, 2024 · 7 comments
Open
1 task

DynamoDB unmarshalling slow #3551

michelemottini opened this issue Nov 16, 2024 · 7 comments
Labels
bug This issue is a bug. dynamodb p2 This is a standard priority issue queued v4

Comments

@michelemottini
Copy link

Describe the bug

Unmarshalling DynamoDB GetItem / BatchGetItem response is slow - ~700 msec for a 1.7 MB response

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Unmarshalling time << of the HTTP request time

Current Behavior

Unmarshalling time >> of the HTTP request time

Reproduction Steps

Copy the following files in a S3 folder:

djk7enshnmzkphkldeszvgzole.json.gz
ikhj4i2zsi4ptfwkszjkizzvly.json.gz
jmknnpggim2u3fd3lknw5njlsq.json.gz
m5lnl37q7a7z7hvykktyqt2mn4.json.gz

Use the DynamoDB 'Import from S3' function on that folder to create a table

  • Table name dbperftest
  • Data format: DynamoDB JSON compressed
  • Partition key: @rid (string)
    -No sort key
  • Capacity mode: on demand
  • No indexes, default encryption at rest

Download, compile and run

DBPerfTestConsole.zip

  • it expects AWS profile and region in the AWS_PROFILE and AWS_REGION environment variables (SSO is fine)
  • it reads data from the dbperftest table in various ways - main one being reading 100 items using a single BatchGetItemCall - whose statistics are:
CredentialsRequestTime = 00:00:00.0000269; RequestSigningTime = 00:00:00.0003347; HttpRequestTime = 00:00:00.2243586; ResponseUnmarshallTime = 00:00:00.7423187; ResponseProcessingTime = 00:00:00.7452110; ClientExecuteTime = 00:00:00.9727216;

with an unmarshall time that is more than three times the HTTP request time

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWSSDK.DynamoDBv2 3.7.403.3

Targeted .NET Platform

.NET Core 8

Operating System and version

Windows 11, Amazon Linux

@michelemottini michelemottini added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 16, 2024
@normj
Copy link
Member

normj commented Nov 16, 2024

We are currently working on a V4 of the SDK. As part of that V4 we hoping to switch the SDK's JSON parsing to System.Text.Json from the its internal usage of a JSON library called LitJson. We aren't far enough yet with the change to measure the performance difference but we will use your sample code for measure the difference.

@ashishdhingra ashishdhingra added dynamodb v4 needs-review and removed needs-triage This issue or PR still needs to be triaged. labels Nov 18, 2024
@ashishdhingra
Copy link
Contributor

Needs review with the team as v4 backlog item.

@michelemottini
Copy link
Author

Does this mean that this is not going to be fixed until V4? . . . and when would V4 be available?

@dscpinheiro
Copy link
Contributor

We're not planning to change the serialization in V3 as that'd be too much of a breaking change. For V4, you can track the progress here: #3362

See also Norm's latest comment about V4's timeline: #3362 (comment)

@michelemottini
Copy link
Author

I see . . .

I tried with the v4 preview and the unmarshalling time is better but still not great:

HttpRequestTime = 00:00:00.1873335; ResponseUnmarshallTime = 00:00:00.3164829; ResponseProcessingTime = 00:00:00.3181069; ClientExecuteTime = 00:00:00.5074811;

(it is 2 times slower than the raw DynamoDB call instead of 4+ . . . )

@normj
Copy link
Member

normj commented Nov 19, 2024

Keep in mind that HttpRequestTime is the time to first byte but the full response is read while doing the unmarshalling. So the numbers are a bit misleading what is exactly the "HTTP" part and the "Unmarshalling" part.

@michelemottini
Copy link
Author

Ah I see, thanks

@ashishdhingra ashishdhingra added the p2 This is a standard priority issue label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. dynamodb p2 This is a standard priority issue queued v4
Projects
None yet
Development

No branches or pull requests

4 participants