Kinesis Binder默认发电机数据库表上的读取容量和写入容量

时间:2019-05-04 15:17:20

标签: spring-cloud-stream amazon-kinesis spring-cloud-aws spring-integration-aws

根据Spring Aws Kinesis Binder中的文档,readCapacity和writeCapacity的默认值为1

https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/blob/master/spring-cloud-stream-binder-kinesis-docs/src/main/asciidoc/overview.adoc#lockregistry

  

readCapacity DynamoDb表的读取容量。参见Kinesis   预设吞吐量

     

默认值:1

     

writeCapacity DynamoDb表的写入容量。参见Kinesis   预设吞吐量默认值:1

从Kinesis Client代码中,我可以看到默认值为10。

https://github.com/awslabs/amazon-kinesis-client/blob/master/amazon-kinesis-client/src/main/java/software/amazon/kinesis/leases/dynamodb/TableConstants.java

Spring Kinesis Binder中是否有任何自定义项。

修改

  

我的锁表的读写容量为40。

我这样配置活页夹

spring: 
  cloud:
    stream:
      kinesis:
        binder:
          locks:
            table: customLocks
            readCapacity: 5
            writeCapacity: 2
          checkpoint:
            table: customCheckPoints
            readCapacity: 5
            writeCapacity: 2
        bindings:
          inputone:
            consumer:
              listenerMode: batch
              idleBetweenPolls: 500
              recordsLimit: 50
          inputtwo:
            consumer:
              listenerMode: batch
              idleBetweenPolls: 500
              recordsLimit: 50
      bindings:
        inputone:
          group: my-group-1
          destination: stream-1
          content-type: application/json
        inputtwo:
          group: my-group-2
          destination: stream-2
          content-type: application/json

我有三个运行这些配置的容器。

  

我看到针对的ProvisionedThroughputExceededException   customLocks表。

不确定活页夹是否正在尝试使dynamo db锁定表超载。

2019-05-05 07:49:52.216  WARN --- [-kinesis-shard-locks-1] ices.dynamodbv2.AmazonDynamoDBLockClient : Could not acquire lock because of a client side failure in talking to DDB
com.amazonaws.services.dynamodbv2.model.ProvisionedThroughputExceededException: The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API. (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ProvisionedThroughputExceededException; Request ID: 94CURTLH858HM3RRELMSB6J817VV4KQNSO5AEMVJF66Q9ASUAAJG)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1632)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1304)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1058)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
    at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.doInvoke(AmazonDynamoDBClient.java:3452)
    at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:3428)
    at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.executeGetItem(AmazonDynamoDBClient.java:1789)
    at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.getItem(AmazonDynamoDBClient.java:1764)
    at com.amazonaws.services.dynamodbv2.AmazonDynamoDBLockClient.readFromDynamoDB(AmazonDynamoDBLockClient.java:997)
    at com.amazonaws.services.dynamodbv2.AmazonDynamoDBLockClient.getLockFromDynamoDB(AmazonDynamoDBLockClient.java:743)
    at com.amazonaws.services.dynamodbv2.AmazonDynamoDBLockClient.acquireLock(AmazonDynamoDBLockClient.java:402)
    at com.amazonaws.services.dynamodbv2.AmazonDynamoDBLockClient.tryAcquireLock(AmazonDynamoDBLockClient.java:567)
    at org.springframework.integration.aws.lock.DynamoDbLockRegistry$DynamoDbLock.doLock(DynamoDbLockRegistry.java:504)
    at org.springframework.integration.aws.lock.DynamoDbLockRegistry$DynamoDbLock.tryLock(DynamoDbLockRegistry.java:478)
    at org.springframework.integration.aws.lock.DynamoDbLockRegistry$DynamoDbLock.tryLock(DynamoDbLockRegistry.java:452)
    at org.springframework.integration.aws.inbound.kinesis.KinesisMessageDrivenChannelAdapter$ShardConsumerManager.lambda$run$0(KinesisMessageDrivenChannelAdapter.java:1198)
    at org.springframework.integration.aws.inbound.kinesis.KinesisMessageDrivenChannelAdapter$ShardConsumerManager.dt_access$257(KinesisMessageDrivenChannelAdapter.java)
    at java.util.Collection.removeIf(Collection.java:414)
    at org.springframework.integration.aws.inbound.kinesis.KinesisMessageDrivenChannelAdapter$ShardConsumerManager.run(KinesisMessageDrivenChannelAdapter.java:1191)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

1 个答案:

答案 0 :(得分:0)

对于我来说,似乎容量越大,您在AWS账户中支付的费用就越多。确实可以通过public class Order : Entity, IAggregateRoot { public OrderStatus OrderStatus { get { return Enumeration.FromValue<OrderStatus>(_orderStatusId); } private set { Status = value; } } private int _orderStatusId; public Order() { _orderStatusId = OrderStatus.Submitted.Id; } } 来更改这种配置:

application.properties

而这正是该文档中有关Kinesis Binder的内容。