Skip to content

Tejas242/distributed-broadcast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distributed Broadcast Node (Go)

A high-throughput, eventually consistent gossip protocol implementation. Designed to pass the Maelstrom distributed systems test suite with strict latency and validity guarantees.

Design & Architecture

This node implements a fan-out architecture optimized for high-latency, partition-prone networks.

  • Temporal Batching: Implements a Nagle-like aggregation strategy. Messages are buffered and flushed via a 15ms ticker, reducing RPC overhead and network IOPS by ~90% compared to naive forwarding.
  • Asynchronous Pipelining: Decouples message ingestion from propagation. Inbound broadcasts are immediately committed to local state (sync.RWMutex), while outbound propagation is handled by dedicated, non-blocking neighbor workers.
  • Backpressure & Flow Control: Utilizes per-neighbor semaphores (buffered channels, cap=10) to limit inflight RPCs. This prevents head-of-line blocking and manages resource saturation during partition recovery.
  • Reliability: Ensures at-least-once delivery via explicit RPC acknowledgments. Failed or timed-out batches are automatically re-queued for retry.

Benchmarks

Performance was evaluated using a 25-node cluster arranged in a 4-ary tree topology, simulating widespread network latency.

Test Configuration:

  • Nodes: 25
  • Topology: Tree4
  • Network Latency: 100ms (simulated)
  • Throughput: 100 messages/sec
  • Duration: 20s

Results:

Metric Result
Availability 100%
Consistency Strong Eventual
p50 Latency 385ms
p99 Latency 530ms
Net Overhead ~13.3 msgs/op

Maelstrom Serve

latency quantiles

latency raw

rate

Usage

Build

go build -o node main.go

Reproduction Requires the Maelstrom binary.

./maelstrom test -w broadcast \
    --bin ./node \
    --node-count 25 \
    --topology tree4 \
    --time-limit 20 \
    --rate 100 \
    --latency 100

About

A high-throughput, eventually consistent gossip protocol implementation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages