Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building data-intensive applications

Building data-intensive applications

As presented at AWS Summit Warsaw 2019

Julio Faerman

May 30, 2019
Tweet

More Decks by Julio Faerman

Other Decks in Technology

Transcript

  1. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Build Data Driven, High-Performance, Internet- Scale Applications Julio Faerman @faermanj AWS Technical Evangelist
  2. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 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 Developer access: Instant API access Social media Ride hailing Media streaming Dating
  3. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Modern applications require internet-scale performance
  4. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Common data categories and use cases Relational Referential integrity, ACID transactions, schema- on-write Lift and shift, ERP, CRM, finance Key-value High throughput, low- latency reads and writes, endless scale Real-time bidding, shopping cart, social, product catalog, customer preferences Document Store documents and quickly access querying on any attribute Content management, personalization, mobile In-memory Query by key with microsecond latency Leaderboards, real-time analytics, caching Graph Quickly and easily create and navigate relationships between data Fraud detection, social networking, recommendation engine Time-series Collect, store, and process data sequenced by time IoT applications, event tracking Ledger Complete, immutable, and verifiable history of all changes to application data Systems of record, supply chain, health care, registrations, financial
  5. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Purpose-built databases Relational Key-value Document In-memory Graph Time-series Ledger DynamoDB Neptune Amazon RDS Aurora Commercial Community Timestream Quantum ElastiCache DocumentDB
  6. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. with Amazon Aurora
  7. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Old world commercial relational databases Lock-in Proprietary Punitive licensing Very expensive You’ve got mail
  8. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Moving to open database engines
  9. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Amazon Aurora MySQL and PostgreSQL compatible relational database built for the cloud Performance and availability of commercial-grade databases at 1/10th the cost Availability and durability Fault-tolerant, self-healing storage; six copies of data across three AZs; continuous backup to S3 Fully managed Managed by RDS: no hardware provisioning, software patching, setup, configuration, or backups Highly secure Network isolation, encryption at rest/transit Performance and scalability 5x throughput of standard MySQL and 3x of standard PostgreSQL; scale-out up to 15 read replicas
  10. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Aurora: Scale-out, Distributed architecture Ø Push Log applicator to Storage Master Replica Replica Replica Master Shared storage volume Replica Replica SQL Transactions Caching SQL Transactions Caching SQL Transactions Caching AZ1 AZ2 AZ3 ü Write performance ü Read scale out ü AZ + 1 failure tolerance ü Instant database redo recovery Ø 4/6 Write Quorum & Local tracking ü “The log is the database”
  11. © 2018, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Write and read throughput Aurora MySQL is 5x faster than MySQL 0 50,000 100,000 150,000 200,000 250,000 MySQL 5.6 MySQL 5.7 MySQL 8.0 Aurora 5.6 Aurora 5.7 0 100,000 200,000 300,000 400,000 500,000 600,000 700,000 800,000 MySQL 5.6 MySQL 5.7 MySQL 8.0 Aurora 5.6 Aurora 5.7 Write Throughput Read Throughput Using Sysbench with 250 tables and 200,000 rows per table on R4.16XL
  12. © 2018, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Performance variability under load Amazon Aurora >200x more consistent SysBench OLTP (write-only) workload with 250 tables and 200,000 rows per table on R4.16XL 0 2 4 6 8 10 12 0 100 200 300 400 500 600 Time in seconds Write Response Time (seconds) Amazon Aurora MySQL 5.6 on EBS
  13. © 2018, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Read scale out PAGE CACHE UPDATE Aurora Master 30% Read 70% Write Aurora Replica 100% New Reads Shared Multi-AZ Storage MySQL Master 30% Read 70% Write MySQL Replica 30% New Reads 70% Write SINGLE-THREADED BINLOG APPLY Data Volume Data Volume Logical using complete changes Same write workload Independent storage Physical using delta changes NO writes on replica Shared storage MYSQL READ SCALING AMAZON AURORA READ SCALING
  14. Master Replica Orange Master Blue Master SQL Transactions Caching SQL

    Transactions Caching Aurora Multi-Master Architecture Shared Storage Volume Ø No Pessimistic Locking Ø No Global Ordering Ø No Global Commit-Coordination Replica • Membership • Heartbeat • Replication • Metadata Cluster Services 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 1 3 ? T1 T2 AZ1 AZ2 AZ3 Decoupled Decoupled Decoupled Ø Decoupled System Ø Microservices Architecture 2 Ø Optimistic Conflict Resolution
  15. “AZ+1” failure tolerance Why? Ø In a large fleet, always

    some failures Ø AZ failures have ”shared fate” AZ 1 AZ 2 AZ 3 Quorum break on AZ failure 2/3 read 2/3 write AZ 1 AZ 2 AZ 3 Quorum survives AZ failure 3/6 read 4/6 write How? Ø 6 copies, 2 copies per AZ Ø 2/3 quorum will not work © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  16. Driving down query latency – Parallel Query Ø Parallel, Distributed

    processing Ø Push-down processing closer to data Ø Reduces buffer pool pollution DATABASE NODE STORAGE NODES PUSH DOWN PREDICATES AGGREGATE RESULTS
  17. Database backtrack 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 t0 t1 t2 t0 t1 t2 t3 t4 t3 t4 Rewind to t1 Rewind to t3 Invisible Invisible
  18. © 2018, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Global replication Faster disaster recovery and enhanced data locality © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  19. © 2018, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Performance Insights Dashboard showing database load § 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 Adjustable time frame § Hour, day, week , month § Up to 2 years of data; 7 days free Max vCPU CPU bottleneck SQL w/ high CPU
  20. © 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
  21. © 2018, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Introducing Web Service Data API Access your database from Lambda applications SQL statements packaged as HTTP requests Connection pooling managed behind proxy Web Service Data API Aurora Serverless
  22. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. with Amazon DynamoDB
  23. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 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
  24. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 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. Lyft >1M rides/day, 8x traffic in peak hours
  25. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 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 hardware provisioning, software patching, or upgrades; scales up or down automatically; continuously backs up your data
  26. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T DynamoDB: Capacity managed for you Govern max consumption
  27. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T DynamoDB transactions Simplify your code by executing multiple, all-or-nothing actions within and across tables with a single API call Single API Call
  28. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T SQL vs 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 SQL NoSQL
  29. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved. with Amazon ElastiCache
  30. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Usuarios: 1M+ Volumen: GB-TB–PB Localidade: Global Rendimiento: Microseconds Ingestion: M+ RPS Accesso: Mobile, IoT, devices Escala: Up-out-in Económica: Pay-as-you-go SLA: Strict Social media Ride hailing Media streaming Dating Characteristics of modern applications Internet-scale and transactional
  31. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Introducing Amazon ElastiCache Fully-managed, Redis or Memcached compatible, low-latency, in-memory data store Fully Managed Extreme Performance Easily Scalable AWS manages all hardware and software setup, configuration, monitoring In-memory data store and cache for sub-millisecond response times Read scaling with replicas. Write and memory scaling with sharding. Non disruptive scaling
  32. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T What’s New: Redis & Memcached • Redis Streams • SortedSets now have LIST capabilities (POP and BLOCK) ) • HyperLogLogs has an optimized algorithm • Speed Improvements (Jemalloc additions, etc.) • Active Defragmentation • Added In-line HELP command for redis-cli • Native TLS Integration Redis (ElastiCache) • Mo re at h t t p s://aw s.am az o n .co m /re dis/Wh at s_Ne w _R e dis5 • Automated Slab rebalancing • LRU crawler to background-reclaim memory • Faster hash table lookups with murmur3 algorithm Ø Redis 5.0 Ø Memcached 1.5.10
  33. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Redis Overview Fast <1ms latency for most commands Open source Easy to learn Highly available Replication Atomic operations Supports transactions In-memory key-value store Powerful ~200 commands, Lua scripting, Geospatial, Pub/Sub Various data structures Strings, lists, hashes, sets, sorted sets, bitmaps, streams, and HyperLogLogs Backup/Restore Enables snapshotting
  34. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Cluster sizing best practices • In-Memory Storage • Recommended: Memory needed + 25% reserved memory (for Redis) + some room for growth (optional 10%) • Optimize using eviction policies and TTLs • Scale up or out when before reaching max-memory using CloudWatch alarms • Use memory optimized nodes for cost effectiveness (R5 support ) • Performance • Benchmark operations using Redis Benchmark tool • For more READIOPS—Add replicas • For more WRITEIOPS—Add shards (scale out) • For more network IO—Use network optimized instances and scale out • Use pipelining for bulk reads/writes • Consider Big(O) time complexity for data structure commands
  35. DynamoDB Accelerator (DAX) • 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 Features DynamoDB Your Applications DynamoDB Accelerator Table #1 Table #2
  36. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T GE’s Predix Platform Powered by ElastiCache Redis Using ElastiCache Redis with Open Service Broker, Predix Platform from GE Digital allows developers to easily create Redis clusters with standard, pre-configured parameters, sizing and network security. Developers build container-based stateless applications on AWS and ElastiCache is used to manage session state for these applications. The architecture makes is easy and simple for developers to build applications. Container Runtime VPC Control Plane Data Plane App Server Broker ElastiCache VPC EC2 API GE is the world’s largest digital industrial company. We use [ElastiCache Redis] to make it super easy and simple for developers to use Amazon services. Amazon ElastiCache team implemented the Redis AUTH feature in four regions in two months enabling application level security.” – Amulya Sharma Senior Staff Software Engineer GE Digital “
  37. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Expedia’s Real-time Analytics with ElastiCache Expedia is a leader in the $1 trillion travel industry, with an extensive portfolio that includes some of the world’s most trusted travel brands. Expedia’s real-time analytics application collects data for its “test & learn” experiments on Expedia sites. The analytics application processes ~200 million messages daily. With ElastiCache Redis as caching layer, the write throughput on DynamoDB has been set to 3500, down from 35000, reducing the cost by 6x.” – Kuldeep Chowhan Engineering Manager, Expedia “ Kenesis Firehose Real-time streams of lodging mark data EC2 Redshift Aurora S3 Ingest multiple data streams Join/ compare events ElastiCache (Redis) Reference data on-premises Historical queries on up to 2 years of data Staging near real- time data Operational queries of real-time data
  38. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T AWS re:Invent 2018: Databases on AWS https://www.youtube.com/watch?v=-pb-DkD6cWg&t=1703s
  39. S U M M I T © 2019, Amazon Web

    Services, Inc. or its affiliates. All rights reserved.
  40. S U M M I T © 2019, Amazon Web

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

    rights reserved. S U M M I T Architect services ground-up for the cloud and for the explosion of data Offer a portfolio of purpose-built services, optimized for your workloads Help you innovate faster through managed services Our approach Provide services that help you migrate existing apps and databases to the cloud
  42. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T When to Use Which Services Situation Solution Existing application Use your existing engine on RDS • MySQL Amazon Aurora, RDS for MySQL • PostgreSQL Amazon Aurora, RDS for PostgreSQL • MariaDB Amazon Aurora, RDS for MariaDB • Oracle Use SCT to determine complexity Amazon Aurora, RDS for Oracle • SQL Server Use SCT to determine complexity Amazon Aurora, RDS for SQL Server New application • If you can avoid relational features DynamoDB • If you need relational features Amazon Aurora In-memory store/cache • Amazon ElastiCache Time series data • Amazon Timestream Track every application change, crypto verifiable. Have a central trust authority • Amazon Quantum Ledger Database (QLDB) Don’t have a trusted central authority • Amazon Managed Blockchain Data Warehouse & BI • Amazon Redshift, Amazon Redshift Spectrum, and Amazon QuickSight Adhoc analysis of data in S3 • Amazon Athena and Amazon QuickSight Apache Spark, Hadoop, HBase (needle in a haystack type queries) • Amazon EMR Log analytics, operational monitoring, & search • Amazon Elasticsearch Service and Amazon Kinesis
  43. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  44. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Thank you! S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Julio Faerman @faermanj