While doing a tutorial, i bulk loaded data to my dynamoDB JobsApplication
table with around 400 random jobs posts.
Using Node.js
and aws-sdk
i performed a scan operation.
var AWS = require('aws-sdk');
AWS.config.update({
region: 'us-east-1'
});
var print = require('./../lib/helpers').printPretty;
var dynamodb = new AWS.DynamoDB();
var epochNow = 1506043477;
var params = {
"TableName": "GMJS.Job",
"FilterExpression": "CountryId = :country AND ClosingTime > :time",
"ExpressionAttributeValues": {
":country": {
"S": "18"
},
":time": {
"N": epochNow.toString()
}
},
"ReturnConsumedCapacity": "TOTAL"
};
dynamodb.scan(params).promise()
.then(print)
.catch(print);
My table currently has 5 RCUs and WCUs assigned to it. The scan operation gave a result in less than 2 seconds and apart from results showed this info:
"Count": 7,
"ScannedCount": 100,
"ConsumedCapacity": {
"TableName": "GMJS.Job",
"CapacityUnits": 89.5
}
}
Size of data: 50.8 KB
I have turned off auto scaling. So how did it consumed 89.5 RCUs
in 2 seconds when i had only allotted 5 RCUs
to the table? If it had to consume 89.5 RCUs
it could have used 5 RCUs
per second for 17.9 seconds and then returned the result or it could have said the table requires more RCUs
for such an expensive scanning operation etc.
So how did it used 89.5 RCUs
to scan when i only allotted 5 RCUs
is my main question.
DynamoDB has a certain amount of burst capability that can be put to use when needed:
DynamoDB provides some flexibility in the per-partition throughput provisioning. When you are not fully utilizing a partition's throughput, DynamoDB retains a portion of your unused capacity for later bursts of throughput usage. DynamoDB currently retains up to five minutes (300 seconds) of unused read and write capacity. During an occasional burst of read or write activity, these extra capacity units can be consumed very quickly—even faster than the per-second provisioned throughput capacity that you've defined for your table. However, do not design your application so that it depends on burst capacity being available at all times: DynamoDB can and does use burst capacity for background maintenance and other tasks without prior notice.
Note
In the future, these details of burst capacity may change.