Home / Learn / AI Networking / What Is Packet Spraying?

On this pageMany pathsThe conventional methodWhy that fails for AIHow spraying worksTwo places to do itThe catch: reorderingDealing with reorderingIntermediate approachesBenefitsCostsSpraying and congestion control togetherWhere it is usedImplementation in hardwareCommon questionsRelated guides

What Is Packet Spraying?

Packet spraying sends the packets of a single flow across many network paths at once, instead of keeping the whole flow on one path. A data center network has many equal routes between any two servers. Spraying uses all of them for every flow, which spreads load evenly and makes full use of the network’s capacity. AI networks adopt it because their traffic consists of a few very large flows, which conventional load balancing distributes badly.

Many paths

Modern data center networks are built so that there are numerous equivalent paths between any two endpoints. A packet travelling from one server to another could go through any of several switches at each tier.

Using those paths well is the job of load balancing.

The conventional method

The standard technique is called equal-cost multipath, or ECMP. A switch computes a hash of certain fields in each packet’s header, such as addresses and port numbers, and uses the result to pick a path.

All packets of one flow have the same header fields, so they produce the same hash and take the same path. This is deliberate. It keeps a flow’s packets in order, which older transport protocols depend on.

With thousands of small flows, the hashing spreads them fairly evenly.

Why that fails for AI

AI training traffic has a different shape. There are relatively few flows, and each is enormous.

  • Collisions. With few flows, chance alone may put two or three on the same link while other links stand empty. A link carrying two large flows is overloaded.
  • No correction. Once a flow is assigned a path, it stays there.
  • Wasted capacity. Networks built at great expense run with some links congested and others idle.
  • Tail latency. A flow unlucky enough to share a link finishes late, and a training step waits for the slowest flow.

Engineers describe AI traffic as having low entropy: there is too little variety among flows for hashing to work well.

How spraying works

Spraying makes the decision per packet instead of per flow. Successive packets of the same flow go down different paths. Over any short period, a flow’s traffic is distributed across all of them.

Load evens out regardless of how few flows there are. A single huge flow uses the whole network instead of one route through it.

Two places to do it

In the switch. The switch chooses an output port for each packet, typically the least loaded one, or simply in rotation. This needs switches that support it.

In the sender. The sending network adapter changes a field in each packet’s header, often called an entropy value. Standard switches hash that field as usual, and since its value varies packet by packet, the packets take different paths. The sender controls the spread without needing any special switch feature.

The sender-based method has a further benefit. The sender receives feedback about each packet and can learn which values correspond to congested or failed paths, then avoid them.

The catch: reordering

Packets taking different paths arrive in a different order from the one they were sent in.

Traditional transports cope badly with that.

  • TCP may interpret out-of-order arrival as loss and slow down.
  • The RDMA transport used over Ethernet has classically expected packets in order and treats a gap as a loss, triggering retransmission.

So spraying requires either reordering packets before they reach the transport or a transport that does not need order.

Dealing with reordering

Reorder at the receiver. The receiving adapter holds out-of-order packets briefly and delivers them in sequence. Some current products pair switch-based spraying with adapters that do this.

A transport designed for it. Each packet carries the information needed to place its data directly at the right position in the destination’s memory, whenever it arrives. Order becomes irrelevant. The receiver simply tracks which packets have arrived. This is the approach taken in the Ultra Ethernet transport.

Intermediate approaches

Between one path per flow and one path per packet, there are in-between options.

MethodUnit of load balancingReorderingEvenness
ECMPFlowNonePoor with few large flows
Flowlet switchingBursts of packets separated by gapsRareBetter
Flow splitting into sub-flowsSeveral sub-flows per flowWithin limitsBetter
Adaptive routingFlow or packet, chosen by switch according to loadDependsGood
Packet sprayingPacketCommonBest

Flowlet switching relies on natural pauses in a flow. If the gap between two bursts is longer than the difference in path delays, the second burst can take a new path without overtaking the first. AI flows, which are continuous, offer few such gaps.

Benefits

  • Even load across all paths.
  • Full use of network capacity.
  • Lower and more consistent completion times, since no flow is stuck on a congested link.
  • Resilience. When a link fails or degrades, only a fraction of each flow is affected, and the sender can steer away quickly.
  • Less dependence on traffic variety.

Costs

  • Reordering must be handled, with logic and memory in the receiver.
  • Loss detection is harder. A gap in the sequence might mean a packet is lost or merely late on a slower path. Techniques such as packet trimming help by signalling a loss explicitly.
  • Congestion control must account for many paths.
  • Asymmetry. If paths differ in speed or capacity, simple even spraying sends too much to the slower ones. Adaptive spraying compensates.
  • Hardware support in adapters, and for some methods in switches.

Spraying and congestion control together

When a flow uses one path, the only response to congestion is to slow down. With spraying, there is a second option: send less on the congested path and more on the others.

A sender that tracks feedback per path can shift load within microseconds. It reduces its total rate only if the destination itself or the network as a whole is overloaded. Combining the two functions is a central idea in newer AI network transports.

Where it is used

  • Ultra Ethernet makes per-packet multipath a core part of its transport.
  • Vendor Ethernet platforms for AI offer switch-based spraying with reordering in the adapter.
  • Scheduled fabrics, a different architecture, break traffic into cells and distribute them across the fabric under central scheduling, reassembling at the far side.
  • InfiniBand provides adaptive routing.

Implementation in hardware

Spraying places requirements on the network interface.

  • Per-packet path selection, with a way to vary and track path identifiers.
  • Per-path state on congestion and health.
  • Receive-side tracking of which packets have arrived, typically with a bitmap.
  • Direct data placement for out-of-order packets.
  • Selective retransmission of only what is missing.

All of this runs at line rate in the adapter, DPU or accelerator.

Common questions

What is packet spraying?

A load-balancing technique that distributes the individual packets of a flow across many network paths, instead of sending the entire flow along one.

Why do packets arrive out of order with spraying?

Different paths have slightly different delays and queue lengths. A packet sent later on a faster path can overtake one sent earlier on a slower path.

Does packet spraying require new switches?

Not necessarily. When the sender varies a header field that switches already hash on, standard switches spread the packets. Some implementations do rely on switch features.

Related guides