designing and launching the next generation database
play

Designing and launching the next-generation database system: from - PowerPoint PPT Presentation

April 25, 2018 Designing and launching the next-generation database system: from whiteboard to production Guido Iaquinti $whoami Guido Iaquinti Operations Engineer in Dublin Member of the storage team No previous DBA experience


  1. April 25, 2018 Designing and launching the next-generation database system: from whiteboard to production Guido Iaquinti

  2. $whoami Guido Iaquinti Operations Engineer in Dublin ● Member of the storage team ● No previous DBA experience ● github.com/guidoiaquinti twitter.com/guidoiaquinti

  3. $whoami Guido Iaquinti Operations Engineer in Dublin ● Member of the storage team ● No previous DBA experience ● github.com/guidoiaquinti twitter.com/guidoiaquinti

  4. Agenda 1. Slack’s current database system 2. Project Xarding 3. Next-gen database system 4. Breakout discovery 5. Conclusions

  5. Slack’s current database system

  6. What is Slack today? ● 9+ million weekly active users ● 4+ million simultaneously connected ● Average 10+ hours/ weekday connected ● $200M+ in annual recurring revenue ● 1000+ employees across 7 offices

  7. What is Slack today? 20+ billion database queries per day 170+ Gbps (database layer network throughput at peak) 2.1 PB of database storage Thousands of database servers

  8. What is Slack today? ● Evolving from a LAMP stack ● MySQL as primary storage system: single source of truth ● Custom sharding topology: allow us to scale horizontally—and sometimes vertically

  9. Database clusters

  10. Database clusters

  11. Database clusters

  12. Database clusters

  13. Database infrastructure ● MySQL on AWS EC2 instances ● SSD-based instance storage (no EBS) ● Each cluster is deployed across multiple AZ ● MySQL 5.6 (Percona)

  14. MySQL Master-Master • Each cluster is a MySQL pair deployed in Master-Master configuration: using async replication each master is also a slave of the other… master • Designed to prefer availability over consistency • Unique IDs generated by an external service : we can’t use IDs generated by MySQL, we need to have primary keys globally unique • Which master should the application use? mostly by primary key: odd keys on side A, even keys on side B

  15. Current architecture

  16. Current architecture ● Availability not impacted if a master goes down ● We can horizontally scale by splitting “hot” pairs ● With the asynchronous M-M setup writes are as fast as the node can provide ● “Online” schema changes

  17. Current architecture ● A team can’t grow beyond a single MySQL pair ● Low resource usage: our bottleneck is the SQL replication ● There’s no value to adding read replicas ● Requires Statement Based Replication ● Operational overhead: manual resolution of inconsistent entries

  18. Project Xarding

  19. Requirements ● Sharding must be more granular than by an entire team ● Minimal changes to application code ● Decouple infrastructure and code ● Operator overhead / # servers -> O(1) ● Maintenance is hidden from the end user: no user-visible downtime

  20. itess Open source project by YouTube (Google) ● Built on top of MySQL replication and InnoDB ● Uses sharding best practices: shared-nothing & consistent hashing ●

  21. Proposal document

  22. The itess team is built

  23. Next-gen database system

  24. Q1 Project Planning February Vitess cluster up and running in DEV ○ March Vitess cluster up and running in PROD ○ Develop double read/write experiment ○ Planning for larger table migration ○ April Ship double read/write experiment in PROD ○ Conclude Vitess go/no-go & plan the rest of 2017 ○

  25. MySQL legacy VS MySQL new ● Topology : master-master VS master-slave ● Replication : full async VS semi-sync (not strictly required) ● Binlog : replication position VS global transaction id

  26. First steps ● Build : internal public fork synced upstream. Codebase tested and build by Jenkins, artifacts uploaded to S3 ● Config : managed by Chef ● Deploy : on EC2 instances (no containers) ● Automate : work in progress, still trying to figure out what to automate and how Vitess works... ● Monitoring : work in progress, mostly reactive

  27. Bleeding edge technology

  28. Bleeding edge technology

  29. Bleeding edge technology

  30. Bleeding edge technology

  31. Bleeding edge technology

  32. Iterate over the first steps ● Infrastructure as code : manage AWS resources via Terraform ● Service discovery & load balancing: via AWS ELB ● Metrics: custom exporter for expvar -> statsd ● Logging: make it working with our ingestion pipeline

  33. Change of plans

  34. Change of plans

  35. Change of plans

  36. Change of plans Fact: i3 uses NMVe storage ● Kernel support: was added on 3.3 but AWS suggests to use >=4.4 ● OS: Ubuntu 14.04 ships kernel 3.x (and we don’t like to backport) ● Decision: deploy the new system on Ubuntu 16.04 ●

  37. Add i3 support in Slack Vitess is the first service at Slack to use AWS i3 and Ubuntu 16.04 required to add support to our provisioning system ● required to add support to our config management system ● validate setup and fix any security regression ● validate setup and fix any performance regression ●

  38. i3 another bleeding edge component

  39. i3 another bleeding edge component (storage edition)

  40. i3 another bleeding edge component (storage edition)

  41. i3 another bleeding edge component

  42. i3 another bleeding edge component (network edition)

  43. i3 another bleeding edge component Theory 1: is it 16.04 vs 14.04? ● Theory 2: is it i3/r4 specific? ● Theory 3: is it the ENA interface driver? ● Theory 4: look at rto! ● Theory 5: tcp_mem is smaller on 16.04 than 14.04 ● (network edition)

  44. i3 another bleeding edge component (network edition)

  45. i3 another bleeding edge component (network edition)

  46. i3 another bleeding edge component (network edition)

  47. vs engineer

  48. engineer MySQL 5.6 -> MySQL 5.7 ● Non strict mode -> strict mode ● SBR (Statement Based Replication) -> RBR (Row Based Replication) ● PHP mysqli driver -> HHVM async MySQL driver ● Upgrade

  49. Changelog AWS instance: i2 -> i3 ● OS: Ubuntu 14.04 -> Ubuntu 16.04 ● MySQL version: 5.6 -> 5.7 ● MySQL Topology : master-master VS master-slave ● MySQL Replication : full async VS semi-sync ● MySQL Binlog : replication position VS global transaction id ● MySQL Strict mode: OFF -> ON ● MySQL Binlog format: SBR -> RBR ● App driver: PHP mysqli driver -> HHVM async MySQL driver ● App logic: r/w on master -> read on replicas ● Metric collection: statsd -> Prometheus ●

  50. End of Q1 (Feb-Apr) Clusters up and running: in DEV and PROD ● Service discovery & load balancing: via AWS ELB ● Manual processes designed, documented, and tested for: ● schema changes ○ shard split ○ master failover/election ○ Backup & restore: automated, tested and documented ●

  51. End of Q1 (Feb-Apr) Clusters up and running: in DEV and PROD ● Service discovery & load balancing: via AWS ELB ● Manual processes designed, documented, and tested for: ● schema changes ○ shard split ○ master failover/election ○ Backup & restore: automated, tested and documented ●

  52. The itess team is growing

  53. Q2 Project Planning (May-Jul)

  54. Q2 Project Planning (May-Jul) Security Complete full security review ● Ensure all database accounts and grants are managed automatically ● Ensure all credentials are distributed via Vault ● Durability Simulate and verify application and customer impact for the loss of ● each component and service dependency Ensure backups are stored in a locked-down backup account and ● replicated cross-region

  55. Q2 Project Planning (May-Jul) Availability Ensure 100% of master failover/recovery are automatically handled ● Simulate and verify the ability auto recover from the loss of AZs ● Ensure we get alerts for any error conditions that could affect ● availability Operational tooling Data warehouse ingestion ● Develop procedure and runbooks for troubleshooting hotspots, badly ● behaving clients or servers

  56. mysql-grants

  57. mysql-grants Internal CLI tool to manage MySQL accounts & permissions Input config file with user and policy definitions ● credentials file ● Output SQL to execute ● directly execute SQL against --target if the --execute flag is passed ●

  58. mysql-grants Uses “AWS IAM” concepts in MySQL ● Users ○ Policies ○ Privileges ○ Allow whitelist/blacklist policies ● Allow global, database or table scope ● Exposes API bindings ●

  59. mysql-grants Example config

  60. mysql-grants Example whitelist/blacklist policy

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