Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create an Alarm to detect DynamoDb limits have reached a certain percent and then increase it

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)

like image 309
Bruce Lowe Avatar asked Sep 20 '12 08:09

Bruce Lowe


People also ask

Which monitoring tool would you use to set up an alert for a broken read capacity threshold within an Amazon DynamoDB table?

You can create a CloudWatch alarm that sends an Amazon SNS message when the alarm changes state.

Which feature in DynamoDB enables you to trigger alerts when a statistic reaches a preset threshold?

In DynamoDB, which of the following allows you to set alarms when you reach a specified threshold for a metric? CloudWatch allows you to set alarms when you reach a specified threshold for a metric.

Can you configure the alarm to monitor more than 1 metric?

You can create multiple metric alarms, and also create a composite alarm and set up alerts only for the composite alarm. For example, a composite might go into ALARM state only when all of the underlying metric alarms are in ALARM state.

How do you set up an alarm on AWS?

Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Instances. Select the instance and choose Actions, Monitor and troubleshoot, Manage CloudWatch alarms. On the Manage CloudWatch alarms detail page, under Add or edit alarm, select Create an alarm.


1 Answers

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.

like image 165
yadutaf Avatar answered Jan 01 '23 11:01

yadutaf