如何创建警报以检测 DynamoDb 限制已达到特定百分比,然后再增加它 [英] How do I create an Alarm to detect DynamoDb limits have reached a certain percent and then increase it
问题描述
我正在编写一个 Web 应用程序,该应用程序每天的流量都在稳步增加.我想创建一个警报,可以检测我的读/写限制是否已达到某个百分比(如 80%),然后增加该限制.然后我会在午夜再次减少它.
I'm writing a web application that has steadily increasing traffic through the day. I'd like to create an Alarm that can detect if my read / write limits have reached a certain percentage (like 80%), and then increase that limit. I will then decrease it again at midnight.
我尝试过创建警报 - 平均"似乎有点无用,并且始终为 1.0.总和"更有用,所以我认为我应该使用它.我还假设我应该在指标名称处使用消耗的写入/读取容量.
I've tried creating an Alarm - "Average" seems a bit useless and is always 1.0. "Sum" is more useful so I assume i should use this. I also assume i should use Consumed Write/Read Capacity at the metric name.
问题:
Sum 似乎使用Count"的绝对值作为其限制.如果我的 DynamoDB 设置为 100 次写入,并且我设置了 80% 的警报,它会检查我的写入是否超过 0.8,而不是 80.
Sum seems to use an absolute value of "Count" for its limits. If my DynamoDB is set to 100 writes, and i setup an alarm for 80%, it checks if my writes exceed 0.8, not 80.
我已经设置了一个电子邮件主题,但这不正确 - 我假设我需要创建一个主题可以调用的函数/控制器.我将如何设置它,如果您有 2 个 Amazon VM,会同时调用还是只调用一个?或者这是错误的路线,并且可以对事件采取标准操作来增加 DynamoDB 限制,而无需编写任何代码.(我对 SNS 知识的缺乏大概表现在这里)
I've setup an email topic, but this is not correct - I assume I need to create a function/controller which a topic can call. How would i set this up and if you have 2 Amazon VM's, would both get called or just one? Or is this the wrong route and there is a standard action one can take on events to increase DynamoDB limits without coding anything. (my lack of SNS knowledge is probably showing here)
推荐答案
在运行 Amazon 的创建表的向导时,它建议在 80% 阈值 处创建警报并将其链接到 SNS 话题.
When running Amazon's wizard to create a table, it suggests to create an alarm at 80% threshold and to link it to an SNS topic.
在引擎盖下,对于 1 的 R/W 容量,这会创建一个警报
Under the hood, for R/W capacity of 1, this creates an alarm on
- ConsumedReadCapacityUnits >= 240 持续 60 分钟
- ConsumedWriteCapacityUnits >= 240 持续 60 分钟
240 = 0.8*1*60*5
即capacity(1) * seconds_in_5_minutes(300) * threshold(0.8)
.60 分钟是闹钟时间.您可以缩短到 5 分钟,但这可能会增加误报的数量.
240 = 0.8*1*60*5
that is to say, capacity(1) * seconds_in_5_minutes(300) * threshold(0.8)
. 60 minutes is the alarm period. You can shorten down to 5 min but this might increase the number of false positive.
换句话说,每当 5 分钟范围内消耗的容量单位总和超过 24 阈值至少 1 小时时,就会触发警报.
In other words, the alarm is triggered every time the sum of the consumed capacity units on ranges of 5 min exceeds the 24 treshold for at least 1 hour.
注意:5分钟对应采样周期.
note: 5 min corresponds to the sampling period.
在SNS控制台,您可以向主题添加订阅者".它们可以是电子邮件、HTTP(S) 回调……这使您可以联系多个人/机器.
In the SNS console, you can add 'subscribers' to a topic. They can be e-mails, HTTP(S) callbacks, ... This allow you to contact multiple human/machines.
每次触发扩展逻辑时,您都需要使用 API 使用此公式自动更新警报.
Every time your scaling logic is triggered, you will need to use the API to automatically update the alarms using this formula.
这篇关于如何创建警报以检测 DynamoDb 限制已达到特定百分比,然后再增加它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!