YCSB から DynamoDB に結果整合性と強い整合性で負荷をかけてみて、レイテンシを計測してみた。
- DynamoDB のテーブルを作成する
- テーブル名: usertable
- パーティションキー: firstname (String)
- キャパシティモード: Provisioned (RCU: 10,000、WCU: 10,000、AutoScaling なし)
- ~/YCSB/dynamodb/conf/dynamodb.properties
- 結果整合性では dynamodb.consistentReads を false、強力な整合性では dynamodb.consistentReads を true にして実行。
dynamodb.awsCredentialsFile = dynamodb/conf/AWSCredentials.properties dynamodb.primaryKey = firstname dynamodb.endpoint = http://dynamodb.ap-northeast-1.amazonaws.com #dynamodb.consistentReads = false dynamodb.consistentReads = true
- ~/YCSB/dynamodb/conf/AWSCredentials.properties
- IAM ユーザーとクレデンシャルを作成して、指定する。
accessKey = … secretKey = …
- ~/YCSB/workloads/workloada_ddb
recordcount=100000 operationcount=100000 workload=com.yahoo.ycsb.workloads.CoreWorkload readallfields=true readproportion=0.5 updateproportion=0.5 scanproportion=0 insertproportion=0 requestdistribution=zipfian
- データをロードする
$ ./bin/ycsb load dynamodb -P workloads/workloada_ddb_ec -P dynamodb/conf/dynamodb.properties DBWrapper: report latency for each error is false and specific error codes to track for latency are: [] [OVERALL], RunTime(ms), 601226 [OVERALL], Throughput(ops/sec), 166.32680556063775 [TOTAL_GCS_PS_Scavenge], Count, 389 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 537 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.08931749458606247 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 389 [TOTAL_GC_TIME], Time(ms), 537 [TOTAL_GC_TIME_%], Time(%), 0.08931749458606247 [CLEANUP], Operations, 1 [CLEANUP], AverageLatency(us), 10.0 [CLEANUP], MinLatency(us), 10 [CLEANUP], MaxLatency(us), 10 [CLEANUP], 95thPercentileLatency(us), 10 [CLEANUP], 99thPercentileLatency(us), 10 [INSERT], Operations, 100000 [INSERT], AverageLatency(us), 5998.10206 [INSERT], MinLatency(us), 3844 [INSERT], MaxLatency(us), 206591 [INSERT], 95thPercentileLatency(us), 7131 [INSERT], 99thPercentileLatency(us), 9559 [INSERT], Return=OK, 100000
- 10万件登録されたことを確認する
計測
- 結果整合性
- YCSB/dynamodb/conf/dynamodb.properties の dynamodb.consistentReads = false
$ ./bin/ycsb run dynamodb -P workloads/workloada_ddb -P dynamodb/conf/dynamodb.properties -threads 8 # 1回目 [OVERALL], RunTime(ms), 62444 [OVERALL], Throughput(ops/sec), 1601.434885657549 [TOTAL_GCS_PS_Scavenge], Count, 52 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 173 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.27704823521875604 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 52 [TOTAL_GC_TIME], Time(ms), 173 [TOTAL_GC_TIME_%], Time(%), 0.27704823521875604 [READ], Operations, 49944 [READ], AverageLatency(us), 3399.92071119654 ★ [READ], MinLatency(us), 2700 ★ [READ], MaxLatency(us), 287487 ★ [READ], 95thPercentileLatency(us), 4171 ★ [READ], 99thPercentileLatency(us), 7291 ★ [READ], Return=OK, 49944 [CLEANUP], Operations, 8 [CLEANUP], AverageLatency(us), 3.0 [CLEANUP], MinLatency(us), 1 [CLEANUP], MaxLatency(us), 14 [CLEANUP], 95thPercentileLatency(us), 14 [CLEANUP], 99thPercentileLatency(us), 14 [UPDATE], Operations, 50056 [UPDATE], AverageLatency(us), 6335.767939907304 [UPDATE], MinLatency(us), 3958 [UPDATE], MaxLatency(us), 287487 [UPDATE], 95thPercentileLatency(us), 7615 [UPDATE], 99thPercentileLatenc #2回目 [OVERALL], RunTime(ms), 63733 [OVERALL], Throughput(ops/sec), 1569.0458632105817 [TOTAL_GCS_PS_Scavenge], Count, 48 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 172 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.26987588847222005 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 48 [TOTAL_GC_TIME], Time(ms), 172 [TOTAL_GC_TIME_%], Time(%), 0.26987588847222005 [READ], Operations, 49997 [READ], AverageLatency(us), 3515.5819749184952 ★ [READ], MinLatency(us), 2744 ★ [READ], MaxLatency(us), 286975 ★ [READ], 95thPercentileLatency(us), 4319 ★ [READ], 99thPercentileLatency(us), 7011 ★ [READ], Return=OK, 49997 [CLEANUP], Operations, 8 [CLEANUP], AverageLatency(us), 2.25 [CLEANUP], MinLatency(us), 1 [CLEANUP], MaxLatency(us), 8 [CLEANUP], 95thPercentileLatency(us), 8 [CLEANUP], 99thPercentileLatency(us), 8 [UPDATE], Operations, 50003 [UPDATE], AverageLatency(us), 6475.620122792632 [UPDATE], MinLatency(us), 3934 [UPDATE], MaxLatency(us), 283391 [UPDATE], 95thPercentileLatency(us), 7843 [UPDATE], 99thPercentileLatency(us), 11695 [UPDATE], Return=OK, 50003 #3回目 [OVERALL], RunTime(ms), 78917 [OVERALL], Throughput(ops/sec), 1267.154098609932 [TOTAL_GCS_PS_Scavenge], Count, 50 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 182 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.2306220459470076 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 50 [TOTAL_GC_TIME], Time(ms), 182 [TOTAL_GC_TIME_%], Time(%), 0.2306220459470076 [READ], Operations, 50050 [READ], AverageLatency(us), 3898.9315484515487 ★ [READ], MinLatency(us), 2494 ★ [READ], MaxLatency(us), 304127 ★ [READ], 95thPercentileLatency(us), 6143 ★ [READ], 99thPercentileLatency(us), 10727 ★ [READ], Return=OK, 50050 [CLEANUP], Operations, 8 [CLEANUP], AverageLatency(us), 4.25 [CLEANUP], MinLatency(us), 1 [CLEANUP], MaxLatency(us), 14 [CLEANUP], 95thPercentileLatency(us), 14 [CLEANUP], 99thPercentileLatency(us), 14 [UPDATE], Operations, 49950 [UPDATE], AverageLatency(us), 7250.0672072072075 [UPDATE], MinLatency(us), 3994 [UPDATE], MaxLatency(us), 298239 [UPDATE], 95thPercentileLatency(us), 10183 [UPDATE], 99thPercentileLatency(us), 16495 [UPDATE], Return=OK, 49950
- 強力な整合性
- YCSB/dynamodb/conf/dynamodb.properties の dynamodb.consistentReads = true
$ ./bin/ycsb run dynamodb -P workloads/workloada_ddb -P dynamodb/conf/dynamodb.properties -threads 8 #1回目 [OVERALL], RunTime(ms), 65499 [OVERALL], Throughput(ops/sec), 1526.7408662727676 [TOTAL_GCS_PS_Scavenge], Count, 52 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 181 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.27634009679537097 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 52 [TOTAL_GC_TIME], Time(ms), 181 [TOTAL_GC_TIME_%], Time(%), 0.27634009679537097 [READ], Operations, 49943 [READ], AverageLatency(us), 4211.415593776906 ★ [READ], MinLatency(us), 2554 ★ [READ], MaxLatency(us), 293887 ★ [READ], 95thPercentileLatency(us), 5071 ★ [READ], 99thPercentileLatency(us), 9127 ★ [READ], Return=OK, 49943 [CLEANUP], Operations, 8 [CLEANUP], AverageLatency(us), 3.125 [CLEANUP], MinLatency(us), 1 [CLEANUP], MaxLatency(us), 10 [CLEANUP], 95thPercentileLatency(us), 10 [CLEANUP], 99thPercentileLatency(us), 10 [UPDATE], Operations, 50057 [UPDATE], AverageLatency(us), 6038.907565375472 [UPDATE], MinLatency(us), 3826 [UPDATE], MaxLatency(us), 275199 [UPDATE], 95thPercentileLatency(us), 7211 [UPDATE], 99thPercentileLaten #2回目 [OVERALL], RunTime(ms), 68986 [OVERALL], Throughput(ops/sec), 1449.569477865074 [TOTAL_GCS_PS_Scavenge], Count, 48 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 180 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.2609225060157133 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 48 [TOTAL_GC_TIME], Time(ms), 180 [TOTAL_GC_TIME_%], Time(%), 0.2609225060157133 [READ], Operations, 49994 ★ [READ], AverageLatency(us), 4463.141556986839 ★ [READ], MinLatency(us), 2766 ★ [READ], MaxLatency(us), 282367 ★ [READ], 95thPercentileLatency(us), 5411 ★ [READ], 99thPercentileLatency(us), 9007 ★ [READ], Return=OK, 49994 [CLEANUP], Operations, 8 [CLEANUP], AverageLatency(us), 2.5 [CLEANUP], MinLatency(us), 1 [CLEANUP], MaxLatency(us), 9 [CLEANUP], 95thPercentileLatency(us), 9 [CLEANUP], 99thPercentileLatency(us), 9 [UPDATE], Operations, 50006 [UPDATE], AverageLatency(us), 6366.18607767068 [UPDATE], MinLatency(us), 4030 [UPDATE], MaxLatency(us), 282367 [UPDATE], 95thPercentileLatency(us), 7647 [UPDATE], 99thPercentileLatency(us), 11431 [UPDATE], Return=OK, 50006 #3回目 [OVERALL], RunTime(ms), 82930 [OVERALL], Throughput(ops/sec), 1205.8362474375979 [TOTAL_GCS_PS_Scavenge], Count, 49 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 187 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.22549137827083082 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 49 [TOTAL_GC_TIME], Time(ms), 187 [TOTAL_GC_TIME_%], Time(%), 0.22549137827083082 [READ], Operations, 50091 ★ [READ], AverageLatency(us), 5216.173084985327 ★ [READ], MinLatency(us), 2618 ★ [READ], MaxLatency(us), 286719 ★ [READ], 95thPercentileLatency(us), 7939 ★ [READ], 99thPercentileLatency(us), 13847 ★ [READ], Return=OK, 50091 [CLEANUP], Operations, 8 [CLEANUP], AverageLatency(us), 3.75 [CLEANUP], MinLatency(us), 2 [CLEANUP], MaxLatency(us), 9 [CLEANUP], 95thPercentileLatency(us), 9 [CLEANUP], 99thPercentileLatency(us), 9 [UPDATE], Operations, 49909 [UPDATE], AverageLatency(us), 7529.237011360677 [UPDATE], MinLatency(us), 4128 [UPDATE], MaxLatency(us), 284415 [UPDATE], 95thPercentileLatency(us), 10767 [UPDATE], 99thPercentileLatency(us), 17407 [UPDATE], Return=OK, 49909
CloudWatch メトリクス
- DynamoDB
- EC2