-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
New option to use strongly consistent reads
lib/dynamo-backup.js
Outdated
ddb.describeTable({ TableName: tableName }, function (err, data) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
var descTime = new Date().getTime() - startDescTime - 0.3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 0.3
?
There was a problem hiding this comment.
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)
lib/dynamo-backup.js
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4096
and 1048576
could be stored in constants to be more explicit
lib/dynamo-backup.js
Outdated
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 |
There was a problem hiding this comment.
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
lib/dynamo-backup.js
Outdated
return; | ||
} | ||
|
||
var estimatedFetchRatio = speed / 16384 ; // estimation ratio: if >1: faster, <1: slower. (16KB = highWaterMark of stream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constant too
lib/dynamo-backup.js
Outdated
|
||
var ddb = new AWS.DynamoDB(); | ||
ddb.updateTable(params, function(err, data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=>
`ddb.updateTable(params, callback);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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