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

标签 java amazon-web-services amazon-dynamodb executorservice dynamo-local

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

我发布了我的代码 here ,但没有得到答案。

为了提高插入率,我在创建表时尝试多次更改预置吞吐量值,然后我发现在本地运行时,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 实例的默认读写容量单位是什么?

最佳答案

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

来自DynamoDB Local docs:

The speed of read and write operations on table data is limited only by the speed of your computer.

根据 this answer 的相关问题,性能明显较差,因为 DynamoDB local 在幕后使用 SQLite。由于实现与真实的 DynamoDB 不同,我们应该预期性能也会不同。

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

关于java - 本地运行的 DynamoDb 的默认预配置吞吐量(读取和写入容量单位)是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56826173/

相关文章:

java - Spring Boot 未根据配置文件读取正确的属性

amazon-web-services - S3 通知配置 - 无法验证目标配置

node.js - 停止 dynamodb 中的重复条目

node.js - 是否编写node.js api回调

java - 为可运行类创建 junit 测试

java - 通过 LinkedIn 中的 id 获取人员的联系

java - 如何远程运行 TestNG Selenium 测试?

amazon-web-services - 添加 LIMIT 修复了 Amazon Redshift 中的 "Invalid digit, Value N"错误。为什么?

amazon-web-services - 通过 aws education 账户为 IAMUSER 创建访问 token 时出现问题

aws-lambda - Lambda 函数中的过滤条件