Skip to content

DynamoDB and Throttling #402

@carlnordenfelt

Description

@carlnordenfelt

Hi,

This isn't so much an issue as a question regarding the implementation.
I wonder if and how exponential back offs are implemented in the sdk.

If I create a new dynamo object i see that maxRetries is undefined but I'm not sure exactly what that implies.
var AWS = require('aws'-sdk');
var dynamo = new AWS:DynamoDB();
console.log(dynamo);

When we get throttled on occasion I see that it takes a lot longer for our callback to be called, sometime up to 25 seconds. I haven't had the possibility to debug this so I'm not sure exactly what is happening which is why I am curious as to if and how the maxRetries is used, especially if it is not explicitly passed when creating the dynamo object.

I'm guessing that this might have something to do with this.
From: https://github.com/aws/aws-sdk-js/blob/master/lib/services/dynamodb.js

/**
    * @api private
*/
defaultRetryCount: 10,
/**
    * @api private
*/
retryDelays: function retryDelays() {
    var retryCount = this.numRetries();
    var delays = [];
    for (var i = 0; i < retryCount; ++i) {
        if (i === 0) {
            delays.push(0);
        } else {
            delays.push(50 * Math.pow(2, i - 1));
        }
    }
    return delays;
}

For arguments sake I will assume that the default retires are in fact 10 and that this is the logic that is applied for the exponential back off and have a follow up question on this:
Is there any way to control the number of retires for a specific call. I.e. I have my dynamo object with the default settings and I call putItem once and for that specific call I'd like to have a different maxRetries (in my case 0) but still use the same object. I suspect this is not feasible?

Looking forward to your response and some additional insight on this fine module :)

Br,
Carl

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions