Skip to content

Dyanmodb Enchanced has performance issues #3317

Closed
@hxy1991

Description

@hxy1991

Describe the bug

software.amazon.awssdk.enhanced.dynamodb.TableSchema:fromBean()

It takes ten milliseconds each time

image

Expected Behavior

0ms

Current Behavior

10ms+

Reproduction Steps

public void updateActivity(UserActivity userActivity, String updateExpression, Map<String, AttributeValue> expressionAttributeValues, List<TransactWriteItem> transList) {
    Stopwatch stopwatch = Stopwatch.createStarted();
    Map<String, AttributeValue> keyMap = dynamoDbTable.keyFrom(userActivity).primaryKeyMap(TableSchema.fromBean(UserActivity.class));

    log.info("updateActivity keyMap: {}", stopwatch.elapsed(TimeUnit.MILLISECONDS));

    Update update = Update.builder().updateExpression(updateExpression)
            .expressionAttributeValues(expressionAttributeValues)
            .key(keyMap)
            .tableName(tableName)
            .build();

    log.info("updateActivity update: {}", stopwatch.elapsed(TimeUnit.MILLISECONDS));

    TransactWriteItem transactWriteItem = TransactWriteItem.builder().update(update).build();
    transList.add(transactWriteItem);

    log.info("updateActivity transactWriteItem: {}", stopwatch.elapsed(TimeUnit.MILLISECONDS));
}

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

dynamodb-enhanced-2.17.123.jar

JDK version used

jdk11

Operating System and version

Linux test-kinjarun-business-deployment-c880e685-d846b4fff-jmhlz 5.4.196-108.356.amzn2.aarch64 #1 SMP Thu May 26 12:49:47 UTC 2022 aarch64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions