问题
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.
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.
Problems:
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.
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)
回答1:
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.
Under the hood, for R/W capacity of 1, this creates an alarm on
- ConsumedReadCapacityUnits >= 240 for 60 minutes
- ConsumedWriteCapacityUnits >= 240 for 60 minutes
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.
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.
note: 5 min corresponds to the sampling period.
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.
Every time your scaling logic is triggered, you will need to use the API to automatically update the alarms using this formula.
来源:https://stackoverflow.com/questions/12508594/how-do-i-create-an-alarm-to-detect-dynamodb-limits-have-reached-a-certain-percen