Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust read capacity by wanted time #2

Merged
merged 4 commits into from
Dec 4, 2017

Conversation

oh14
Copy link

@oh14 oh14 commented Dec 1, 2017

Fix SSE option: add variable to use AES256 or aws:kms
Apply fix from markitx#63
New option to create backup in specified during time.
New option to use strongly consistent reads

ddb.describeTable({ TableName: tableName }, function (err, data) {
if (err) {
return callback(err);
}
var descTime = new Date().getTime() - startDescTime - 0.3;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 0.3?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time is in milliseconds, 0.3ms is the during time to parse response result (average)

this.consistentRead = !!options.consistentRead; // strongly consistent
this.consistentRatio = this.consistentRead ? 1 : 0.5; // eventually consistent consumes 1/2 of a read capacity unit.
this.singleCapacitySize = 4096 / this.consistentRatio; // 4KB for consistent, 8KB for eventually consistent
this.maxSingleScanReadCapacity = 1048576 / this.singleCapacitySize; // 1MB per scan page

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4096 and 1048576could be stored in constants to be more explicit

var averageItemSize = Math.ceil(Table.TableSizeBytes / Table.ItemCount);

var minimumNbScans = Math.ceil(Table.TableSizeBytes / 1048576); // 1 scan can't return more than 1MB of data
var estimatedWriteTime = minimumNbScans * 0.035 * self.tablesToBackup.length; // ~35ms for 1MB response (estimation) with tables concurrency

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1048576 and 0.035 in constants

return;
}

var estimatedFetchRatio = speed / 16384 ; // estimation ratio: if >1: faster, <1: slower. (16KB = highWaterMark of stream)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constant too


var ddb = new AWS.DynamoDB();
ddb.updateTable(params, function(err, data) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=>
`ddb.updateTable(params, callback);

Copy link

@ChristopheBougere ChristopheBougere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@oh14 oh14 merged commit b01e466 into master Dec 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants