The routing constraints are where I got turned around.
Start by clarifying requirements and scale, then propose a high-level architecture with an ingestion layer, a routing layer that enforces the two constraints, and a processing layer with independently scalable algorithm instances. Emphasize how partitioning and consistent hashing solve the routing constraints while maintaining high throughput and availability, and discuss trade-offs around ordering, fault tolerance, and exactly-once processing.
Pro tip: Explicitly call out that the two routing constraints are essentially partitioning requirements: trader-based partitioning for algorithm instances and exchange-based partitioning for dedicated instances. Mention that you'd use a consistent hashing ring with virtual nodes to handle scaling and rebalancing without violating the constraints.
Ask about expected throughput (orders per second), latency requirements, number of exchanges, traders, and algorithm types. Confirm availability and consistency needs, and whether ordering per trader/exchange is required.
Propose an ingestion layer (e.g., API gateway or message queue) that receives orders from exchanges, a routing layer that directs orders to the correct algorithm instance based on trader and exchange, and a processing layer where algorithm instances consume and process orders asynchronously, emitting events to a downstream event bus.
Use consistent hashing to partition orders by trader ID for algorithm instances, ensuring all orders from a trader go to the same instance. For exchange-dedicated instances, route all orders from an exchange to a single instance, potentially using a separate topic or queue per exchange.
Scale each algorithm type independently by adding instances and rebalancing partitions. Ensure high availability through replication, leader election, and fault-tolerant message queues. Discuss handling of hot partitions and rebalancing without violating routing constraints.
Discuss trade-offs between consistency and availability, ordering guarantees, and exactly-once vs at-least-once processing. Describe failure scenarios (e.g., instance crash) and recovery strategies, such as replaying from a durable log.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.