How to use Amazon DocumentDB

Amazon DocumentDB(与MongoDB兼容)是一种支持MongoDB工作负载的快速、可扩展、高可用和完全管理的文档数据库服务。在这次技术讨论中,我们将介绍Amazon DocumentDB及其独特的体系结构,使其易于在云中运行、管理和扩展MongoDB工作负载。Amazon DocumentDB是从一开始就设计的,它使用一个独特的、分布式的、容错的、自我修复的存储系统,可以自动扩展存储。此外,使用AmazonDocumentDB的体系结构,存储和计算是分离的,允许每个独立扩展。通过常见的用例,我们将讨论为什么这个架构可以帮助开发人员更快地满足他们的业务需求。我们还将讨论开发人员如何使用与当前相同的MongoDB应用程序代码、驱动程序和工具在Amazon DocumentDB上运行、管理和扩展工作负载,而无需担心管理底层基础设施。

展开查看详情

1.Introduction to Amazon DocumentDB (with MongoDB compatibility) Fast, scalable, and fully managed MongoDB-compatible database service Joseph Idziorek, AWS Principal Product Manager

2. Purpose built The right tool for the right job https://www.allthingsdistributed.com/2018/06/purpose-built-databases-in-aws.html

3. Data categories and common use cases Relational Key-value Document In-memory Graph Search Time-series Ledger Referential Low-latency, Indexing and Microseconds Creating and Indexing and Collect, store, Complete, integrity, ACID key lookups storing latency, key- navigating searching and process data immutable, and transactions, with high documents based queries, data relations semistructured sequenced by verifiable history schema- throughput and with support and specialized easily and quickly logs and data time of all changes to on-write fast ingestion for query on data structures application data of data any attribute Lift and shift, Real-time bidding, Content Leaderboards, Fraud detection, Product catalog, IoT applications, Systems EMR, CRM, shopping cart, management, real-time social networking, help and FAQs, event tracking of record, finance social personalization, analytics, caching recommendation full text supply chain, mobile engine health care, registrations, financial

4. AWS: Purpose-built databases Relational Key-value Document In-memory Graph Search Time-series Ledger Amazon RDS Amazon Amazon Amazon Amazon Amazon DynamoDB Amazon Amazon DocumentDB ElastiCache Neptune Elasticsearch Timestream Quantum Service Ledger Aurora Community Commercial New! Redis Memcached Database

5.Agenda What’s the plan? What is a document Introduce Amazon Challenges and Demos database? DocumentDB capabilities {} { “Hello”: “Amazon DocumentDB”, “Getting Started”: “https://aws.amazon.com/documentdb/getting-started/" }

6.What is a document database?

7. DynamoDB DocumentDB Redis Aurora QLDB SQL Server PostgreSQL Elasticsearch Timestream Oracle DB2 MySQL MongoDB Neptune Access Cassandra 1970 1980 1990 2000 2010

8.Evolution of document databases != JSON Relational JSON (Client) (App) (Database) JSON became the Friction when Object-relational Document de facto data converting JSON mappings (ORMs) databases solved interchange to the relational were created to help the problem format model with this friction

9.Document databases • Data is stored in JSON-like documents JSON documents are first-class objects { of the database • Documents map naturally to id: 1, how humans model data name: "sue", age: 26, email: "sue@example.com", • Flexible schema and indexing promotions: ["new user", "5%", "dog lover"], memberDate: 2018-2-22, shoppingCart: [ • Expressive query language {product:"abc", quantity:2, cost:19.99}, {product:"edf", quantity:3, cost: 2.99} built for documents (ad hoc ] } queries and aggregations)

10. Document databases help developers build applications faster and iterate quickly

11.Use cases for document data Content Mobile Personalization management Catalog Retail and User profiles marketing

12.Use cases for document data User profiles { { id: 181276, id: 181276, username: "sue1942", username: "sue1942", name: {first: "Susan", name: {first: "Susan", last: "Benoit"} last: "Benoit"}, "Benoit"} } } ExploidingSnails: { hi_score: 3185400, global_rank: 5139, bonus_levels: true }, } } promotions: ["new user","5%","snail lover"] }

13.Challenges of existing document databases Hard to Hard Hard to Hard to Hard to set up to manage scale secure back up

14.What is Amazon DocumentDB? Fast, scalable, and fully managed MongoDB-compatible database service

15.Amazon DocumentDB Fast, scalable, and fully managed MongoDB-compatible database service Fast Scalable Fully managed MongoDB compatible Millions of requests per Separation of compute and Managed by AWS: Compatible with MongoDB 3.6; second with millisecond storage enables both layers no hardware provisioning; use the same SDKs, tools, and latency; twice the throughput to scale independently; auto patching, quick setup, applications with Amazon of MongoDB scale out to 15 read replicas secure, and automatic DocumentDB in minutes backups

16.Challenges with traditional database architectures Application Single monolithic API architectures Query processor Not designed Caching for the cloud Logging Storage Scale monolithically Fail monolithically

17.Challenges with traditional databases: Scaling Scenario: Spike in traffic and you want to add additional read capacity quickly Replication Node 1 Node 2 Node 3 Node 4

18.Challenges with traditional databases: Scaling Scenario: Scale up to run large analytical workloads on a replica Replication Node 1 Node 2 Node 3 Node 4

19.Challenges with traditional databases: Recovery Scenario: An instance experiences a failure and you want to recover quickly Replication Node 1 Node 2 Node 3 Node 3’

20.Amazon DocumentDB: Modern cloud-native architecture What would you do to improve scalability and availability? 1 2 3 Decouple Distribute data in Increase the compute and smaller partitions replication of storage data (6x)

21.Amazon DocumentDB: Modern cloud-native architecture API Scale compute Compute layer Query processor Caching Logging 1 Decouple compute and storage Storage Scale storage Storage layer

22.Amazon DocumentDB: Modern cloud-native architecture Logging Storage 2 Distribute data in smaller partitions Distributed storage volume AZ1 AZ2 AZ3

23.Amazon DocumentDB: Modern cloud-native architecture Logging Storage Distributed storage volume AZ1 AZ2 AZ3 3 Increase the replication of data (6x)

24.Amazon DocumentDB: Modern cloud-native architecture AWS Region Availability Zone 1 Availability Zone 2 Availability Zone 3 Instance Instance Instance (primary) (replica) (replica) Reads Reads Writes Reads Wri te s Writes Distributed storage volume AZ1 AZ2 AZ3

25.Amazon DocumentDB: Scaling Scenario: A spike in traffic and you want to add additional read capacity quickly Distributed storage volume AZ1 AZ2 AZ3

26.Amazon DocumentDB: Failure recovery Scenario: An instance experienced a failure and you want to recover quickly Distributed storage volume AZ1 AZ2 AZ3

27.Amazon DocumentDB: Failure recovery Scenario: Six-way replication across three Availability Zones provides the ability to handle AZ + 1 failures Distributed storage volume AZ1 AZ2 AZ3

28.Demo: Getting started with Amazon DocumentDB

29.Fast Fast, scalable, and fully managed MongoDB-compatible database service Fast More throughput Optimizations Flexible Millions of requests Separation of storage and Database engine Scale up an instance in per second with compute layers offloads optimizations to reduce minutes for analytical millisecond latency replication to the storage the number of IOs and queries and scale down at volume so that your instances the end of the day minimize network packets can do more work; twice the throughput of MongoDB in order to offload the database engine