我有一个grails应用程序。我正在使用亚马逊的dynamodb进行访问的特定要求,并且条目是由其他应用程序添加的。现在,我需要从dynamodb表到postgreSQL表中获取所有信息。在dynamodb中有10000多个记录,但是吞吐量是
Read capacity units : 100
Write capacity units : 100
在BuildConfig.groovy中,我定义了插件
compile ":dynamodb:0.1.1"
在config.groovy中,我有以下配置
grails {
dynamodb {
accessKey = '***'
secretKey = '***'
disableDrop = true
dbCreate = 'create'
}
}
我的代码看起来与此类似
class book {
Long id
String author
String name
date publishedDate
static constraints = {
}
static mapWith = "dynamodb"
static mapping = {
table 'book'
throughput read:100
}
}
当我尝试类似book.findAll()时,出现以下错误
AmazonClientException: Unable to unmarshall response (Connection reset)
当我尝试通过尝试类似book.findAllByAuthor()来减少记录数时(也有超过1000条记录),我得到以下错误
Caused by ProvisionedThroughputExceededException: Status Code: 400, AWS Service: AmazonDynamoDB, AWS Request ID: ***, AWS Error Code: ProvisionedThroughputExceededException, AWS Error Message: The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.
尽管吞吐量受到限制,但我仍需要获取dynamodb中的所有记录,并将其保存在postgres表中。有办法吗?
我是这个 Realm 的新手,在此先感谢您的帮助。
经过一番研究,我来到了Google Guava。但是即使使用Guava RateLimiter,也不会有固定的次数发送需要多长时间的请求。所以我正在寻找一个适合我的要求的解决方案
最佳答案
可能您的问题根本与grails无关。返回的错误消息声明:The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API
因此,您应该考虑提高吞吐量水平(对于该选项,您必须支付更多)或调整查询以遵守实际限制。
还可以查看以下答案:https://stackoverflow.com/a/31484168/2166188