dt3999 2019-04-08 20:22
浏览 98

Aurora与DynamoDB延迟不符合预期

I wanted to get some numbers to prove my reading that DynamoDB Key-Value storage has better read performance compare to relational DB (MySQL, PostgreSQL, Aurora). So I decided to compare READ Latencies of DynamoDB & AWS-Aurora (which is a/c to AWS website - "up to five times faster than standard MySQL databases and three times faster than standard PostgreSQL databases")

Step1: Created a Table in Aurora with the following Schema and added 1.02 million records to that table.

Table gift_log (
  gift_uuid               BINARY(16) NOT NULL,
  user_uuid               BINARY(16) NOT NULL,
  parent_uuid             BINARY(16),
  operation_time          TIMESTAMP,
  operation               VARCHAR(20) NOT NULL,
  gift_type               VARCHAR(20) NOT NULL,
  parent_type             VARCHAR(20),
  relation_type           VARCHAR(20),
  PRIMARY KEY (gift_uuid)
);

Used Golang Client that uses MySQL driver for database/sql package to query table.

Step2; Created DynamoDB table with following Attributes. Added 1 million Items to the table. DID NOT use any sort key. All queries used Partition key.


Table: GiftLog {
    gift_uuid               Binary (Partition Key)
    user_uuid               Binary
    operation_time          Number,
    operation               String,
    gift_type               String,
    parent_type             String
}

Used Golang Client that uses AWS Go-SDK to query DynamoDB table.

AURORA

startTime := time.Now().UnixNano()

rows, err := db.Query("SELECT * FROM gift_log WHERE gift_uuid=?", giftIDsToRead[i])

endTimt := time.Now().UnixNano()

DynamoDB

queryInput := &dynamodb.QueryInput{
        TableName: aws.String(tableName),
        KeyConditions: map[string]*dynamodb.Condition{
                        "GiftUUID": {
                            ComparisonOperator: aws.String("EQ"),
                            AttributeValueList: []*dynamodb.AttributeValue{
                                {
                                    B: giftIDsToRead[i],
                                },
                            },
                        },
        },
}

startTime := time.Now().UnixNano()

resp, err := svc.Query(queryInput)

endTime := time.Now().UnixNano()

Aurora Latency: 543.89 DynamoDB Latency: 2934.96 usec

These numbers don't seem right. Am I not comparing apples to apples?

  • 写回答

2条回答 默认 最新

  • duanliang2017 2019-04-08 21:06
    关注

    You don't show the timing results... but I'd say you're comparing apples to oranges. If you know the primary key of a DynamoDB item, you should be using GetItem() not Query().

    Using GetItem(), you should have "single-digit millisecond" response times; excluding the network / HTTP latency

    That last bit is important, but should hopefully be similar for the requests to Aurora.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?