Database Reference
In-Depth Information
Getting consumed capacity information
There are options available to get information about the consumed capacity units for each
DynamoDB call. These options would help you monitor the throughput you are consuming
for each request. By getting this information, we can see which operation is consuming
more read and write units, and then we can tune it to use minimal resources.
We can also use this information to measure the throughput for a certain number of re-
quests. This would help us manage our resources in a better way. Let's go through the syn-
tax to get the read and write capacity units.
Android
Here is a code snippet to get the consumed capacity units for DynamoDB calls:
// Set the type of capacity units you need to get info
about. Here we want both //read and write so setting it to
be TOTAL
putItemRequest.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
// Invoke the request
PuttItemResult result = ddbClient.putItem(putItemRequest);
// Log our consumed capacity
Log.i(LOG_TAG, "Consumed write capacity for putItem: = " +
result.getConsumedCapacity().getCapacityUnits().intValue());
iOS
Here is a code snippet to get the consumed capacity units for DynamoDB calls:
// Set the type of capacity units you need to get info
about. Here we want both //read and write so setting it to
be TOTAL
putItemRequest.returnConsumedCapacity = @"TOTAL";
// Invoke the request
DynamoDBPutItemResponse *putItemResponse = [self.ddb
Search WWH ::




Custom Search