Solving Everyday Data Problems with FoundationDB
Ryan Worl (ryantworl@gmail.com) Consultant
Solving Everyday Data Problems with FoundationDB Ryan Worl - - PowerPoint PPT Presentation
Solving Everyday Data Problems with FoundationDB Ryan Worl (ryantworl@gmail.com) Consultant About Me Independent software engineer Todays real example is from ClickFunnels > 70,000 customers, > 1.8B of payments processed
Ryan Worl (ryantworl@gmail.com) Consultant
1 Coordinators elect & heartbeat Cluster Controller (Paxos)
Coordinators Cluster Controller
Coordinators store core cluster state, used like ZooKeeper All processes register themselves with the Cluster Controller
2 Cluster Controller (CC) assigns Master Role
Master
3 CC assigns TLog, Proxy, Resolver, and Storage Roles
Proxy
3 CC assigns TLog, Proxy, Resolver, and Storage Roles
Resolver
3 CC assigns TLog, Proxy, Resolver, and Storage Roles
TLog
3 CC assigns TLog, Proxy, Resolver, and Storage Roles
Storage
4 On Start: Your App Connects and Asks CC For Topology
YOUR APP
4 Client Library Asks a Proxy for Key Range to Storage Mapping
YOUR APP
4 Data Distribution Runs On Master, Key Map Stored in Database
FF
YOUR APP
5 Start a Transaction: Ask Master for Latest Version
YOUR APP
5 Start a Transaction: Ask Master for Latest Version (Batched)
YOUR APP 100
6 Perform Reads at Read Version Directly to Storage
YOUR APP
00 55 AF FF
@ryanworl
7 Buffer Writes Locally Until Commit
00 55 AF FF
YOUR APP
00 55 AF FF
8 Commit Part 1: Send R/W Conflict Ranges + Mutations to Proxy
YOUR APP
00 55 AF FF 00 55 AF FF
8 Part 2: Proxy Batches Txns to Master To Get Commit Version
A H T Z YOUR APP
00 55 AF FF 00 55 AF FF
@ryanworl
8 Part 3: Send Conflict Ranges to Resolvers for Conflict Detection
A H T Z YOUR APP
00 55 AF FF 00 55 AF FF
8 Part 4: If Isolation Passes, Send Mutations to Relevant TLogs
A H T Z YOUR APP
00 55 AF FF 00 55 AF FF
8 Part 5: (Async) Storages Pull Mutations from Their Buddy TLogs
A H T Z YOUR APP
00 55 AF FF 00 55 AF FF
9 Failure Detection: Cluster Controller Heartbeats
A H T Z YOUR APP
00 55 AF FF 00 55 AF FF
10
Initiate Recovery on Any Transaction Role Failure
A H T Z YOUR APP
00 55 AF FF 00 55 AF FF
11
Cluster Controller Failure: Coordinators Elect New One
A H T Z YOUR APP
00 55 AF FF 00 55 AF FF
12
Storage Server Failure: No Recovery, Repair in Background
A H T Z YOUR APP
00 55 AF FF 00 55 AF FF
@ryanworl
@ryanworl
https://twitter.com/coda
@ryanworl
Service A Service B Service C
@ryanworl
@ryanworl
@ryanworl
@ryanworl
@ryanworl
@ryanworl
@ryanworl
@ryanworl
[“binlog”, VersionStamp] => MySQL Binlog as JSON
@ryanworl
[“bitmaps”, rule_id, chunk_id] => Bitmap Chunk
[“bitmaps”, rule_1, chunk_1] => Chunk [“bitmaps”, rule_2, chunk_1] => Chunk [“bitmaps”, rule_1, chunk_N] => Chunk [“bitmaps”, rule_2, chunk_N] => Chunk
@ryanworl
@ryanworl
https://en.wikipedia.org/wiki/Amdahl%27s_law
https://www.activesphere.com/blog/2018/08/05/high-contention-allocator
https://www.activesphere.com/blog/2018/08/05/high-contention-allocator
@ryanworl