简体   繁体   English

Dynamodb阅读性能差

[英]Dynamodb poor read performance

These days, I have tested Dynamodb performance and I have been disappointed at the performance. 这些天,我已经测试了Dynamodb的性能,但对该性能感到失望。

I used query command on just partition-key without any filter condition. 我只对分区键使用了query命令,没有任何过滤条件。 It means it just simply reads an index and return. 这意味着它只是读取索引并返回。

dynamodb.query(
    TableName='test-table',
    ReturnConsumedCapacity='TOTAL',
    KeyConditionExpression='tid = :tid',
    Limit=5000,
    ExpressionAttributeValues={
        ':tid': {'N': '9999999'},
    }
)

---------- Part of Response ----------
{
    .
    .
    .
    "Count": 5000,
    "ScannedCount": 5000,
    "LastEvaluatedKey": {
        "tid": {
            "N": "9999999"
        },
        "uid": {
            "N": "985377"
        }
    },
    "ConsumedCapacity": {
        "TableName": "sam-push-test",
        "CapacityUnits": 110.5
    }
}

It takes about 0.5 sec. 大约需要0.5秒。 It is tested in AWS Lambda(1024 memory) located in the same region as Dynamodb. 已在与Dynamodb相同区域的AWS Lambda(1024内存)中对其进行了测试。

I am curious that poor performance is a normal situation or there should be something I have missed. 我很好奇表现不佳是正常情况,还是应该错过一些东西。

Apparently, AWS is saying about Dynamodb delivers single-digit millisecond performance. 显然,AWS在谈论Dynamodb提供单位毫秒的性能。

Amazon DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale. Amazon DynamoDB是一个键值和文档数据库,可在任何规模上提供单位毫秒的性能。

In addition, query-latency metric in Dynamodb console shows 100-150ms on my test. 此外,在Dynamodb控制台中的query-latency指标在我的测试中显示100-150ms。

How is it measured? 如何测量?

You should expect single digit millisecond performance when reading or writing a single item. 在读取或写入单个项目时,您应该期望单位毫秒的性能。 But when querying a page of 5000 items (as it seems to be in your case) it's normal to see ~100ms. 但是,当查询一页包含5000个项目的页面时(看起来好像是您的情况),通常会看到〜100ms。

Of course, you should also make sure that the client is not too far away from the DynamoDB endpoint. 当然,您还应该确保客户端与DynamoDB终结点之间的距离不太远。 A round trip around the world can easily add more than 100ms. 环游世界很容易会增加100毫秒以上的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM