Infrastructure

UDP vs TCP for Receiving Shreds — Which Is Faster?

January 25, 2025AllenHark Team

When building high-performance Solana infrastructure, you'll often see providers offering UDP (User Datagram Protocol) or TCP (Transmission Control Protocol) connections. For Shreds, the choice is clear, but understanding why is crucial for optimizing your receiver.

The Protocol Showdown

FeatureTCPUDP
ConnectionConnection-oriented (Handshake)Connectionless (Fire-and-forget)
ReliabilityGuaranteed Delivery (Retries)No Guarantee (Best Effort)
OrderingGuaranteed OrderUnordered
SpeedSlower (Overhead)Fastest

Why Solana Uses UDP for Turbine

Solana's block propagation protocol, Turbine, is built on top of UDP.

  1. Speed is King: In a high-throughput blockchain, waiting for a TCP acknowledgment (ACK) for every packet would grind the network to a halt.
  2. Packet Loss Tolerance: If a few shreds are lost, Solana uses Erasure Coding (Reed-Solomon) to reconstruct the missing data from other packets. It doesn't need every single packet to arrive perfectly.

Receiving Shreds: Why You Should Use UDP

If you consume shreds via TCP, you are introducing artificial latency.

  • TCP Head-of-Line Blocking: If one shred packet is dropped on the internet, your TCP stack will pause all subsequent shreds until that one is retransmitted. You will fall behind the tip of the chain.
  • UDP Streaming: You receive packets as they arrive. If one is dropped, you skip it and keep processing the latest data. For a trading bot, freshness is more important than completeness.

AllenHark's Approach

At AllenHark, we provide native UDP streams for our Shreds service. We mirror the Turbine behavior, giving you the raw data exactly as the validators see it, without the latency penalty of TCP wrappers.

Connect via UDP today