Top Banner
中国站 LIVE
53

- 2019-aws-reinvent-recap.s3.cn ...

Feb 26, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

中国站 L I V E

Page 2: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon DynamoDB 新特性及深入探讨

AWS 高级解决方案架构师

章平

Page 3: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

议程

Amazon DynamoDB 介绍与应用场景

Amazon DynamoDB 的高性能

Amazon DynamoDB 的高可用性及可管理性

Page 4: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 5: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

NoSQL?

/ /

OLAP OLTP

SQL NoSQL

Page 6: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

Amazon DynamoDB

文档或宽列 可扩展至任何工作负载完全托管的 NoSQL

访问控制 事件驱动的编程快速且一致

Page 7: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

完全托管

AWS

Lambda

Amazon

DynamoDBAmazon API

网关

Amazon

DynamoDB

Streams

Lambda

Amazon

S3

Amazon

ES

Amazon

Athena

DynamoDB

查询端在线事务处理(OLTP)端

无服务器

Page 8: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

Mobvista汇量科技

2019年日均广告请求量600亿次,峰值1000亿次

Page 9: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

Cassandra

S3Memcached

ELB

Sync API

S3

DynamoDB

RDS

ELB

Sync API

RDS

Page 10: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

使用 DynamoDB 的收益

• 成功地通过三星云服务为三星 Galaxy 智能手机大规模工作负载提供支撑

• NoSQL 基础架构成本降低 40%

• PB 级规模的存储容量可按需扩展,无需事先规划

• 性能一致性更有保障,可实现稳定的千万级吞吐量

• 在 DynamoDB Auto Scaling 的帮助下,数百张表成功实现免管理

• 完全托管的服务,2 年运营期间无故障

• 数十亿项目从无数据错误或丢失

• 借助 VPC Endpoints for DynamoDB 获得了企业级安全性与合规性

Page 11: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 12: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

每秒数百万请求

上万亿项目

PB 级容量的存储

读写延迟低于 10

毫秒

Page 13: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

项目

Page 14: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

Page 15: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

Page 16: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

Page 17: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

00 55 A954 FFAA00 FF

DynamoDB

product_id = 100

Hash (100) = 7B

product_id = 200

Hash (200) = 48

product_id = 300

Hash (300) = CD

Key Space

Page 18: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

Page 19: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

分区 3

DynamoDB

00:0 FF:∞

Hash (2) = 48

product_id# = 100

serial_number# = 10001

product_id# = 100

serial_number# = 10002

product_id# = 200

serial_number# = 5495

product_id# = 200

serial_number# = 5496

Hash (1) = 7B

product_id# = 300

serial_number# = 6458

product_id# = 300

serial_number# = 6459

Hash (3) = CD

55 A9:∞54:∞ AA分区 1 分区 2

Page 20: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

(LSI)

A1

(分区)A3

(排序)A2

(项目键)

A1

(分区)A2

(排序)A3 A4 A5

LSI A1

(分区)A4

(排序)A2

(项目键)A3

(已投影)

KEYS_ONLY

INCLUDE A3

A1

(分区)A5

(排序)A2

(项目键)A3

(已投影)A4

(已投影)ALL

10 GB

LSI

Page 21: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

GSI

/

A1

(分区)A2 A3 A4 A5

GSI A5

(分区)A4

(排序)A1

(项目键)A3

(已投影)INCLUDE A3

A4

(分区)A5

(排序)A1

(项目键)A2

(已投影)A3

(已投影)ALL

A2

(分区)A1

(项目键)KEYS_ONLY

GSI RCU

WCR

Page 22: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

GSI

Primary

tablePrimary

tablePrimary

tablePrimary

table

GSI

Page 23: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

A_2

B_1

B_2

B_3

B_5

B_4

B_7

B_6

A_1

A_3

A_4A_7 B_8

A_6 A_8

A_5

Page 24: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

A_2

B_1

B_2

B_3

B_5

B_4

B_7

B_6

A_1

A_3

A_4A_7 B_8

UpdateItem: “CandidateA_” + rand(0, 10)

ADD 1 to Votes

A_6 A_8

A_5

Page 25: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

A_2

B_1

B_2

B_3

B_5

B_4

B_7

B_6

A_1

A_3

A_4

A_5

A_6 A_8

A_7 B_8A

2.5M

1.

2.

Page 26: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

最佳实践 1:慎重选择哈希键以实现无限扩展

避免“热键”

好的哈希键取值范围很大;不好的哈希键只能有有限的值选择能将负载均衡分布到不同分区的哈希键(访问模式)

Page 27: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

Page 28: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...
Page 29: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

消息表

消息应用

David

SELECT *

FROM Messages

WHERE Recipient='David'

LIMIT 50

ORDER BY Date DESC

Inbox

Page 30: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

Recipient Date Sender Message

David 2014-10-02 Bob …

… 48 more messages for David …

David 2014-10-03 Alice …

Alice 2014-09-28 Bob …

Alice 2014-10-01 Carol …

David

50 × 256KB

SELECT *

FROM Messages

WHERE Recipient='David'

LIMIT 50

ORDER BY Date DESC

Page 31: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

50

Page 32: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

Recipient Date Sender Subject MsgId

David 2014-10-02 Bob Hi!… afed

David 2014-10-03 Alice RE: The… 3kf8

Alice 2014-09-28 Bob FW: Ok… 9d2b

Alice 2014-10-01 Carol Hi!... ct7r

-GSI

MsgId Body

9d2b …

3kf8 …

ct7r …

afed …

David

1. -GSI 1 RCU

2. 256 RCU256KB

50 128

Page 33: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

Recipient Date Sender Subject MsgId

David 2014-10-

02

Bob Hi!… s3://post_msgs/id_100

David 2014-10-

03

Alice RE: The… s3://post_msgs/id_102

Alice 2014-09-

28

Bob FW: Ok… s3://post_msgs/id_1045

Alice 2014-10-

01

Carol Hi!... s3://post_msgs/id_102

Amazon S3

-GSI

David

1. -GSI 1 RCU

2. Amazon S3

S3

Page 34: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

3

1

2000 RCU

K

2000 RCU

M

2000 RCU

50

2000 RCU

A B

ProductCatalog

100,000𝑅𝐶𝑈50分区

≈ 𝟐𝟎𝟎𝟎 𝑅𝐶𝑈每分区

SELECT Id, Description, ...

FROM ProductCatalog

WHERE

Id="POPULAR_PRODUCT"

Page 35: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

1 2

ProductCatalog

DynamoDB

SELECT Id, Description, ...

FROM ProductCatalog

WHERE

Id="POPULAR_PRODUCT"

Page 36: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

4

Events_table_2015_April

Event_id

(哈希键)Timestamp

(范围键)属性 1 …. 属性 N

Events_table_2015_March

Event_id

(哈希键)Timestamp

(范围键)属性 1 …. 属性 N

Events_table_2015_Feburary

Event_id

(哈希键)Timestamp

(范围键)属性 1 …. 属性 N

Events_table_2015_January

Event_id

(哈希键)Timestamp

(范围键)属性 1 …. 属性 N

RCU = 1000

WCU = 100

RCU = 10000

WCU = 10000

RCU = 100

WCU = 1

RCU = 10

WCU = 1

; Amazon S3

Page 37: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

Page 38: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

PK SK Attibute2

Employee_Name Muphy, John 2008-11-08

YYYY-Q1 $5477 Muphy, John

HR_confidential 2008-11-08 Muphy, John

Warehouse_01 Muphy, John

SELECT * WHERE PK= Employee_NameAND SK=‘Muphy, John‘

SELECT * WHERE PK= Warehouse_01

SELECT * WHERE PK= HR_confidential ANDSK > 2008-11-01

Page 39: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

Page 40: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

Page 41: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

/

25%

1 2 3 4

Page 42: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB

——

API

Amazon DynamoDB Accelerator (DAX)

DAX

DynamoDB

Page 43: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 44: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

$$$ Savings

自动扩展策略

需要时扩大

不需要时收缩

可计划的自动扩展

完全托管自动扩展

Page 45: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

用于时间点恢复的持续备份

按需备份,满足数据长期归档与合规要求

不影响性能的前提下即时备份 PB 级数据

完全托管备份和还原

Page 46: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

完全托管全局表

构建高性能、全球分布的应用程序

本地可用的表大幅降低读写延迟

多区域冗余和弹性

易于配置,无需重写应用程序

Page 47: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

StreamReader

多区域复制Region

Region

Region

StreamReader

StreamReader

Page 48: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB 流

Page 49: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

DynamoDB 流和 AWS Lambda 结合构建触发器

AWS Lambda把数据变化通知出去Amazon Kinesis

Data FirehoseAmazon Simple

Notification Service

Amazon Elasticsearch

Service

Page 50: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

完全托管的服务器端加密,轻松配置表级别加密

通过安全的 Amazon VPC 端点访问 DynamoDB

安全加密

根据应用程序的需求,通过细化的访问控制允许或拒绝对项目和属性的访问

借助 AWS Identity and Access Management (IAM) 策略有序管理对表中所存储项目和属性的访问

Page 51: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

NoSQL Workbench

这是一个客户端的应用系统,能够帮助客户基于 DynamoDB 进行快速的数据建模

简化开发和测试

丰富的图形化功能,帮助用户对DynamoDB 进行可视化的数据建模以及相关的操作

可以在 Windows 和 macOS 上运行

Page 52: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

数据建模

从头开始构建新的数据模型,或者导入并修改已有的数据模

型。

可视化

使用图形界面直接添加数据,或者从MySQL 导入数据。或者创建服务器端的

资源。

执行数据操作

查询和探索数据集。使用图形化方式轻松的构建复杂的操作。生成立刻可用的代码样例,并支持多种编程语言。

功能模块

Page 53: <Presentation title here> - 2019-aws-reinvent-recap.s3.cn ...

Thank you!

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.