Designing Cross-Region Data Consistency for a Fintech Platform
System DesignModel answerLast updated
Architect a multi-region data layer for a global payments platform that balances low-latency reads, strongly consistent money movement, and graceful regional failover.
Cross-Region Data Consistency for a Global Payments Platform
A fintech company offers a consumer payments product across three geographic zones: Europe, North America, and Asia-Pacific. Customers can check balances, send money, and make purchases from any device, anywhere in the world.
Your task
Design the data architecture that keeps account and transaction data consistent across all regions.
Requirements
- Reads (balance checks, transaction history, app launches) should be low-latency for users worldwide.
- Money movement must be correct: no funds can be spent twice.
- The system must continue operating if a region becomes unreachable or a network partition occurs.
- You should clearly state which operations require strong consistency and which can tolerate eventual consistency — and justify the split.
Topics to cover
- How data is replicated between regions: synchronous vs. asynchronous, single-leader vs. multi-leader.
- How cross-region writes — especially peer-to-peer transfers — are handled safely.
- How the system avoids duplicate processing and resolves conflicts.
- Operational concerns: failover, data reconciliation, audit trails, and observability.
Hints
Hint 1
Start by classifying your data: account balances need a different consistency guarantee than user profile preferences. State this split early and justify it before talking about any specific technology.
Hint 2
Multi-leader replication feels attractive for global low-latency writes, but think through what happens when two regions simultaneously approve a spend against the same balance. What invariant breaks, and why can't you repair it after the fact?
Hint 3
For cross-region transfers where neither region owns both accounts, two-phase commit across a WAN is fragile. Think about how a saga pattern with a hold or reservation on the sender's side lets you decompose the operation into individually atomic local steps.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Approach
The central trap in this problem is treating consistency as a single dial to set globally. Strong candidates resist that. The right move is to classify data by correctness requirements, apply strong consistency only where the business invariant demands it, and let everything else replicate asynchronously.
1. Clarify scale and constraints first
Before drawing boxes, ask:
- Users and geography: ~50M customers, roughly 65% Europe, 25% North America, 10% APAC. Most transact predominantly in their home region.
- Write throughput: ~8,000 money-movement TPS average, ~25,000 at peak (shopping events, payroll days).
- Read throughput: reads are ~10× writes — 80k–250k QPS. The common case is a user opening the app to check a balance.
- Latency targets: card authorization must complete in under 150 ms inside the platform; reads should be under 50 ms p99 from anywhere.
- Durability: RPO = 0 for committed ledger entries within a region; cross-region RPO of a few seconds is acceptable with reconciliation. RTO under 5 minutes for a full regional failover.
- Regulation: GDPR and local banking licenses may require that EU customer data is mastered in the EU. This shapes the architecture significantly.
2. Classify data by consistency requirement
| Data type | Model | Rationale |
|---|---|---|
| Balances, ledger entries, holds | Linearizable per account | Prevents double-spend |
| Idempotency keys | Strong, co-located with ledger | Makes retries safe |
| Transaction history views | Eventual (seconds) | Derived from ledger; staleness is fine |
| User profile, preferences, KYC docs | Single-leader, async replicas | Writes are rare |
| Session tokens, auth state | Regional, re-issuable | Loss is cheap |
| Fraud signals, analytics features | Eventual | Read-optimized copies |
The sentence worth saying out loud: strong consistency is scoped to an account, not to the globe. The invariant balance >= 0 must hold in one authoritative place; it does not need to hold simultaneously in every data center on Earth.
3. Architecture overview
Every account has a home_region. A small, globally replicated directory maps account_id → home_region. This directory changes rarely (only when a customer moves countries), so it can be cached aggressively at every edge.
Within the home region: the ledger replicates synchronously across three availability zones using a Raft or Paxos quorum. This gives RPO = 0 if one AZ fails, at a cost of roughly 2–5 ms of added commit latency — well within budget.
Across regions: replication is asynchronous via CDC or a transactional outbox feeding into a message broker (e.g., Kafka with cross-region mirroring). Remote regions hold read replicas and a warm standby of the ledger.
Writes are always routed to the account's home region. A European customer travelling in Singapore will see ~180 ms round-trip latency on a transfer. That is acceptable: writes are infrequent, and users tolerate slightly higher latency for money movement.
Reads are served locally from replicas. To handle read-your-own-writes, the client receives the commit LSN after every write. Subsequent reads include that LSN; if the local replica has not caught up, the request is proxied to the home region.
Why not multi-leader for balances?
Two regions can each approve a €100 payment against the same €100 balance. There is no merge strategy that recovers from this: balance >= 0 is not a conflict you can resolve with last-writer-wins or a CRDT, because the invariant was already violated. Single-writer ownership per account is the correct default.
Global synchronous consensus (e.g., Spanner across continents) is correct but adds 100–300 ms to every write and halts writes if a majority of regions are unreachable. It is appropriate only for the small, rarely-written global directory.
4. Data model
Use an append-only, double-entry ledger:
accounts(account_id, home_region, currency, status, version)
-- Immutable: rows are never updated or deleted
ledger_entries(entry_id, txn_id, account_id, amount_minor BIGINT,
direction, created_at)
holds(hold_id, account_id, amount_minor, status, expires_at, txn_id)
-- Derived, updated atomically with the ledger entry
balances(account_id PK, available, ledger_total, version)
idempotency(key PK, request_hash, result, created_at)
outbox(id, aggregate_id, event_type, payload, published_at)
Amounts are stored as integer minor units (cents, pence) — never floats. Every transfer's ledger entries must net to zero. The balance update, ledger entries, idempotency record, and outbox row all commit in one local ACID transaction.
5. Cross-region transfers: saga with reservations
Say Alice is EU-homed and Bob is US-homed. No single database owns both accounts, so 2PC across a WAN is the wrong tool — it couples availability and adds latency. Instead, use a saga:
- Client sends
POST /transferswith anIdempotency-Key. - EU ledger (one local transaction): check the idempotency key; debit Alice into an internal clearing account (or place a hold); write a
TransferInitiatedevent to the outbox. - Outbox relay delivers the event to the US with at-least-once semantics.
- US ledger (one local transaction): deduplicate on
txn_id; credit Bob from the US clearing account; emitTransferCredited. - EU settlement: EU consumes
TransferCreditedand marks the transfer complete. - Failure path: if Bob's account is invalid, the US emits
TransferRejected. The EU runs a compensating credit back to Alice — a new ledger entry, not a deletion.
There is no double-spend because Alice's funds are removed from her available balance atomically and atomically only once, in the one place that owns her account. Every downstream step is idempotent on txn_id.
Card payments follow the same pattern: authorization creates a hold; clearing and settlement messages from the card scheme later convert the hold into final ledger entries, keyed by the scheme's transaction reference for idempotency.
6. Failures and partition handling
- Single AZ failure: quorum commit handles it transparently.
- Full regional partition: home regions continue operating independently. Remote reads degrade gracefully — replicas serve slightly stale data and surface a
data_as_oftimestamp to clients. Cross-region writes (transfers between differently-homed accounts) queue in the outbox and drain when the partition heals. - Regional failover: promote the standby replica in another region to leader, update the global directory, and replay any unacknowledged outbox events. Target RTO < 5 minutes. The key is that the outbox is durable and ordered, so no committed transaction is lost.
7. Operational concerns
- Reconciliation: the sum of all clearing account balances across regions should tend toward zero. A nightly reconciliation job flags any non-zero residual for manual review.
- Audit trail: ledger entries are immutable and timestamped. Every state change is traceable to a
txn_idand anentry_id. - Observability: track replication lag per region as a first-class SLO metric. Alert if lag exceeds, say, 10 seconds. Track outbox queue depth to catch delivery failures early.
- Idempotency TTL: retain idempotency keys for at least 24 hours; 7 days is a safer default for payment workloads.
Common mistakes to avoid
- Applying the same consistency model to everything — it is unnecessary and expensive.
- Reaching for multi-leader replication for financial balances without thinking through merge conflicts.
- Using floats for monetary amounts.
- Conflating durability within a region (RPO = 0 is achievable) with durability across regions (always involves a replication lag window).
- Designing for the happy path without detailing what happens when a cross-region message is delayed or delivered twice.