← Meta Interview Insights

Meta·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
May 2026

Summary

Meta system design round for a software engineer role. The question was a deep dive into a two-phase money transfer system, which sounds manageable until you realize how many edge cases they actually want you to address.

Questions Asked (1)

Q1

Design and implement a two-phase money transfer system where funds are first held on the source account and then either captured or released. The system needs transfer creation with a hold, acceptance by the target, and cancellation by either party. Walk through balance semantics, state transitions, data structures, authorization, idempotency, atomicity, expiration, failure recovery, and complexity.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

This one sprawled way more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then model the transfer as a state machine with explicit states (PENDING, ACCEPTED, CANCELLED, EXPIRED) and balance semantics (available vs. held). Walk through the full lifecycle: creation with hold, acceptance/cancellation, expiration, and failure recovery, emphasizing idempotency, atomicity, and authorization at each step.

Pro tip: Treat the hold as a first-class entity with its own lifecycle and idempotency key, and use a ledger-based approach for auditability and consistency. Explicitly discuss how you'd handle race conditions (e.g., double-spend, concurrent accept/cancel) using optimistic locking or serializable transactions.

1. Clarify Requirements and Scale

Ask about expected throughput, latency, consistency requirements, and failure tolerance. Confirm whether transfers are between users, accounts, or currencies, and whether partial captures are needed.

2. Define State Machine and Balance Semantics

Enumerate states (e.g., PENDING, ACCEPTED, CANCELLED, EXPIRED) and transitions. Explain how balances are affected: available balance decreases on hold, held balance increases; on capture, held decreases and total decreases; on release, held decreases and available increases.

3. Design Data Model and APIs

Propose tables/collections for transfers, holds, and ledger entries. Define APIs for create, accept, cancel, and expire, including idempotency keys and authorization checks.

4. Address Atomicity, Idempotency, and Concurrency

Explain how to use transactions or two-phase commit to atomically update balances and transfer state. Describe idempotency via unique request IDs and how to handle concurrent accept/cancel with locking or versioning.

5. Handle Expiration, Failure Recovery, and Complexity

Outline a background job or TTL mechanism for expiration, and recovery from crashes using write-ahead logs or event sourcing. Analyze time and space complexity of core operations.

Key Points to Mention

  • Balance semantics: distinguish available vs. held balance, and ensure total balance is conserved.
  • State transitions: define allowed transitions and enforce them atomically to prevent invalid states.
  • Idempotency: use idempotency keys for all mutating operations to safely retry without side effects.
  • Atomicity: use database transactions or distributed transactions to update transfer state and balances atomically.
  • Authorization: verify that only the source can create/cancel, only the target can accept, and both can cancel per policy.
  • Expiration and failure recovery: implement TTL-based expiration and crash recovery via durable logs or periodic reconciliation.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.