SlideShare a Scribd company logo
 No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv 2019
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
No Hassle, NoSQL
DynamoDB, DocumentDB
Leonid Koren
Solutions Architect
AWS
D A T 3 0 4
Ziv Shenhav
Technical Account Manager
AWS
Inbar Yogev
Data Engineering Lead
Riskified
Drorit Baron
Software Developer
Riskified
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
• NoSQL Databases
• DynamoDB
• Managing Table Capacity (under the hood)
• Features for Developers
• Customer Story
• DocumentDB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Optimized for storage Optimized for compute
Normalized/relational Denormalized/hierarchical
Ad hoc queries Instantiated views
Scale vertically Scale horizontally
Good for OLAP, Limited Scale OLTP Built for OLTP at scale
SQL NoSQL
Why NoSQL?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Operating Self-Managed NoSQL Is Challenging
It’s too much work
It costs too much
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon DynamoDB
Fast and flexible key value database service for any scale
Comprehensive
security
Encrypts all data by
default and fully integrates
with AWS Identity and
Access Management for
robust security
Performance at scale
Consistent, single-digit
millisecond response times at
any scale; build applications with
virtually unlimited throughput
Global database for
global users and apps
Build global applications with
fast access to local data by easily
replicating tables across multiple
AWS Regions
Serverless
No server provisioning,
software patching, or
upgrades; scales up or down
automatically; continuously
backs up your data
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Table, Item, Attribute, Index
Table
Items
Attributes
Partition
Key
Sort
Key
Customer ID
(Partition Key)
Order Date
(Sort Key)
Store Order Sum Country
Local Secondary Index
Example Table
Customer ID
(Partition Key)
Order Sum
(Sort Key)
Order Date
Country
(Partition Key)
Order Sum Store Order DateGlobal Secondary Index
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
00 55 A954 FFAA00 FF
Partition Keys
Partition Key uniquely identifies an item
Partition Key is used for building an unordered hash index
Allows table to be partitioned for scale
Id = 1
Name = Jim
Hash (1) = 7B
Id = 2
Name = Andy
Dept = Eng
Hash (2) = 48
Id = 3
Name = Kim
Dept = Ops
Hash (3) = CD
Key Space
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Partitions are replicated across three AZs
Id = 2
Name = Andy
Dept = Engg
Id = 3
Name = Kim
Dept = Ops
Id = 1
Name = Jim
Id = 2
Name = Andy
Dept = Engg
Id = 3
Name = Kim
Dept = Ops
Id = 1
Name = Jim
Id = 2
Name = Andy
Dept = Engg
Id = 3
Name = Kim
Dept = Ops
Id = 1
Name = Jim
Replica 1
Replica 2
Replica 3
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Provisioning Table Capacity
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Provisioning Table Capacity
1 RCU = Items up to 4KB
1 WCU = Items up to 1KB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Provisioning Trade-off
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Provisioning Example
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
0x12A8 236294 { name:“Sara”, city:”Tampa”, …}
0x3391 445104 { name:“James”, city:”Miami”, …}
0x6134 333363 { name:“Betty”, city:”Madison”, …}
0x9531 145783 { name:“Bob”, city:”London”, …}
0xB082 643145 { name:“Val”, city:”Seattle”, …}
0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …}
0xF355 523422 { name:“Alex”, city:”London”, …}
Provisioning
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Token Bucket Algorithm
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Burst Capacity
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Unbalanced Load
0x12A8 236294 { name:“Sara”, city:”Tampa”, …}
0x3391 445104 { name:“James”, city:”Miami”, …}
0x6134 333363 { name:“Betty”, city:”Madison”, …}
0x9531 145783 { name:“Bob”, city:”London”, …}
0xB082 643145 { name:“Val”, city:”Seattle”, …}
0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …}
0xF355 523422 { name:“Alex”, city:”London”, …}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Unbalanced Load
0x12A8 236294 { name:“Sara”, city:”Tampa”, …}
0x3391 445104 { name:“James”, city:”Miami”, …}
0x6134 333363 { name:“Betty”, city:”Madison”, …}
0x9531 145783 { name:“Bob”, city:”London”, …}
0xB082 643145 { name:“Val”, city:”Seattle”, …}
0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …}
0xF355 523422 { name:“Alex”, city:”London”, …}
50 throttles
per second
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Adaptive Capacity
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Adaptive Capacity
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Adaptive Capacity Active
0x12A8 236294 { name:“Sara”, city:”Tampa”, …}
0x3391 445104 { name:“James”, city:”Miami”, …}
0x6134 333363 { name:“Betty”, city:”Madison”, …}
0x9531 145783 { name:“Bob”, city:”London”, …}
0xB082 643145 { name:“Val”, city:”Seattle”, …}
0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …}
0xF355 523422 { name:“Alex”, city:”London”, …}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Total Demand Change
0x12A8 236294 { name:“Sara”, city:”Tampa”, …}
0x3391 445104 { name:“James”, city:”Miami”, …}
0x6134 333363 { name:“Betty”, city:”Madison”, …}
0x9531 145783 { name:“Bob”, city:”London”, …}
0xB082 643145 { name:“Val”, city:”Seattle”, …}
0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …}
0xF355 523422 { name:“Alex”, city:”London”, …}
à
à
à
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Auto Scaling
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Actual Auto-scaled Table
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Auto Scaling – Creating A New Table
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Provisioning Recap
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DynamoDB On-Demand
Features
• No capacity planning, provisioning, or
reservations - simply make API calls
• Pay only for the reads and writes you perform
Key benefits
• Eliminates tradeoffs of over- or under-
provisioning
• Instantly accommodates your workload as traffic
ramps up or down
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DynamoDB On-Demand
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DynamoDB On-Demand
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DynamoDB: Capacity managed for you
Govern max consumption
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DynamoDB transactions
Simplify your code by executing multiple, all-or-nothing
actions within and across tables with a single API call
Single
API
Call
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Global Tables
Build high-performance, globally
distributed applications.
Low latency reads and writes
to locally available tables.
Multi-region redundancy
and resiliency.
Easy to set up, and no application
re-writes required.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DynamoDB Streams
• DynamoDB Streams captures a time-ordered sequence of item-
level modifications (stored up to 24 hours) in a DynamoDB table
• Process multiple modifications at a time with Lambda
Amazon
DynamoDB
DynamoDB
Stream
AWS Lambda
function
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Time-To-Live (TTL)
TTL job
CustomerActiveOrder
OrderId: 1
CustomerId: 1
Removes data that is no longer relevant
MyTTL: 1492641900
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Point in time restore
for short-term
retention and data
corruption protection
Backup hundreds of
TB instantly with NO
performance impact
On-demand
backups for long-
term data archival
and compliance
Backup and Restore
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Riskified DynamoDB
talk for AWS summit
Inbar Yogev
Data Engineering Lead
Riskified
Drorit Baron
Software Developer
Riskified
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Meet Riskified
We’re an AI platform helping merchants optimize the online shopping journey
Login Checkout Post CheckoutAuthorization Fraud Review
Over 300
employees
200% CAGR
(2014-2018)
$64 million
in funding
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Riskified’s solution is effective across all online industries
Marketplaces High-End Fashion Electronics
GiftcardsTravelHome
Sneakers Big Box Retail Automobile Jewelry/ Precious Metals
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ClickStream Analysis
Behavioral analysis
Device
fingerprinting
Proxy
detection
Research
Real-time
analysis
120K events
/ second
200 reads
/ second
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Old Architecture
Replica set Sharded cluster
15 Shards
(30 nodes total)
MongoDB MongoDB
Research
Real-time
analysis
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
New Architecture
Kinesis
Data Streams
DynamoDB
Redshift Research
Real-time
analysis
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Data Model
The Mongo Era The DynamoDB Era
Nested documents (JSON)
Partition keys
Sort keys
Indexes Lookup tables
Manually purge TTL
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
OPS
The Mongo Era The DynamoDB Era
Complex installation Zero installation
Limited metrics Usable metrics
Complex DR Easy DR
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Transaction Performance
99%
95%
AVG
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Scaling
The Mongo Era The DynamoDB Era
Weeks Minutes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Costs Prediction
30K $
10K $
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Join Our Team
Team members across our offices
in Tel Aviv and NYC, and growing!
300
Talented team members in R&D.
45
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Join Our Team
Come be part of the eCommerce revolution and join us
for the ride!
To learn more and apply: www.riskified.com/careers
Our stack includes RDS, Redshift,
Elasticsearch, DynamoDB, Redis,
Amazon Kinesis, Kafka, and Spark.
We're looking for Big Data
Engineers, Backend, and Fullstack
Developers to join us.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you for
your time!
For additional information, visit:
www.riskified.com
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS databases services
Purpose-built for all your app needs
NeptuneRDS
Aurora CommercialCommunity
Timestream QLDBElastiCache
Relational Key-value Document In-memory Graph Time series Ledger
DynamoDB
DocumentDB
NEW!
Redis Memcached
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Document databases
• Data is stored in JSON-like
documents
• Documents map naturally to
how humans model data
• Flexible schema and indexing
• Expressive query language
built for documents (ad hoc
queries and aggregations)
JSON documents are first-class objects
of the database
{
id: 1,
name: "sue",
age: 26,
email: "sue@example.com",
promotions: ["new user", "5%", "dog lover"],
memberDate: 2018-2-22,
shoppingCart: [
{product:"abc", quantity:2, cost:19.99},
{product:"edf", quantity:3, cost: 2.99}
]
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon DocumentDB
Fast, scalable, highly available MongoDB-compatible database
Highly Available
Automatic Multi-AZ data
replication; automated
backup, snapshots,
failover;
Performance at scale
2X the throughput of currently
available MongoDB managed
services; scale read capacity to
millions of requests per second
by adding up to 15 low latency
read replicas across three AZs in
minutes, regardless of data size
MongoDB-compatible
Implements the Apache 2.0 open
source MongoDB 3.6 API by
emulating the responses that a
MongoDB client expects from a
MongoDB server
Durable
Fault-tolerant, self-healing
storage; six copies of data
across three Availability Zones;
continuous backup to Amazon
S3
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
reads
AWS Region
Availability Zone 1 Availability Zone 2 Availability Zone 3
Instance
(primary)
Cluster volume
Instance
(replica)
Instance
(replica)
Data copies Data copies Data copies
writes
writes
writes
reads
reads
Amazon DocumentDB Architecture
Separate compute and storage
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed Storage Volume Distributed Storage Volume Distributed Storage Volume
Scenario 1: Dev/test with a single
instance
Scenario 2: Read scaling in minutes Scenario 3: Scale-up and scale-out for
analytics
Flexible
Durability and replication are handled by the distributed storage volume
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fully-managed
Fast, reliable, and fully-managed MongoDB-compatible database service
Automatic patching Quick start Monitoring Integrated
Up-to-date with the latest
patches
Provision production-
ready clusters in minutes
Over 20 key operational
metrics for your clusters
at no extra charge
Deeply integrated with AWS
services such as
CloudFormation, CloudTrail,
CloudWatch, DMS, IAM, VPC,
and more.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Backup
Automatic backups 35 days of
PITR
Archive snapshots
Automatic, incremental, and
continuous backups
Backups do not affect
database performance
Point-in-time recovery
(PITR) for up to 35 days
Keep snapshots for as long as
you need
No performance
impact
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Migrate on-premises MongoDB
databases to DocumentDB
Migrate EC2 MongoDB
databases to DocumentDB
Data replication for near-zero
downtime migration
Migrate from replica sets and
sharded clusters
Migration
Migrate to DocumentDB with the Amazon Database Migration Service (DMS)
Free for 6 months if you are
moving to DocumentDB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Which database to use?
• Key-value
• Hyper Scale
• Consistent low latency at any
scale
• Multi-master with global
replication
• Item size up to 400KB
DynamoDB DocumentDB
• Documents
• Efficiently query nested structures
• Rich suite of query operators
• Aggregations
• Document size up to 16MB
• Database size up to 64TB
• Simple migration for existing
MongoDB users
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Leonid Koren
Solutions Architect - AWS
http://bit.ly/2SGYFNY
Ziv Shenhav
Technical Account Manager - AWS

More Related Content

Similar to No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv 2019 (20)

PPTX
AWS SSA Webinar 33 - Getting started with databases on AWS Amazon DynamoDB
Cobus Bernard
 
PDF
Getting Strated with Amazon Dynamo DB (Jim Scharf) - AWS DB Day
Amazon Web Services Korea
 
DOCX
Dynamo db pros and cons
Saniya Khalsa
 
PDF
DynamoDB Deep Dive
Amazon Web Services LATAM
 
PPTX
Introduction to aws dynamo db
Omid Vahdaty
 
PDF
2017 AWS DB Day | Amazon DynamoDB 서비스, 개요 및 신규 기능 소개
Amazon Web Services Korea
 
PDF
Intro to database_services_fg_aws_summit_2014
Amazon Web Services LATAM
 
PPTX
Building low latency apps with a serverless architecture and in-memory data I...
AWS Germany
 
PDF
Amazon DynamoDB
Kriti Katyayan
 
PDF
AWS DYNAMODB TWO CASE STUDIES.pdf
hayhadiabbas
 
PPTX
Dynamo db
Parag Patil
 
PDF
Deep Dive into DynamoDB
AWS Germany
 
PDF
Highlights of AWS ReInvent 2023 (Announcements and Best Practices)
Emprovise
 
PDF
Devsumi2019 dynamodb
oranie Narut
 
PPT
CO3-Session-6(AmazonDynamoDB).ppt
AbhignaReddy30
 
PDF
AWS DynamoDB
Suman Debnath
 
PPTX
How to Choose The Right Database on AWS - Berlin Summit - 2019
Randall Hunt
 
PDF
[D3T1S03] Amazon DynamoDB design puzzlers
Amazon Web Services Korea
 
ZIP
Gluecon 2012 - DynamoDB
Jeff Douglas
 
KEY
DynamoDB Gluecon 2012
Appirio
 
AWS SSA Webinar 33 - Getting started with databases on AWS Amazon DynamoDB
Cobus Bernard
 
Getting Strated with Amazon Dynamo DB (Jim Scharf) - AWS DB Day
Amazon Web Services Korea
 
Dynamo db pros and cons
Saniya Khalsa
 
DynamoDB Deep Dive
Amazon Web Services LATAM
 
Introduction to aws dynamo db
Omid Vahdaty
 
2017 AWS DB Day | Amazon DynamoDB 서비스, 개요 및 신규 기능 소개
Amazon Web Services Korea
 
Intro to database_services_fg_aws_summit_2014
Amazon Web Services LATAM
 
Building low latency apps with a serverless architecture and in-memory data I...
AWS Germany
 
Amazon DynamoDB
Kriti Katyayan
 
AWS DYNAMODB TWO CASE STUDIES.pdf
hayhadiabbas
 
Dynamo db
Parag Patil
 
Deep Dive into DynamoDB
AWS Germany
 
Highlights of AWS ReInvent 2023 (Announcements and Best Practices)
Emprovise
 
Devsumi2019 dynamodb
oranie Narut
 
CO3-Session-6(AmazonDynamoDB).ppt
AbhignaReddy30
 
AWS DynamoDB
Suman Debnath
 
How to Choose The Right Database on AWS - Berlin Summit - 2019
Randall Hunt
 
[D3T1S03] Amazon DynamoDB design puzzlers
Amazon Web Services Korea
 
Gluecon 2012 - DynamoDB
Jeff Douglas
 
DynamoDB Gluecon 2012
Appirio
 

More from AWS Summits (20)

PDF
AWS Summit Singapore 2019 | The Smart Way to Build an AI & ML Strategy for Yo...
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Bridging Start-ups and Enterprises
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Hiring a Global Rock Star Team: Tips and Tricks
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Five Common Technical Challenges for Startups
AWS Summits
 
PDF
AWS Summit Singapore 2019 | A Founder's Journey to Exit
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Realising Business Value with AWS Analytics Services
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Snowflake: Your Data. No Limits
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Amazon Digital User Engagement Solutions
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Driving Business Outcomes with Data Lake on AWS
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Big Data Analytics Architectural Patterns and Bes...
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Microsoft DevOps on AWS
AWS Summits
 
PDF
AWS Summit Singapore 2019 | The Serverless Lifecycle: Development and Operati...
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Accelerating Enterprise Cloud Transformation by M...
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Operating Microservices at Hyperscale
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Autoscaling Your Kubernetes Workloads
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Realising Business Value
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Transformation Towards a Digital Native Enterprise
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Pragmatic Container Security
AWS Summits
 
PDF
AWS Summit Singapore 2019 | Enterprise Migration Journey Roadmap
AWS Summits
 
AWS Summit Singapore 2019 | The Smart Way to Build an AI & ML Strategy for Yo...
AWS Summits
 
AWS Summit Singapore 2019 | Bridging Start-ups and Enterprises
AWS Summits
 
AWS Summit Singapore 2019 | Hiring a Global Rock Star Team: Tips and Tricks
AWS Summits
 
AWS Summit Singapore 2019 | Five Common Technical Challenges for Startups
AWS Summits
 
AWS Summit Singapore 2019 | A Founder's Journey to Exit
AWS Summits
 
AWS Summit Singapore 2019 | Realising Business Value with AWS Analytics Services
AWS Summits
 
AWS Summit Singapore 2019 | Snowflake: Your Data. No Limits
AWS Summits
 
AWS Summit Singapore 2019 | Amazon Digital User Engagement Solutions
AWS Summits
 
AWS Summit Singapore 2019 | Driving Business Outcomes with Data Lake on AWS
AWS Summits
 
AWS Summit Singapore 2019 | Big Data Analytics Architectural Patterns and Bes...
AWS Summits
 
AWS Summit Singapore 2019 | Microsoft DevOps on AWS
AWS Summits
 
AWS Summit Singapore 2019 | The Serverless Lifecycle: Development and Operati...
AWS Summits
 
AWS Summit Singapore 2019 | Accelerating Enterprise Cloud Transformation by M...
AWS Summits
 
AWS Summit Singapore 2019 | Operating Microservices at Hyperscale
AWS Summits
 
AWS Summit Singapore 2019 | Autoscaling Your Kubernetes Workloads
AWS Summits
 
AWS Summit Singapore 2019 | Realising Business Value
AWS Summits
 
AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...
AWS Summits
 
AWS Summit Singapore 2019 | Transformation Towards a Digital Native Enterprise
AWS Summits
 
AWS Summit Singapore 2019 | Pragmatic Container Security
AWS Summits
 
AWS Summit Singapore 2019 | Enterprise Migration Journey Roadmap
AWS Summits
 
Ad

No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv 2019

  • 2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. No Hassle, NoSQL DynamoDB, DocumentDB Leonid Koren Solutions Architect AWS D A T 3 0 4 Ziv Shenhav Technical Account Manager AWS Inbar Yogev Data Engineering Lead Riskified Drorit Baron Software Developer Riskified
  • 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda • NoSQL Databases • DynamoDB • Managing Table Capacity (under the hood) • Features for Developers • Customer Story • DocumentDB
  • 4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Optimized for storage Optimized for compute Normalized/relational Denormalized/hierarchical Ad hoc queries Instantiated views Scale vertically Scale horizontally Good for OLAP, Limited Scale OLTP Built for OLTP at scale SQL NoSQL Why NoSQL?
  • 5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Operating Self-Managed NoSQL Is Challenging It’s too much work It costs too much
  • 6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon DynamoDB Fast and flexible key value database service for any scale Comprehensive security Encrypts all data by default and fully integrates with AWS Identity and Access Management for robust security Performance at scale Consistent, single-digit millisecond response times at any scale; build applications with virtually unlimited throughput Global database for global users and apps Build global applications with fast access to local data by easily replicating tables across multiple AWS Regions Serverless No server provisioning, software patching, or upgrades; scales up or down automatically; continuously backs up your data
  • 7. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Table, Item, Attribute, Index Table Items Attributes Partition Key Sort Key Customer ID (Partition Key) Order Date (Sort Key) Store Order Sum Country Local Secondary Index Example Table Customer ID (Partition Key) Order Sum (Sort Key) Order Date Country (Partition Key) Order Sum Store Order DateGlobal Secondary Index
  • 8. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 00 55 A954 FFAA00 FF Partition Keys Partition Key uniquely identifies an item Partition Key is used for building an unordered hash index Allows table to be partitioned for scale Id = 1 Name = Jim Hash (1) = 7B Id = 2 Name = Andy Dept = Eng Hash (2) = 48 Id = 3 Name = Kim Dept = Ops Hash (3) = CD Key Space
  • 9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Partitions are replicated across three AZs Id = 2 Name = Andy Dept = Engg Id = 3 Name = Kim Dept = Ops Id = 1 Name = Jim Id = 2 Name = Andy Dept = Engg Id = 3 Name = Kim Dept = Ops Id = 1 Name = Jim Id = 2 Name = Andy Dept = Engg Id = 3 Name = Kim Dept = Ops Id = 1 Name = Jim Replica 1 Replica 2 Replica 3
  • 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Provisioning Table Capacity
  • 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Provisioning Table Capacity 1 RCU = Items up to 4KB 1 WCU = Items up to 1KB
  • 13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Provisioning Trade-off
  • 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Provisioning Example
  • 15. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 0x12A8 236294 { name:“Sara”, city:”Tampa”, …} 0x3391 445104 { name:“James”, city:”Miami”, …} 0x6134 333363 { name:“Betty”, city:”Madison”, …} 0x9531 145783 { name:“Bob”, city:”London”, …} 0xB082 643145 { name:“Val”, city:”Seattle”, …} 0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …} 0xF355 523422 { name:“Alex”, city:”London”, …} Provisioning
  • 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Token Bucket Algorithm
  • 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Burst Capacity
  • 18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Unbalanced Load 0x12A8 236294 { name:“Sara”, city:”Tampa”, …} 0x3391 445104 { name:“James”, city:”Miami”, …} 0x6134 333363 { name:“Betty”, city:”Madison”, …} 0x9531 145783 { name:“Bob”, city:”London”, …} 0xB082 643145 { name:“Val”, city:”Seattle”, …} 0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …} 0xF355 523422 { name:“Alex”, city:”London”, …}
  • 19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Unbalanced Load 0x12A8 236294 { name:“Sara”, city:”Tampa”, …} 0x3391 445104 { name:“James”, city:”Miami”, …} 0x6134 333363 { name:“Betty”, city:”Madison”, …} 0x9531 145783 { name:“Bob”, city:”London”, …} 0xB082 643145 { name:“Val”, city:”Seattle”, …} 0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …} 0xF355 523422 { name:“Alex”, city:”London”, …} 50 throttles per second
  • 20. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Adaptive Capacity
  • 21. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Adaptive Capacity
  • 22. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Adaptive Capacity Active 0x12A8 236294 { name:“Sara”, city:”Tampa”, …} 0x3391 445104 { name:“James”, city:”Miami”, …} 0x6134 333363 { name:“Betty”, city:”Madison”, …} 0x9531 145783 { name:“Bob”, city:”London”, …} 0xB082 643145 { name:“Val”, city:”Seattle”, …} 0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …} 0xF355 523422 { name:“Alex”, city:”London”, …}
  • 23. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Total Demand Change 0x12A8 236294 { name:“Sara”, city:”Tampa”, …} 0x3391 445104 { name:“James”, city:”Miami”, …} 0x6134 333363 { name:“Betty”, city:”Madison”, …} 0x9531 145783 { name:“Bob”, city:”London”, …} 0xB082 643145 { name:“Val”, city:”Seattle”, …} 0xEA8A 723342 { name:“Jeff”, city:”Toledo”, …} 0xF355 523422 { name:“Alex”, city:”London”, …} à à à
  • 24. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Auto Scaling
  • 25. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Actual Auto-scaled Table
  • 26. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Auto Scaling – Creating A New Table
  • 27. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Provisioning Recap
  • 28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB On-Demand Features • No capacity planning, provisioning, or reservations - simply make API calls • Pay only for the reads and writes you perform Key benefits • Eliminates tradeoffs of over- or under- provisioning • Instantly accommodates your workload as traffic ramps up or down
  • 29. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB On-Demand
  • 30. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB On-Demand
  • 31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB: Capacity managed for you Govern max consumption
  • 32. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 33. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB transactions Simplify your code by executing multiple, all-or-nothing actions within and across tables with a single API call Single API Call
  • 34. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Global Tables Build high-performance, globally distributed applications. Low latency reads and writes to locally available tables. Multi-region redundancy and resiliency. Easy to set up, and no application re-writes required.
  • 35. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB Streams • DynamoDB Streams captures a time-ordered sequence of item- level modifications (stored up to 24 hours) in a DynamoDB table • Process multiple modifications at a time with Lambda Amazon DynamoDB DynamoDB Stream AWS Lambda function
  • 36. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Time-To-Live (TTL) TTL job CustomerActiveOrder OrderId: 1 CustomerId: 1 Removes data that is no longer relevant MyTTL: 1492641900
  • 37. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Point in time restore for short-term retention and data corruption protection Backup hundreds of TB instantly with NO performance impact On-demand backups for long- term data archival and compliance Backup and Restore
  • 38. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Riskified DynamoDB talk for AWS summit Inbar Yogev Data Engineering Lead Riskified Drorit Baron Software Developer Riskified
  • 39. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Meet Riskified We’re an AI platform helping merchants optimize the online shopping journey Login Checkout Post CheckoutAuthorization Fraud Review Over 300 employees 200% CAGR (2014-2018) $64 million in funding
  • 40. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Riskified’s solution is effective across all online industries Marketplaces High-End Fashion Electronics GiftcardsTravelHome Sneakers Big Box Retail Automobile Jewelry/ Precious Metals
  • 41. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. ClickStream Analysis Behavioral analysis Device fingerprinting Proxy detection Research Real-time analysis 120K events / second 200 reads / second
  • 42. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Old Architecture Replica set Sharded cluster 15 Shards (30 nodes total) MongoDB MongoDB Research Real-time analysis
  • 43. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. New Architecture Kinesis Data Streams DynamoDB Redshift Research Real-time analysis
  • 44. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Data Model The Mongo Era The DynamoDB Era Nested documents (JSON) Partition keys Sort keys Indexes Lookup tables Manually purge TTL
  • 45. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. OPS The Mongo Era The DynamoDB Era Complex installation Zero installation Limited metrics Usable metrics Complex DR Easy DR
  • 46. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Transaction Performance 99% 95% AVG
  • 47. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Scaling The Mongo Era The DynamoDB Era Weeks Minutes
  • 48. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Costs Prediction 30K $ 10K $
  • 49. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Join Our Team Team members across our offices in Tel Aviv and NYC, and growing! 300 Talented team members in R&D. 45
  • 50. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Join Our Team Come be part of the eCommerce revolution and join us for the ride! To learn more and apply: www.riskified.com/careers Our stack includes RDS, Redshift, Elasticsearch, DynamoDB, Redis, Amazon Kinesis, Kafka, and Spark. We're looking for Big Data Engineers, Backend, and Fullstack Developers to join us.
  • 51. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thank you for your time! For additional information, visit: www.riskified.com
  • 52. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 53. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS databases services Purpose-built for all your app needs NeptuneRDS Aurora CommercialCommunity Timestream QLDBElastiCache Relational Key-value Document In-memory Graph Time series Ledger DynamoDB DocumentDB NEW! Redis Memcached
  • 54. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Document databases • Data is stored in JSON-like documents • Documents map naturally to how humans model data • Flexible schema and indexing • Expressive query language built for documents (ad hoc queries and aggregations) JSON documents are first-class objects of the database { id: 1, name: "sue", age: 26, email: "[email protected]", promotions: ["new user", "5%", "dog lover"], memberDate: 2018-2-22, shoppingCart: [ {product:"abc", quantity:2, cost:19.99}, {product:"edf", quantity:3, cost: 2.99} ] }
  • 55. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon DocumentDB Fast, scalable, highly available MongoDB-compatible database Highly Available Automatic Multi-AZ data replication; automated backup, snapshots, failover; Performance at scale 2X the throughput of currently available MongoDB managed services; scale read capacity to millions of requests per second by adding up to 15 low latency read replicas across three AZs in minutes, regardless of data size MongoDB-compatible Implements the Apache 2.0 open source MongoDB 3.6 API by emulating the responses that a MongoDB client expects from a MongoDB server Durable Fault-tolerant, self-healing storage; six copies of data across three Availability Zones; continuous backup to Amazon S3
  • 56. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. reads AWS Region Availability Zone 1 Availability Zone 2 Availability Zone 3 Instance (primary) Cluster volume Instance (replica) Instance (replica) Data copies Data copies Data copies writes writes writes reads reads Amazon DocumentDB Architecture Separate compute and storage
  • 57. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Distributed Storage Volume Distributed Storage Volume Distributed Storage Volume Scenario 1: Dev/test with a single instance Scenario 2: Read scaling in minutes Scenario 3: Scale-up and scale-out for analytics Flexible Durability and replication are handled by the distributed storage volume
  • 58. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Fully-managed Fast, reliable, and fully-managed MongoDB-compatible database service Automatic patching Quick start Monitoring Integrated Up-to-date with the latest patches Provision production- ready clusters in minutes Over 20 key operational metrics for your clusters at no extra charge Deeply integrated with AWS services such as CloudFormation, CloudTrail, CloudWatch, DMS, IAM, VPC, and more.
  • 59. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Backup Automatic backups 35 days of PITR Archive snapshots Automatic, incremental, and continuous backups Backups do not affect database performance Point-in-time recovery (PITR) for up to 35 days Keep snapshots for as long as you need No performance impact
  • 60. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Migrate on-premises MongoDB databases to DocumentDB Migrate EC2 MongoDB databases to DocumentDB Data replication for near-zero downtime migration Migrate from replica sets and sharded clusters Migration Migrate to DocumentDB with the Amazon Database Migration Service (DMS) Free for 6 months if you are moving to DocumentDB
  • 61. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Which database to use? • Key-value • Hyper Scale • Consistent low latency at any scale • Multi-master with global replication • Item size up to 400KB DynamoDB DocumentDB • Documents • Efficiently query nested structures • Rich suite of query operators • Aggregations • Document size up to 16MB • Database size up to 64TB • Simple migration for existing MongoDB users
  • 62. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 63. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thank you! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Leonid Koren Solutions Architect - AWS http://bit.ly/2SGYFNY Ziv Shenhav Technical Account Manager - AWS