Presentation: How to Build an Exchange: Sub Millisecond Response Times and 24/7 Uptimes in the Cloud
Summary
Frank Yu, an engineering leader at Coinbase, outlines an engineering philosophy for building high-performance, resilient financial exchanges capable of sub-millisecond response times and 24/7 availability in the cloud. The approach emphasizes a single-threaded architecture for core logic, leveraging the Raft consensus algorithm for durability and consistency without traditional databases in the hot path. This design enables deterministic behavior, facilitating zero-downtime rolling deployments and precise bug reproduction through production log replay. The system prioritizes correctness, fairness, and availability, handling high transaction volumes (up to six figures per second) while maintaining P99 response times under one millisecond, even in cloud environments. Key elements include simple binary message encoding, pre-allocated memory to avoid garbage collection pauses, and CPU pinning to minimize OS interference.
Key takeaway
For software engineers building high-throughput, low-latency transactional systems, adopting a single-threaded, deterministic core logic with a consensus mechanism like Raft can significantly enhance reliability and performance. You should prioritize minimizing latency by co-locating critical components and avoiding memory allocations in the hot path. This architecture allows for rapid, zero-downtime deployments and simplifies debugging through log replay, crucial for maintaining 24/7 availability and meeting stringent financial infrastructure demands.
Key insights
Deterministic, single-threaded core logic with Raft consensus enables resilient, high-performance financial exchanges.
Principles
- Simplicity drives stability and performance.
- Determinism enables perfect bug reproduction and rolling deployments.
- Avoid blocking the hot path at all costs.
Method
Implement core business logic as a single-threaded, deterministic process. Use Raft for durability without a database in the hot path. Employ simple binary message encoding and pre-allocate memory to avoid GC pauses.
In practice
- Pin core logic threads to dedicated CPU cores.
- Locate Raft cluster nodes in the same availability zone for low latency.
- Decouple code deployment from behavior changes via input log requests.
Topics
- Financial Exchange Architecture
- Raft Consensus
- Single-Threaded Design
- Low-Latency Systems
- Deterministic Systems
Best for: Software Engineer, DevOps Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by InfoQ.