系统 Multicast 与 Unicast
Systems Multicast Vs Unicast
题目详情
某大型交易所向 500 家订阅者分发实时行情数据(订单簿更新、成交报告等)。这些订阅者是位于交易所同机房的高频交易公司。交易所需要在单播和 multicast 协议之间选择数据分发方案。
任务:分析 multicast 比 unicast 更网络高效的原因。单播需要 500 次独立传输,multicast 仅需一次发送让网络设备复制。计算两种方案的总带宽消耗和延迟差异,并说明 multicast 对高频交易行情分发的适用性。
英文原题
A major exchange is disseminating real-time market data (order book updates, trade executions, etc.) to 500 subscribers. These subscribers are high-frequency trading firms located in a data center collocated with the exchange. The exchange is deciding between using a unicast or multicast protocol for distributing this data.
Why is multicast generally considered more network-efficient than unicast in this scenario?
解析
问题分析
A major exchange is disseminating real-time market data (order book updates, trade executions, etc.) to 500 subscribers. These subscribers are high-frequency trading firms located in a data center collocated with the exchange. The exchange is deciding between using a unicast or multicast protocol fo
解法
根据题目要求实现相应功能。核心逻辑需要:
// 核心数据结构和方法——根据题目 API 约定实现
// 1. 确定状态表示——选择支持所需操作的数据结构
// 2. 实现核心算法——确保 O(·) 时间复杂度和正确性
// 3. 处理边界条件——空输入、极值参数、并发访问验证
用具体输入验证:构造已知输入的测试用例,确认输出匹配预期结果。
复杂度与边界
- 时间复杂度:取决于选用的算法
- 空间复杂度:取决于数据规模
- 关键边界条件:空输入、极值参数、并发场景下的正确性保证
英文解析
Analysis
A major exchange is disseminating real-time market data to 500 subscribers in a co-located data center. With unicast, the exchange sends 500 copies of each message (500x bandwidth). With multicast, the exchange sends one copy and network switches replicate it500 copies. Multicast reduces exchange outbound bandwidth by 500x and ensures all subscribers receive data simultaneously (same microsecond). For market data where timeliness and simultaneous delivery matter, multicast is essential.
Solution
struct DeliveryAnalysis {
int copies_sent;
double bandwidth_mbps;
double max_delay_us;
};;
DeliveryAnalysis unicast(int subscribers, int msg_rate, int msg_bytes) {
return {subscribers * msg_rate, // Total messages sent
subscribers * msg_rate * msg_bytes * 8 / 1e6, // Bandwidth
subscribers * 5.0}; // Last subscriber receives ~5us later
}
DeliveryAnalysis multicast(int subscribers, int msg_rate, int msg_bytes) {
return {msg_rate, // One copy per message
msg_rate * msg_bytes * 8 / 1e6, // Bandwidth
1.0}; // All subscribers receive simultaneously
}Complexity & Edge Cases
- Time complexity: O(1) per calculation
- Space complexity: O(1)
- Edge cases: (1) Multicast requires IGMP support on switches (2) Packet loss affects all subscribers simultaneously (3) Unicast enables per-subscriber flow control
Verification
Benchmark bandwidth usage for 500 subscribers at 100K msgs/sec. Verify multicast uses 1/500th the exchange outbound bandwidth. Measure delivery time variance across subscribers.
Key Considerations
Multicast is the standard for exchange market data feeds (CME, NASDAQ, Eurex). The 500x bandwidth savings and simultaneous delivery are critical - all co-located firms must see the same data at the same time for fair market access. Unicast would require the exchange to send 500 copies per tick, consuming massive bandwidth and introducing delivery skew where the last subscriber receives data microseconds after the first.