Design a Communication-Efficient Distributed Mode Aggregation
Compute one exact deterministic mode across ten partitioned workers while minimizing transmitted value/count data.
Problem statement
For this exercise, assume one immutable batch of 1,000 signed 64-bit integer values is split into disjoint partitions across exactly 10 workers. A coordinator must return the exact mode; when several values have the same maximum frequency, it returns the smallest value.
Minimize the bytes of value/count payload sent between workers and the coordinator, and report both payload bytes and protocol round trips. All ten partitions must contribute before a run can succeed; an incomplete run must return a retryable failure rather than an estimate.
Design the job contract, aggregation protocol, state ownership, and communication trade-offs.
What to build
- Start an aggregation run against one immutable manifest containing exactly ten disjoint worker partitions.
- Return the exact globally most frequent value and its count, using the smallest value to break frequency ties.
- Expose pending, succeeded, and retryable-failure outcomes without publishing a result from an incomplete partition set.
- Report the value/count payload bytes and round trips used by the completed aggregation protocol.
At scale
- Each run contains exactly 1,000 signed 64-bit integers split across 10 disjoint worker partitions.
- Each worker can hold and scan its own partition in memory, but raw values should not be shipped when an exact smaller representation is available.
- The primary optimization is total transmitted value/count payload bytes; round trips are a separately reported secondary cost.
- Success requires contributions bound to all 10 manifest partitions; missing or mismatched contributions make the run retryable rather than approximate.