EmptyStack
EmptyStack

Reputation: 51374

Amazon DynamoDB ProvisionedThroughputExceededException (iOS SDK)

I am using DynamoDB. I do scan operations from the app. Everything works perfect. After sometime, the response is coming as nil. But I am not receiving any exceptions. I enabled verbose logging using,

[AmazonLogger verboseLogging];

If the verbose logging is enabled, I can see some logs like,

"__type":"com.amazonaws.dynamodb.v20111205#ProvisionedThroughputExceededException","message":"The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API"

My code looks like this,

@try {
    DynamoDBScanRequest *request = /* Create request */;
    DynamoDBScanResponse *response = [[AmazonClientManager ddb] scan:request];
    /* 
     * response is nil if the provisioning throughput is exceeded 
     * and the all retries are over
     */
    ALog(@"Response: %@", response); 
    NSMutableArray *array = response.items;
    return array;
} @catch (NSException *exception) {
    /* 
     * I am expecting the  ProvisionedThroughputExceededException 
     * to be thrown here. But its not throwing here. Instead I get the response
     * as nil above.
     */
    ALog(@"Exception: %@", exception);
    return nil;
}

Am I doing it correct? Could someone help me please?

Thanks.

Edit: Could anyone give me a rough idea of how much throughput (both read/write) capacity to set for a QuestionAnswer table, with almost 10 fields like TopicID, QuestionID, Question, Answer, AskedAt, RepliedAt, QuestionType etc.,? Thanks.

Upvotes: 1

Views: 3179

Answers (1)

Yosuke
Yosuke

Reputation: 3759

I've tried a scan request with more read capacity units than provisioned, and I got AmazonClientException with a generic message: "Unknown error occurred." We are working on a fix, and the next version should correctly return DynamoDBProvisionedThroughputExceededException in the described situation.

You said the response becomes nil, but I was not able to reproduce the issue. Do you call [AmazonErrorHandler shouldNotThrowExceptions] to turn off the exceptions? When this option is turned on, the SDK won't throw AmazonClientException and AmazonServiceException. It is also possible that you are using an older version of the SDK. Please try 1.4.4 and see if you get the exception. It is suboptimal, but at least you should be able to catch an exception when something goes wrong.

Upvotes: 4

Related Questions