postgresql on aws
play

POSTGRESQL ON AWS: TIPS & TRICKS (AND HORROR STORIES) - PowerPoint PPT Presentation

Please write title, subtitle Please write title, subtitle and speaker name in all and speaker name in all capital letters capital letters POSTGRESQL ON AWS: TIPS & TRICKS (AND HORROR STORIES) ALEXANDER KUKUSHKIN 07-07-2017 Put images


  1. Please write title, subtitle Please write title, subtitle and speaker name in all and speaker name in all capital letters capital letters POSTGRESQL ON AWS: TIPS & TRICKS (AND HORROR STORIES) ALEXANDER KUKUSHKIN 07-07-2017

  2. Put images in the grey dotted box "unsupported placeholder" ABOUT ME Please write the title in all capital letters Use bullet points to summarize information rather than writing long paragraphs in the text box Alexander Kukushkin Database Engineer @ZalandoTech Email: alexander.kukushkin@zalando.de Twitter: @cyberdemn 2

  3. Put images in the grey dotted box "unsupported placeholder" - behind the orange box and quote in capital letters FACTS & FIGURES

  4. Put images in the grey dotted box "unsupported placeholder" ZALANDO AT A GLANCE Please write the title in all capital letters ~200 visits ~3.6 billion EURO per million month revenue 2016 ~200,000 ~20 product choices >12,000 50% 15 million ~2,000 employees in return rate across brands countries Europe active customers all categories 4

  5. Please write the title in all capital letters ZALANDO TECHNOLOGY BERLIN DORTMUND DUBLIN ERFURT HAMBURG HELSINKI MÖNCHENGLADBACH 5

  6. Put images in the grey dotted box "unsupported placeholder" ZALANDO TECHNOLOGY Please write the title in all capital letters Use bullet points to ● > 150 databases in DC summarize information rather than writing long paragraphs in the text box ● > 170 databases on AWS ● > 1700 tech employees ● We are hiring! 6

  7. Please write the title in all capital letters WHY WE USE AWS ● Fast hardware (service) provisioning ● Easy scale up/down/in/out ● Pay only for resources you need 7

  8. Please write the title in all capital letters GLOSSARY Use bullet points to summarize information rather than writing long ● RDS - Relational Database Service paragraphs in the text box ● EC2 - Elastic Compute Cloud ● EBS - Elastic Block Store ● S3 - Simple Storage Service ● ELB - Elastic Load Balancing ● AZ - Availability Zone ● ASG - Auto Scaling Group 8

  9. Please write the title in all capital letters POSTGRESQL HA ON AWS ● Shared storage - EBS, attach it to a different EC2 Instance ○ Works within one AZ ○ Replicas can’t execute queries ● Storage mirroring - Multi-AZ RDS ( EBS is replicated to another AZ ) ○ Works between AZ ○ Replicas can’t execute queries ● Streaming replication - you can start additional RDS replicas ○ Works between AZ ○ Replicas can execute queries ○ Automatic Failover problem (if not Multi-AZ deployment) 9

  10. Please write the title in all capital letters RDS SUMMARY Use bullet points to summarize information rather than writing long paragraphs in the text box ● No superuser access ● No replication connection ● No custom extensions ● Either you run Multi-AZ RDS deployment (replica can’t receive queries) ● Or Master + Replica on RDS and don’t have automatic failover 10

  11. Please write the title in all capital letters EC2 VS. RDS: PRICING* Use bullet points to summarize information rather than writing long paragraphs in the text Instance Type RDS Multi-AZ 2 x EC2 + ELB** 3 x EC2 + ELB box (db.)t2.micro $36.0/month $41.8/month $51.8/month (db.)t2.small $64.8/month $60.5/month $79.9/month (db.)t2.large $241.9/month $177.1/month $254.9/month (db.)m4.large $312.5/month $194.4/month $280.8/month (db.)m4.xlarge $626.4/month $367.2/month $540.0/month * storage price is not included ** ELB - ~$21/month 11

  12. Please write the title in all capital letters SPILO AND PATRONI Use bullet points to summarize information rather than writing long paragraphs in the text box ● Patroni - High-Availability and automatic failover ● Spilo - Docker package of Patroni and WAL-E for AWS or Kubernetes ● Use CloudFormation stacks and ASG for deployments ● One Docker container per EC2 Instance ● ELB for traffic routing 12

  13. Please write the title in all capital letters AWS DEPLOYMENT 13

  14. Please write the title in all capital letters Cloud Formation Stack 5432, 8008 GET /master db.zalando Master Elastic Root volume Data Volume Root volume Data Volume Load Balancer Replica Master DB Etcd Master ELB DB Security Group Availability Zone A Availability Zone B Replica ELB User Data: Security Group - Docker image - Backup schedule Root volume Data Volume - Superuser password S3 bucket: Replica - Replication password Backup + WAL GET /replica DB - Postgres parameters 5432, 8008 Availability Zone C Auto-Scaling db-repl.zalando Replica Elastic Load Balancer Cluster Security Group 14

  15. Please write the title in all capital letters EC2 INSTANCE FEATURES Use bullet points to summarize information rather than writing long paragraphs in the text box ● Performance: Fixed vs. Burstable (T2 Instances) ● Storage: Instance Store (Ephemeral) vs. EBS ● EBS-optimized Instances ● Enhanced Networking 15

  16. Put images in the grey dotted box "unsupported placeholder" - behind the orange box (left side stays white) Write the quote in all capital letters BURSTABLE PERFORMANCE OR WHY IS MY DATABASE VERY SLOW? 16

  17. Please write the title in all capital letters BURSTABLE PERFORMANCE t2.micro ~100% ~10% ~2h 30m 17

  18. Please write the title in all capital letters BURSTABLE PERFORMANCE t2.micro 18

  19. Please write the title in all capital letters T2 INSTANCES Use bullet points to summarize information rather than writing long ● Designed to provide moderate baseline performance and the capability to burst to significantly higher paragraphs in the text box performance as required by your workload. ● If your account is less than 12 months old, you can use a t2.micro instance for free within certain usage limits. Instance Type Initial CPU Credits vCPUs Base Max CPU credit earned per performance credit hour (CPU balance utilization) t2.micro 30 6 1 10% 144 t2.small 30 12 1 20% 288 t2.medium 60 24 2 40% 578 t2.large 60 36 2 60% 864 19

  20. Please write the title in all capital letters CPU CREDITS Use bullet points to summarize information rather than writing long paragraphs in the text ● One CPU credit is equal to one vCPU running at 100% utilization for box one minute. ● When a T2 instance uses fewer CPU resources than its base performance level allows (such as when it is idle), the unused CPU credits (or the difference between what was earned and what was spent) are stored in the credit balance for up to 24 hours, building CPU credits for bursting. ● When a T2 instance requires more CPU resources than its base performance level allows, it uses credits from the CPU credit balance to burst up to 100% utilization. 20

  21. Please write the title in all capital letters HORROR STORY Use bullet points to summarize information rather than writing long paragraphs in the text ● WAL-E wal-fetch/wal-prefetch is terribly slow box ○ Prefetch spawns 8 worker processes (by default) and can burn all CPU Credits How we solved it: use “-p 0” to disable prefetch 21

  22. Please write the title in all capital letters MONITOR CPU CREDITS Use bullet points to t2.small summarize information rather than writing long paragraphs in the text box ● CPUCreditUsage metric indicates the number of CPU credits used during the measurement period ● CPUCreditBalance metric indicates the number of unused CPU credits a T2 instance has earned 22

  23. Please write the title in all capital letters RESERVED INSTANCES Use bullet points to summarize information rather than writing long paragraphs in the text box ● 1 year or 3 year contracts ● Significant discount compared to On-Demand instance pricing ● Capacity reservation ● Customers using both Reserved and On-Demand instances will have Reserved Instance rates applied first to minimize costs 23

  24. Please write the title in all capital letters RESERVED INSTANCES Use bullet points to summarize information rather than writing long m4.large, Standard 1-Year Term paragraphs in the text box Payment Upfront Monthly Effective Savings On-Demand Option Hourly Hourly No Upfront $0 $59.79 $0.082 32% Partial Upfront $342 $28.47 $0.078 35% $0.12 All Upfront $670 $0 $0.076 36% m4.large, Standard 3-Year Term No Upfront $0 $44.17 $0.061 50% Partial Upfront $736 $20.44 $0.056 53% $0.12 All Upfront $1383 $0 $0.053 56% * Frankfurt region 24

  25. Please write the title in all capital letters SPOT INSTANCES Use bullet points to summarize information rather than writing long paragraphs in the text box ● Bidding on “AWS overcapacity” ● Variable price point, save up to 90% vs. on-demand *Risks* Unavailability or loss of instance if outbid!!! 25

  26. Please write the title in all capital letters SPOT MARKET Use bullet points to summarize information rather than writing long paragraphs in the text box 26

  27. Please write the title in all capital letters USE CASES Everything that can fail or be unavailable for short duration ● Async processing ● Reporting ● CI ● Staging systems ● Testing of backups 27

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend