提问者:小点点

本地运行DynamoDb的默认预配吞吐量(读写容量单位)是多少?


我是DynamoDb的新手,尝试使用Java在本地运行的DynamoDb上批量插入大约5.5k个项目。尽管我尽了最大努力,也做了各种调整,但我能够在大约100秒内完成(即使在使用执行器框架之后)。

我在这里发布了我的代码,但没有得到答复。

为了提高插入率,我在创建表时尝试了几次更改提供的吞吐量值,然后我发现在本地运行时,dynamodb会忽略吞吐量值。所以我认为是我的dynamodb不能一次处理这么多写请求,当我在AWS服务器上处理时,性能可能会提高。

这是我用来创建表的代码:

    public static void main(String[] args) throws Exception {
        AmazonDynamoDBClient client = new AmazonDynamoDBClient().withEndpoint("http://localhost:8000");

        DynamoDB dynamoDB = new DynamoDB(client);
        String tableName = "Database";
        try {
            System.out.println("Creating the table, wait...");
            Table table = dynamoDB.createTable(tableName, Arrays.asList(new KeySchemaElement("Type", KeyType.HASH),
                    new KeySchemaElement("ID", KeyType.RANGE)

            ), Arrays.asList(new AttributeDefinition("Type", ScalarAttributeType.S),
                    new AttributeDefinition("ID", ScalarAttributeType.S)),
                    new ProvisionedThroughput(10000L, 10000L));
            table.waitForActive();
            System.out.println("Table created successfully.  Status: " + table.getDescription().getTableStatus());

        } catch (Exception e) {
            System.err.println("Cannot create the table: ");
            System.err.println(e.getMessage());
        }
    }

但要确定我想知道本地运行的 dynamodb 实例的默认读写容量单位是什么?


共1个答案

匿名用户

DynamoDBLocal不以任何方式实现吞吐量限制。如果您的吞吐量受到限制,那么它会受到运行它的硬件的限制。

来自DynamoDB本地文档:

对表数据进行读写操作的速度只受计算机速度的限制。

根据对一个相关问题的回答,性能明显很差,因为DynamoDB local在幕后使用SQLite。由于实现不同于真正的DynamoDB,我们应该预料到性能也会不同。

如果您需要使用 DynamoDB 进行任何性能测试,则应使用真正的 DynamoDB。我的公司已将 DynamoDB 用于每秒读取和写入数万次的应用程序,而 DynamoDB 没有任何扩展问题,因此我可以证明真正的 DynamoDB 的性能将比 DynamoDB Local 好得多。