Created
June 25, 2013 08:36
-
-
Save toritori0318/5856934 to your computer and use it in GitHub Desktop.
dynode vs node-aws-sdk-dynamodb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var access_key = ''; | |
var secret_key = ''; | |
var region = 'ap-northeast-1'; | |
var dynode = require('dynode'); | |
dynode.auth({ | |
accessKeyId: access_key | |
,secretAccessKey: secret_key | |
,region: region | |
}); | |
var table = 'hoge'; | |
var table_key_value = 'xxxxxxx'; | |
var start = new Date().getTime(); | |
// benchmark | |
var count=0 | |
var max=3000 | |
for (var i=0;i<max;i++) { | |
dynode.getItem(table, table_key_value, function (err, res) { | |
count++ | |
if(max<=count) { | |
var end = new Date().getTime(); | |
console.log('count-dynode is ' + count); | |
console.log('total time:' + ((end - start) / 1000)) + " sec"; | |
} | |
if(err) return console.log(err); | |
}); | |
} | |
//////////////////////////////////////////////////////////////////// | |
// toritori0318-MBA-2:dynamodb:% node bench_dynode.js | |
// count-dynode is 3000 | |
// total time:4.147 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var access_key = ''; | |
var secret_key = ''; | |
var region = 'ap-northeast-1'; | |
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: access_key | |
,secretAccessKey: secret_key | |
,region: region | |
}); | |
var aws_dy = new AWS.DynamoDB(); | |
var table = 'hoge'; | |
var table_key_value = 'xxxxxx'; | |
var start = new Date().getTime(); | |
// benchmark | |
var count=0 | |
var max=3000 | |
for (var i=0;i<max;i++) { | |
aws_dy.getItem({TableName: table, Key: {id: {S: table_key_value}}}, function (err, res) { | |
count++ | |
if(max<=count) { | |
var end = new Date().getTime(); | |
console.log('count-sdk is ' + count); | |
console.log('total time:' + ((end - start) / 1000)) + " sec"; | |
} | |
if(err) return console.log(err); | |
}); | |
} | |
//////////////////////////////////////////////////////////////////// | |
// toritori0318-MBA-2:dynamodb:% node bench_node_aws_sdk.js | |
// count-sdk is 3000 | |
// total time:5.206 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment