DynamoDB 抛出 ProvisionedThroughputExceededException 异常。

huangapple go评论82阅读模式
英文:

DynamoDB throwing an exception ProvisionedThroughputExceededException

问题

在DynamoDB中,有一张表出现了ProvisionedThroughputExceededException错误,我在AWS中检查了峰值,它很高,然而我们的流量非常少,还有其他表使用AWS DynamoDB SDK调用,没有任何问题。

我已经将WCU和RCU的自动扩展从1增加到20。

{ "code": "ProvisionedThroughputExceededException", "message": "表的配置的吞吐量级别已经超过。考虑使用UpdateTable API来增加配置级别。", "httpStatusCode": 400, "info": [] }

我有以下通用代码,适用于所有情况,但对于一张表,出现了意外的错误,然而,这是正确的吗?

public async Task<IEnumerable<T>> GetItemsByHashKeyAsync(object hashKeyValue, DynamoDBOperationConfig dynamoDBOperationConfig = null)
{
    return await context.QueryAsync<T>(hashKeyValue, dynamoDBOperationConfig).GetRemainingAsync();
}
英文:

In DynamoDB one of the table throws an error ProvisionedThroughputExceededException, I checked the spike in AWS and it was high however we have very less traffic, there are other tables that is being called using the AWS DynamoDB sdk without any issue.
I have activated WCU & RCU autoscaling from 1 to 20.

{"code":"ProvisionedThroughputExceededException","message":"The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.","httpStatusCode":400,"info":[]}

I've below code that is common for all, but for one table which is unexpected throwing an error, however, is it correct ??

public async Task&lt;IEnumerable&lt;T&gt;&gt; GetItemsByHashKeyAsync(object hashKeyValue, DynamoDBOperationConfig dynamoDBOperationConfig = null)
{
            return await context.QueryAsync&lt;T&gt;(hashKeyValue, dynamoDBOperationConfig).GetRemainingAsync();
}

答案1

得分: 1

我检查了AWS中的峰值,它很高,但我们的流量很少。

这是问题所在。DynamoDB以每分钟1次的间隔将指标发送到CloudWatch,这意味着您看到的指标是60秒期间的平均值。然而,DynamoDB按每秒的基础监视吞吐量。这意味着似乎您没有超出预配吞吐量,但实际上至少有1秒您已经超出了,这一分钟内的其余秒钟可能消耗较少,这意味着CW指标低于您的预期。

如果您的流量有急剧的突发增加,请考虑使用按需模式,在这种模式下,您不会因超出预配容量而被限制,它允许您在30分钟内消耗前一峰值的两倍。

英文:

>I checked the spike in AWS and it was high however we have very less traffic

This is the issue. DynamoDB emits metrics to CloudWatch at 1 min intervals, meaning the metrics you see are the average across a 60 second period. However, DynamoDB monitors throughput on a per-second basis. This means that it may seem like you did not exceed your provisioned throughput, but in actual fact you did for at least 1 second, the rest of the seconds in the minute could have a lower consumption meaning the CW metric is lower than you expect.

If you have sharp bursts in traffic, consider using on-demand mode where you will not get throttled for exceeding a provisioned capacity, it allows you to consume double your previous peak in 30 minutes.

huangapple
  • 本文由 发表于 2023年2月24日 01:04:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75548052.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定