spring-cloud-stream - 带有 kinesis 的 Spring 云流:AmazonDynamoDBLockClient 在循环中抛出异常
问题描述
我们有一个非常简单的 spring-cloud-stream 应用程序,它从 AWS-Kinesis 队列中读取数据。它已经工作了一段时间没有问题。它只有很小的工作量。
今天,我们每秒收到 100 多个异常。(这比我们在这个应用程序上拥有的用户还多,所以它看起来像是一个无休止的重试循环)
WARN --- [s-shard-locks-1] c.a.s.d.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
...
at org.springframework.integration.aws.lock.DynamoDbLockRegistry$DynamoDbLock.doLock(DynamoDbLockRegistry.java:504)
代码很简单:
@StreamListener(Channels.OUR_CHANNEL)
fun consumeThing(Thing: MutableMap<Any, Any>) {
log.info("thing received: {}.", thing)
// some methods to write it to our own datbase
}
我们只有一个基本配置:
spring:
cloud:
stream:
defaultBinder: kinesis
bindings:
thingsChannel:
group: aGroup
destination: aDestionation
在 AWS-Console 中,我们看到一条警告,指出在 DynamoBD 中 SpringIntegrationLockRegistry 超出了读取容量。我们把它从1到10,但仍然有问题。
如何配置 spring-data-cloud 和 kinesis 使其更具弹性,并且在没有等待时间的情况下不要重试?
解决方案
请查看以下可能的选项LockRegistry
: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
看起来 AWS 控制台中表上的策略已更改。您可能需要重新考虑该表或我提到的客户端的一些超时和读写容量。
您可以在此处阅读有关 DynamoDB Lock Client 的更多信息,它已经不受 Spring Cloud Stream 控制。顺便说一句,这是项目的名称,而不是data
...
推荐阅读
- javascript - 点击一个 href = javascript: function() node-html-parser
- node.js - 如何将 socket.io 与 node.js worker_threads 一起使用
- amazon-web-services - AWS 内部的 Docker 容器无法从外部访问
- visual-studio-code - 如何在编辑特定格式的文件时禁用 vscode 扩展?
- fonts - 通过 Vuetify / Vuejs / Laravel 中的自定义字体覆盖默认字体
- excel - Excel vba 将 Word 文件保存在位置 - 运行缓慢
- java - 如何手动填充表格/网格
- javascript - 如何在 Select 标签中放置 2000 多个项目?
- html - 为 CSS 动画添加悬停效果
- c# - 如何在c#中反序列化来自http发布的json文件的数据