Arbitrate Redundant A and B Multicast Feeds With Gap Detection
Last updated: November 29, 2026
Quick Overview
Exchanges publish the same sequenced packets on two multicast lines. Write an arbiter that delivers each sequence number exactly once and in order, drops duplicates from the slower line, buffers out-of-order packets, and declares a gap for recovery when a hole cannot be filled within a buffer limit.
Chicago Trading Company
November 29, 20260
0
0 solved
Exchanges publish the same sequenced packets on two multicast lines. Write an arbiter that delivers each sequence number exactly once and in order, drops duplicates from the slower line, buffers out-of-order packets, and declares a gap for recovery when a hole cannot be filled within a buffer limit.
Feed handler engineers at a low-latency options firm deal with packet loss on UDP multicast every day, and A/B line arbitration is the first stage of every handler. The interviewer is checking sequencing invariants and what you do when data is truly lost, since a silently corrupted book is worse than a short outage.
What the Interviewer Expects
- Tracks the next expected sequence and delivers strictly in order
- Discards duplicates whether they are behind or already buffered
- Buffers packets ahead of the hole and flushes when it fills
- Bounds memory and declares a gap rather than waiting forever
- Explains that a declared gap must invalidate affected books until recovery
- Discusses time-based versus count-based gap timeouts
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- Would you rather use a timeout or a buffer size to declare a gap, and how would you pick the value?
- After a gap, how do you recover: retransmission request, snapshot channel, or both?
- How would you implement the buffer in C++ without per-packet allocation?
- Packets carry many messages and the sequence number counts messages, not packets. What changes?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Each packet has (line, seq, payload). Both lines carry identical sequences, either can drop or reorder packets, and either may be faster at any moment. Output: in-order (seq, payload) with no dupl...
High-Level Design
Keep next_seq and a buffer keyed by sequence for packets that arrived early. A packet with seq < next_seq or already buffered is a duplicate from the other line. After inserting, flush while `next...