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

Transactions at Scale

Transactions at Scale

Posedio

May 30, 2022
Tweet

More Decks by Posedio

Other Decks in Programming

Transcript

  1. 2 Customer Balanc e Vourcers Used time Arbitrary Metadata ….

    99282 1231412 { “id” : “123”, } 12312421321L foobert Customers Vouchers List of Records Book virtual currency and vouchers for customers on a global scale Use Case
  2. Non-Functional Requirements Response time < 100 ms High Availability Zero

    Downtime 1000 req/s Mio Customers Strong Consistency Scalability
  3. 8 ACID Transactions & Database Constraints External Consistency Completed operation

    will be visible to all (globally) Globally consistent order of operation Atomic Writes Consistency, what?
  4. 9

  5. • SCALING CHALLENGES Vertical Scaling Read bottleneck? Add read replica!

    Write Bottleneck? Data Sharding ! Consistency? Scaling DBMS
  6. • SCALING CHALLENGES Vertical Scaling Read bottleneck? Add read replica!

    Write Bottleneck? Data Sharding ! Consistency? Scaling DBMS
  7. • SCALING CHALLENGES Vertical Scaling Read bottleneck? Add read replica!

    Horizontal Scaling Write Bottleneck? Data Sharding ! Consistency? Scaling DBMS
  8. 19

  9. 20 • Algorithm used to achieve consensus among a distributed

    set of computers that communicate in an asynchronous network • 2 phase commit protocol • Majority wins • Google implemented own version of PAXOS tailored to their high availability network! BUILDING BLOCKS II – TRUE TIME API (TT) [Andr ] Consensus
  10. 21 Concept of Real Time (wall clock) for global ordering

    BUILDING BLOCKS II – TRUE TIME API (TT) [Andr ] Method Returns TT.now() TTinterval:[earliest,latest] TT.after(t) true if t has definitely passed TT.before(t) true if t has definitely not arrived Order Bounded error interval (Tmin, Tmax) Using Atomic Oscillators and GPS Antennas on Racks to synchronize clock with data center (minimize clock skew < 1ms)
  11. 22 Google runs its own private global network only over

    Google-controlled routers and links three independent fibers connecting in each data center BUILDING BLOCKS III – THE NETWORK Network Limiting „Blast Radius“ for software configuration and updates A regional setup is defined to have a round trip time of 2ms
  12. 23 DISTRIBUTED MULTI VERSION KEY-VALUE STORE [JAMC] Replacement Driver ID

    first_name Second_name info updated Singer(1) „Sam“ „Smith“ <Bytes> 2019-10- 12T14:00:00 Singer(2) „Adele“ <Bytes> 2019-10- 18T15:00:00 Singer(3) „Britney“ „Spears“ <Bytes> 2019-11- 12T13:00:00 Singer(4) „Toni“ „Polster“ <Bytes> 2019-09- 12T14:00:00 Singer(5) „Marilyn“ „Manson“ <Bytes> 2018-01- 10T14:00:00 Span Server 1 Span Server 2 Span Server 3 Span Server 4 Span Server 5 [GOOG] Potential split boundary Real split boundary Internals
  13. 24 SQL and PostgreSQL Interface Client Libraries for many languages

    available (e.g. ORM Mapper, JDBC Drivers, Spring Data, etc.) Open Source Emulator for local testing Operate with IaC (e.g. Terraform, CNRMs, etc.) Auto Scaling of Spanner nodes based on node metrics Advanced Tracing Tools Well intergrated with other Google services, e.g. AutoML and BigQuery Auto Backup But How Developer Experience
  14. 26 Relational Models are not dead Cloud Spanner is a

    fully managed DBAS product Brings dynamical horizontal scalability to relational databases (build for the future) Affordable even for small businesses or startups (total cost of ownership) It has strong global consistency High peformant on OLTP workloads, Small, short-scoped and indexed lookups Very high Availability 99,999 in multi-region setup (4 9’s in single zone) Data Center Locations in the EU (GDPR) Enterprise Grade Security But How Takeaway