Build Data Driven, High-Performance, Internet-Scale Applications
Total Page:16
File Type:pdf, Size:1020Kb
Build data driven, high-performance, internet-scale applications Julio Faerman @faermanj AWS Technical Evangelist SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Characteristics of modern applications Internet-scale and transactional Users: 1M+ Data volume: TB–PB–EB Locality: Global Performance: Milliseconds–microseconds Request Rate: Millions Access: Mobile, IoT, devices Scale: Up-out-in Economics: Pay-as-you-go Ride hailing Media streaming Social media Dating Developer access: Instant API access SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Modern applications require internet-scale performance SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Common data categories and use cases Relational Key-value Document In-memory Graph Time-series Ledger Referential High Store Query by key Quickly and Collect, store, Complete, integrity, ACID throughput, low- documents and with easily create and process immutable, and transactions, latency reads quickly access microsecond and navigate data sequenced verifiable history schema- and writes, querying on any latency relationships by time of all changes to on-write endless scale attribute between application data data Lift and shift, ERP, Real-time bidding, Content Leaderboards, Fraud detection, IoT applications, Systems CRM, finance shopping cart, management, real-time analytics, social networking, event tracking of record, supply social, product personalization, caching recommendation chain, health care, catalog, customer mobile engine registrations, preferences financial SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Purpose-built databases Relational Key-value Document In-memory Graph Time-series Ledger Amazon DynamoDB DocumentD ElastiCache Neptune Timestream Quantum RDS B Aurora Community Commercial SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. with Amazon DynamoDB SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Purpose-built databases for internet-scale apps The world’s largest e-commerce business, Amazon.com, runs on nonrelational cloud databases because of their scale, performance, and maintenance benefits. — Werner Vogels CTO, Amazon SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lyft >1M rides/day, 8x traffic in peak hours CHALLENGE Needed a solution that scales and manage up to 8x more riders during peak times. SOLUTION DynamoDB stores GPS coordinates of all rides. With AWS, Lyft saves on infrastructure costs and enables massive growth of ridesharing platform. There are now 23M people who use Lyft worldwide. SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon DynamoDB Fast and flexible key value database service for any scale Comprehensive Global database for Performance at scale Serverless security global users and apps Consistent, single-digit No hardware provisioning, Encrypts all data by default Build global applications with fast millisecond response times at any software patching, or upgrades; and fully integrates with access to local data by easily scale; build applications with scales up or down AWS Identity and Access replicating tables across multiple virtually unlimited throughput automatically; continuously Management for robust AWS Regions backs up your data security SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB transactions Single API Call Simplify your code by executing multiple, all-or-nothing actions within and across tables with a single API call SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB: Capacity managed for you Govern max consumption SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DynamoDB Accelerator (DAX) Features • Fully managed, highly available: Handles all software management, fault tolerant, replication across multi-AZs within a Region • DynamoDB API compatible: Seamlessly caches DynamoDB API calls, no application rewrites required • Write-through: DAX handles caching for writes • Flexible: Configure DAX for one table or many • Scalable: Scales-out to any workload with up to 10 read replicas • Manageability: Fully integrated AWS service: Amazon CloudWatch, Tagging for DynamoDB, AWS Console • Security: Amazon VPC, AWS IAM, AWS CloudTrail, AWS Organizations DynamoDB Advancements over the last 21 months February 2017 April 2017 April 2017 June 2017 Time To VPC DynamoDB Auto Live (TTL) endpoints Accelerator (DAX) scaling November 2017 November 2017 November 2017 March 2018 On-demand Point-in-time Global tables Encryption at rest backup recovery June 2018 August 2018 November 2018 November 2018 Adaptive 99.999% SLA Transactions On-demand SLA capacity ACID SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. SQL vs NoSQL SQL NoSQL Optimized for storage Optimized for compute Normalized/relational Denormalized/hierarchical Ad hoc queries Instantiated views Scale vertically Scale horizontally Good for OLAP Built for OLTP at scale SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. with Amazon Aurora SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Old world commercial relational databases Very Punitive You’ve Proprietary Lock-in expensive licensing got mail SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Moving to open database engines SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Aurora MySQL and PostgreSQL compatible relational database built for the cloud Performance and availability of commercial-grade databases at 1/10th the cost Performance Availability and scalability and durability Highly secure Fully managed 5x throughput of standard MySQL Fault-tolerant, self-healing Network isolation, Managed by RDS: and 3x of standard PostgreSQL; storage; six copies of data encryption at rest/transit no hardware provisioning, scale-out up to across three AZs; continuous software patching, setup, 15 read replicas backup to S3 configuration, or backups SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Aurora: Scale-out, Distributed architecture Master Replica Replica SQL SQL SQL Push Log applicator to Storage Transactions Transactions Transactions “The log is the database” Master Replica Replica Replica Caching Caching Caching 4/6 Write Quorum & Local tracking Shared storage volume Write performance Read scale out AZ + 1 failure tolerance AZ1 AZ2 AZ3 Instant database redo recovery SUMMIT © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Read scale out MYSQL READ SCALING AMAZON AURORA READ SCALING MySQL Master SINGLE-THREADED MySQL Replica Aurora Master PAGE CACHE Aurora Replica BINLOG APPLY UPDATE 70% Write 70% Write 70% Write 100% New Reads 30% Read 30% New Reads 30% Read Data Volume Data Volume Shared Multi-AZ Storage Logical using complete changes Physical using delta changes Same write workload NO writes on replica storage Independent Shared storage © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Aurora Multi-Master Architecture Orange Master Replica Blue Master Cluster Services SQL SQL • Membership • Replication Replica No Pessimistic Locking • Heartbeat • Metadata TransactionsMaster Transactions Caching Caching No Global Ordering Decoupled T1 T2 No Global Commit-Coordination 1 2 ? 3 Optimistic Conflict Resolution Decoupled Shared Storage Volume Decoupled System AZ1 1 1 2 2 3 3 AZ2 1 1 2 2 3 3 Microservices Architecture AZ3 1 1 2 2 3 3 Decoupled Driving down query latency – Parallel Query DATABASE NODE Parallel, Distributed processing AGGREGATE PUSH DOWN RESULTS PREDICATES Push-down processing closer to data Reduces buffer pool pollution STORAGE NODES “AZ+1” failure tolerance AZ 1 AZ 2 AZ 3 2/3 read Why? 2/3 write In a large fleet, always some failures AZ failures have ”shared fate” Quorum break on AZ failure AZ 1 AZ 2 AZ 3 3/6 read How? 4/6 write 6 copies, 2 copies per AZ Quorum 2/3 quorum will not work survives AZ failure © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Database backtrack t4 Invisible Invisible t2 t3 Rewind to t3 t0 t1 Rewind to t1 t0 t1 t2 t3 t4 Backtrack brings the database to a point in time without requiring restore from backups • Backtracking from an unintentional DML or DDL operation • Backtrack is not destructive. You can backtrack multiple times to find the right point in time Global replication Faster disaster recovery and enhanced data locality © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Performance Insights CPU bottleneck Dashboard showing database load Max vCPU . Easy – e.g. drag and drop . Powerful – drill down using zoom in Identifies source of bottlenecks . Sort by top SQL . Slice by host, user, wait events SQL w/ high CPU Adjustable time frame . Hour, day, week , month . Up to 2 years of data; 7 days free © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Aurora Serverless Responds to your application load automatically Scale capacity up and down in < 10 seconds New instance has warm buffer pool Multi-tenant proxy is highly available © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. How does it work . Region Availability zone 1 App Multi-tenant NLB / database proxy layer Monitoring