←Contents目錄
Chapter 7第 7 章
Chapter 7 of 13 · Part II · The network
第 7 章(共 13 章)· 第二部 · 網路

Transport: RDMA over Ethernet, lossless networks and congestion control傳輸層:Ethernet 上的 RDMA、無損網路與壅塞控制

Learn what an RDMA packet looks like on Ethernet, why its loss recovery makes training networks avoid dropping packets, how pause frames (PFC) and congestion signals (ECN, DCQCN) work and fail, why the production AI networks departed from the textbook recipe, and what comes after it.了解 RDMA 封包在 Ethernet 上的樣子、為何它的丟包恢復方式讓訓練網路盡量不丟包、暫停幀(PFC)與壅塞訊號(ECN、DCQCN)如何運作與失效、生產環境的 AI 網路為何偏離教科書做法,以及接下來的發展。

≈ 60 min · 8 panels · 5 animations≈ 60 分鐘 · 8 個面板 · 5 個動畫Jump to the quiz ↓跳到測驗 ↓
New terms in this chapter (13)本章新名詞(13)

Each term is defined in the text where it first appears; the link jumps there. Terms from earlier chapters are listed under "Before you start".

每個名詞都在它第一次出現的段落中定義,點連結可跳過去。前面各章的名詞列在「開始之前」。

  • RoCEv2RoCEv2 RDMA over Converged Ethernet: RDMA packets carried inside UDP/IP so that ordinary Ethernet switches can forward them. 融合乙太網路上的 RDMA:把 RDMA 封包包在 UDP/IP 內,讓一般 Ethernet 交換器可以轉送。
  • Lossless network無損網路 A network whose switches pause senders instead of dropping packets when a buffer fills. 緩衝區滿時,交換器會暫停傳送端而不丟封包的網路。
  • PFCPFC Priority flow control: a switch port sends PAUSE upstream before its buffer overflows, per traffic class. 優先權流量控制(PFC):交換器埠在緩衝區溢位前,依流量類別向上游送出 PAUSE。
  • DCQCNDCQCN The standard RoCE congestion control: ECN marks at the switch, CNPs from the receiver, rate cuts at the sender NIC. RoCE 的標準壅塞控制:交換器做 ECN 標記、接收端回 CNP、傳送端 NIC 降速。
  • Memory registration, MTT記憶體註冊、MTT Before RDMA, a buffer is registered: pinned, and its address map loaded into the NIC's memory translation table (MTT). RDMA 前必須註冊緩衝區:鎖定記憶體,並把位址對應載入 NIC 的記憶體轉換表(MTT)。
  • Packet sequence number (PSN)封包序號(PSN) The number in each RDMA packet that loss recovery uses to find gaps. 每個 RDMA 封包中的編號,遺失恢復用它找出缺口。
  • Goodput有效吞吐(goodput) Useful data delivered per second, after resent and wasted bytes are removed. 扣掉重送與浪費的位元組後,每秒交付的有用資料量。
  • Congestion spreading, victim flow壅塞擴散、受害者流 PFC side effects: pauses spread upstream hop by hop and slow flows that cross no congested link. PFC 的副作用:暫停逐跳往上游擴散,拖慢沒經過壅塞鏈路的流。
  • Headroom預留空間(headroom) Buffer reserved for the bytes that still arrive after a PAUSE has been sent. 為送出 PAUSE 後仍會抵達的位元組所保留的緩衝空間。
  • ECN, CNPECN、CNP Explicit congestion notification: a switch marks packets when its queue grows; the receiver returns a congestion notification packet (CNP). 明確壅塞通知:佇列增長時交換器標記封包;接收端回傳壅塞通知封包(CNP)。
  • IncastIncast(多對一匯聚) Many senders converge on one receiver at once, so one port receives more than it can drain. 許多傳送端同時匯聚到一個接收端,一個埠收到的超過它能送出的。
  • Ultra EthernetUltra Ethernet An industry transport specification (1.0 in 2025) that sprays packets and retransmits selectively. 業界傳輸規格(2025 年 1.0 版),會噴灑封包並做選擇性重傳。
  • BDP-FCBDP-FC IRN's cap of one BDP of unacknowledged bytes per queue pair, enforced in the NIC. IRN 在 NIC 內施加的上限:每個佇列對最多一個 BDP 的未確認位元組。

7.1RDMA over EthernetEthernet 上的 RDMA

Recall
回顧
Section 2.4 introduced RDMA, the queue pair and the packet. This chapter follows those packets across the network of Chapter 6. When more data heads for a link than the link can carry, the link is congested; most of this chapter is about what switches and NICs do then.
第 2.4 節介紹了 RDMA、queue pair 與封包。本章跟著這些封包穿越第 6 章的網路。當流向某條鏈路的資料多於它能承載的量時,這條鏈路就壅塞了;本章大部分在談這時交換器與 NIC 怎麼做。

Normal networking copies data through the operating system. At 400 Gb/s that would use every CPU core. RDMA (remote direct memory access) lets the NIC read and write application memory directly. With GPUDirect, the NIC reads GPU memory and writes into the remote GPU's memory. The CPU only posts a request and later sees a completion. The request is a work queue element on a queue pair, which is the RDMA name for a connection.

一般網路的資料要經過作業系統複製。在 400 Gb/s 下,這會吃光所有 CPU 核心。RDMA(遠端直接記憶體存取)讓 NIC 直接讀寫應用程式的記憶體。配合 GPUDirect,NIC 直接讀 GPU 記憶體並寫到遠端 GPU 的記憶體。CPU 只需提交一個請求,稍後看到完成通知。請求是一個 queue pair(RDMA 對「連線」的稱呼)上的 work queue element。

RDMA was born on InfiniBand. RoCEv2 (RDMA over Converged Ethernet) puts the same RDMA packets inside UDP/IP, so they can cross ordinary Ethernet switches. Meta, Alibaba and ByteDance all chose RoCEv2 for their training clusters because it uses the same switches, tools and people as the rest of the data center. One RoCE detail matters a lot: the NIC retransmits with go-back-N. If one packet is lost, the NIC resends that packet and every packet after it. In one measurement a 0.1% loss rate cut a 100 Gb/s flow from about 90 to about 25 Gb/s (Section 7.2). So the network must not drop packets: it must be lossless. Ethernet switches achieve this with pause frames, priority flow control (PFC, Section 7.3), and a congestion-control algorithm, DCQCN (Section 7.4), slows senders down so that pauses are rarely needed.

RDMA 誕生於 InfiniBand。RoCEv2(RDMA over Converged Ethernet)把同樣的 RDMA 封包包進 UDP/IP,讓它們可以穿過一般的 Ethernet 交換器。Meta、Alibaba 與 ByteDance 都為訓練叢集選了 RoCEv2,因為它用的交換器、工具與人員和資料中心其他部分相同。RoCE 有一個細節影響很大:NIC 用 go-back-N 重傳。只要掉一個封包,NIC 會重送那個封包以及其後所有封包。在一次量測中,0.1% 的丟包率讓一條 100 Gb/s 的流從約 90 Gb/s 掉到約 25 Gb/s(第 7.2 節)。所以網路不能丟包:它必須是無損(lossless)的。Ethernet 交換器以暫停幀,即優先權流量控制(PFC,第 7.3 節)做到這點;另有壅塞控制演算法 DCQCN(第 7.4 節)讓發送端減速,使暫停很少需要發生。

What RoCEv2 puts on the wireRoCEv2 在線路上放了什麼

Mechanism. An RDMA transfer begins with a verb: the application posts a work request on a queue pair (QP), which is a send queue and a receive queue that together form one connection. Three families matter here. Send/receive needs the receiver to have posted a receive buffer first. RDMA write and read move data to or from a registered remote address without the remote CPU. Completions appear on a completion queue. NCCL uses RDMA write for data and a small send for control.

機制。一次 RDMA 傳輸從一個 verb 開始:應用程式在一個 queue pair(QP)上提交工作請求;QP 是一個發送佇列加一個接收佇列,合起來構成一條連線。這裡有三個家族要緊。Send/receive 需要接收端先提交一個接收緩衝區。RDMA write 與 read 把資料搬到或搬離已註冊的遠端位址,遠端 CPU 不參與。完成通知出現在 completion queue。NCCL 用 RDMA write 搬資料、用小的 send 做控制。

Before any of this, the application must register the memory it will use. Registration pins the pages and loads their mapping into the NIC's memory translation table (MTT). The NIC caches only a part of the MTT. In Microsoft's 2016 NICs the cache held 2K entries; with 4 KB pages that covers 8 MB of memory (Microsoft RoCE paper). A receiver with a larger working set misses constantly, stalls, fills its receive buffer and sends PAUSE frames. That is the slow receiver of Section 7.3; the fix was 2 MB pages. Figure 7.1 follows one RDMA write through the QP, the MTT and the completion queue.

在這一切之前,應用程式必須註冊它要用的記憶體。註冊會釘住分頁,並把對應載入 NIC 的記憶體轉換表(MTT)。NIC 只快取 MTT 的一部分。微軟 2016 年的 NIC 快取 2K 筆;用 4 KB 分頁只涵蓋 8 MB 記憶體(微軟 RoCE 論文)。工作集更大的接收端不斷失誤、停滯、填滿接收緩衝並送出 PAUSE 幀。這就是 第 7.3 節 的慢接收端;修法是 2 MB 分頁。圖 7.1 沿著 QP、MTT 與 completion queue 走過一次 RDMA write。

host A · sender主機 A · 發送端host B · receiver主機 B · 接收端application應用程式QPCQNIC · MTTregistered memory已註冊的記憶體CPU: idleCPU:閒置NIC · rkey · MTT12543 RDMA write packets3 RDMA write 封包ACKMTT cache in Microsoft's 2016 NICs: 2K entries × 4 KB pages = 8 MB微軟 2016 年 NIC 的 MTT 快取:2K 筆 × 4 KB 分頁 = 8 MBlarger working set → misses → receiver stalls → PAUSE frames (Section 7.3)工作集更大 → 快取失誤 → 接收端停滯 → 送出 PAUSE(第 7.3 節)fix: 2 MB pages, 512× the coverage修法:2 MB 分頁,涵蓋範圍是 512 倍
Figure 7.1. One RDMA write. (1) The application posts a work request on its QP. (2) The NIC translates the local address with its MTT and reads the data. (3) The packets cross the network. (4) The remote NIC checks the rkey, translates the remote address and writes the memory; the remote CPU does nothing. (5) The ACK returns, and a completion appears on the CQ. At step 4, a miss in the small MTT cache stalls the receiver: this is the slow receiver of Section 7.3.圖 7.1。一次 RDMA write。(1) 應用程式在它的 QP 上提交工作請求。(2) NIC 用 MTT 轉換本地位址並讀取資料。(3) 封包穿過網路。(4) 遠端 NIC 檢查 rkey、轉換遠端位址並寫入記憶體;遠端 CPU 不做任何事。(5) ACK 返回,完成通知出現在 CQ。在第 4 步,小小的 MTT 快取一旦失誤就讓接收端停滯:這就是 第 7.3 節 的慢接收端。Drawn for this primer from the RDMA verbs model and Guo et al., SIGCOMM 2016 (Microsoft RoCE).

The packet封包

The packet. RoCEv2 wraps each RDMA packet in ordinary Ethernet, IP and UDP headers so that any IP router can forward it. The UDP destination port is fixed at 4791; the source port varies per QP so switches can hash on it. Inside UDP comes the base transport header (BTH, 12 bytes): the opcode (which verb, and whether this is the first, middle, last or only packet of a message), the 24-bit packet sequence number (PSN) that loss recovery depends on, and the 24-bit destination QP number that Meta's switches hash on. An RDMA write adds the RETH (16 bytes): the remote virtual address, the remote key that proves the sender may write there, and the message length. Then the payload, then a 4-byte ICRC and the Ethernet FCS. For a 4 KB payload the headers and trailers add about 78 bytes, under 2%. Figure 7.2 shows the fields in order.

封包。RoCEv2 把每個 RDMA 封包包進一般的 Ethernet、IP 與 UDP 標頭,讓任何 IP 路由器都能轉送它。UDP 目的埠固定為 4791;來源埠依 QP 變化,讓交換器可以對它做雜湊。UDP 之內是基本傳輸標頭(BTH,12 位元組):opcode(哪個 verb,以及這是訊息的第一個、中間、最後一個或唯一的封包)、丟包恢復所依賴的 24 位元封包序號(PSN),以及 Meta 的交換器拿來雜湊的 24 位元目的 QP 編號。RDMA write 再加上 RETH(16 位元組):遠端虛擬位址、證明發送端有權寫入的遠端金鑰,以及訊息長度。接著是載荷、4 位元組的 ICRC,然後是 Ethernet 的 FCS。4 KB 的載荷加上標頭與尾端約 78 位元組,不到 2%。圖 7.2 依序畫出這些欄位。

Ethernet14 BIPv420 BUDP8 BBTH12 BRETH16 Bpayload載荷≤ 4,096 BICRC4 BFCS4 BIPv4 DSCP (6 bits): carries the PFC priorityIPv4 DSCP(6 位元):攜帶 PFC 優先權UDP: destination port 4791; the source port varies per QP for hashingUDP:目的埠 4791;來源埠依 QP 變化,供雜湊BTH: opcode, 24-bit PSN for loss recovery, 24-bit destination QPBTH:opcode、24 位元 PSN(丟包恢復)、24 位元目的 QPRETH: remote address, rkey, length; first packet of a write onlyRETH:遠端位址、rkey、長度;只在 write 的第一個封包≈ 78 B around a 4 KB payload (under 2%); 82 ns on a 400 Gb/s wire4 KB 載荷外約 78 B(不到 2%);400 Gb/s 線路上 82 ns
Figure 7.2. The first packet of a RoCEv2 write, drawn with field widths not to scale and with each colored header field explained below it. Loss recovery works on the PSN in the BTH, the PFC priority travels in the IP DSCP field, and switches hash on the UDP source port or the destination QP.圖 7.2。RoCEv2 write 的第一個封包,欄位寬度不按比例,每個上色的標頭欄位在下方說明。丟包恢復操作的是 BTH 裡的 PSN,PFC 優先權放在 IP 的 DSCP 欄位,交換器對 UDP 來源埠或目的 QP 做雜湊。Drawn for this primer from the InfiniBand/RoCEv2 header layout and Guo et al., SIGCOMM 2016.

Why DSCP. PFC identifies a packet's class by the 3-bit PCP field in the VLAN tag, which failed in two ways on Microsoft's routed network. PXE-booting servers have no VLAN configuration yet, and no standard carries a VLAN priority across an IP subnet boundary. So Microsoft moved the priority into the 6-bit DSCP field of the IP header, mapping DSCP value ii to PFC priority ii. Every RoCE fabric since classifies on DSCP.

為何用 DSCP。PFC 以 VLAN 標籤中 3 位元的 PCP 欄位識別封包的類別,這在微軟的路由式網路上有兩個問題。以 PXE 開機的伺服器還沒有 VLAN 設定,而且沒有標準方法把 VLAN 優先權帶過 IP 子網邊界。於是微軟把優先權移到 IP 標頭的 6 位元 DSCP 欄位,把 DSCP 值 ii 對應到 PFC 優先權 ii。此後每個 RoCE 網路都依 DSCP 分類。

Numbers. The RDMA MTU on current NICs is 4,096 bytes. A 4 KB payload is 32,768 bits; at 400 Gb/s it occupies the wire for 82 ns. A full 1 MB NCCL chunk is 256 such packets and leaves the NIC in 21 µs, which is about one data-center round trip (Meta measured 22 µs). So a sender can put an entire chunk into the network before any feedback returns. At 40 Gb/s in 2015 the same chunk took 210 µs, ten round trips; every "slow signal" problem in Section 7.4 and Section 7.5 comes from this tenfold change. Panel 7.1 computes these numbers for other link rates, MTUs, chunks and round trips.

數字。目前 NIC 的 RDMA MTU 是 4,096 位元組。4 KB 的載荷是 32,768 位元;在 400 Gb/s 下它占用線路 82 ns。一個完整的 1 MB NCCL chunk 是 256 個這樣的封包,21 µs 就離開 NIC,約等於一次資料中心往返(Meta 量到 22 µs)。所以發送端可以在任何回饋返回之前,把整個 chunk 放進網路。2015 年的 40 Gb/s 下,同樣的 chunk 要 210 µs,即十次往返;第 7.4 節 與 第 7.5 節 裡每一個「訊號太慢」的問題都來自這十倍的變化。面板 7.1 為其他鏈路速率、MTU、chunk 與往返時間計算這些數字。

Panel 7.1面板 7.1

One chunk against one round trip一個 chunk 對上一次往返

Headers + trailers, first packet
第一個封包的標頭與尾端
One payload on the wire
一個載荷占用線路
Chunk leaves the NIC in
Chunk 離開 NIC 所需時間
Chunk time ÷ RTT
Chunk 時間 ÷ RTT

Model: the first packet of an RDMA write carries 78 B of headers and trailers (Ethernet 14, IPv4 20, UDP 8, BTH 12, RETH 16, ICRC 4, FCS 4); later packets omit the 16 B RETH, and the preamble and inter-frame gap are not counted. Wire time counts the payload only, as in the text. Defaults: 400 Gb/s, a 4 KB MTU, Meta's measured 22 µs round trip and a 1 MB NCCL chunk. They give 82 ns per packet and 256 packets in 21 µs, about one round trip. Set 40G to see the 2015 case of about ten round trips.

模型:RDMA write 的第一個封包帶 78 B 的標頭與尾端(Ethernet 14、IPv4 20、UDP 8、BTH 12、RETH 16、ICRC 4、FCS 4);之後的封包省略 16 B 的 RETH,前導碼與幀間隙不計。線路時間只計載荷,與正文相同。預設值:400 Gb/s、4 KB MTU、Meta 實測的 22 µs 往返,以及 1 MB 的 NCCL chunk。它們給出每個封包 82 ns、256 個封包 21 µs 送完,約一次往返。切到 40G,看 2015 年約十次往返的情況。

The NIC's packet budgetNIC 的封包預算

Worked example: the packet budget. At 400 Gb/s with a 4 KB MTU, each packet carries 4,096 bytes of payload plus about 100 bytes of headers, about 33,600 bits. Divide: 400×109÷33,600≈11.9{400 \times 10^{9}} \div 33{,}600 \approx 11.9 million packets per second, one every 84 ns. In those 84 ns the NIC must look up the QP state, translate the address through the MTT, move 4 KB over PCIe and update the sequence number. There is no time for a cache miss to memory, which is why the NIC's cache sizes, not its line rate, fail first.

實例:封包預算。在 400 Gb/s、4 KB MTU 下,每個封包有 4,096 位元組的載荷加上約 100 位元組的標頭,約 33,600 位元。除一下:400×109÷33,600≈1,190{400 \times 10^{9}} \div 33{,}600 \approx 1{,}190 萬個封包/秒,每 84 ns 一個。在那 84 ns 內 NIC 必須查 QP 狀態、經 MTT 轉換位址、透過 PCIe 搬 4 KB 並更新序號。沒有時間容許一次到記憶體的快取失誤,這就是為什麼最先失敗的是 NIC 的快取大小,而不是它的線速。

Panel 7.2 recomputes this budget, and the cost of one loss, for other line rates, MTUs and round trips.

面板 7.2 對其他線速、MTU 與往返時間重算這份預算,以及一次丟包的代價。

Panel 7.2面板 7.2

NIC packet budget and the cost of one lossNIC 的封包預算與一次丟包的代價

Packets per second
每秒封包數
Time per packet
每個封包的時間
Go-back-N resend per loss
Go-back-N 每次丟包的重傳量
Selective resend per loss
選擇性重傳每次丟包的重傳量

A model: each packet carries one MTU of payload plus about 100 bytes of headers; go-back-N resends about one bandwidth-delay product per loss, and selective retransmission (as in IRN) resends one packet. Defaults reproduce this section: 400G, a 4 KB MTU and Meta's measured 22 µs round trip give 11.9 million packets per second, one every 84 ns, and about 1.1 MB resent per loss. Try 800G: the time per packet halves and the cost of a loss doubles.

模型:每個封包帶一個 MTU 的載荷加約 100 位元組的標頭;go-back-N 每次丟包重傳約一個頻寬延遲乘積,選擇性重傳(如 IRN)只重傳一個封包。預設值重現本節:400G、4 KB MTU 與 Meta 實測的 22 µs 往返,得到每秒 1,190 萬個封包、每 84 ns 一個,以及每次丟包約重傳 1.1 MB。試試 800G:每個封包的時間減半,一次丟包的代價加倍。

7.2Loss recovery decides everything丟包恢復決定一切

Mechanism. When a packet is lost, what does the sender resend? The RDMA transport was designed for InfiniBand, whose links never drop packets, so its designers chose the simplest answer. The receiver accepts packets only in PSN order. A packet with an unexpected PSN is discarded and a NACK is returned. The sender can react in three ways.

機制。封包遺失時,發送端要重送什麼?RDMA 傳輸層是為 InfiniBand 設計的,那裡的鏈路從不丟包,所以設計者選了最簡單的答案。接收端只依 PSN 順序接受封包。PSN 不符預期的封包被丟棄並回送 NACK。發送端有三種反應方式。

  1. Go-back-0. Restart the whole message from its first packet. Microsoft's first NICs did this. Under a deterministic drop of one packet in 256, a message longer than 256 packets can never complete: every attempt hits a drop before the end. Goodput, the rate at which useful data is delivered, fell to zero while the link ran at full rate. This is a livelock.Go-back-0。從訊息的第一個封包重頭來。微軟最早的 NIC 就是這樣。在確定性地每 256 個封包丟 1 個之下,超過 256 個封包的訊息永遠無法完成:每次嘗試都會在結束前碰到一次丟包。鏈路全速運行,有效吞吐(goodput,有用資料被送達的速率)卻降到零。這是活鎖。
  2. Go-back-N. Restart from the first lost packet. This is what RoCE NICs do today. The waste per loss is every packet that was already in flight behind the lost one: up to one bandwidth-delay product (BDP), the link rate times the round-trip time. At 40 Gb/s and a 24 µs RTT that is 120 KB; at 400 Gb/s and 22 µs it is 1.1 MB, about 270 packets of 4 KB.Go-back-N。從第一個遺失的封包重新開始。今天的 RoCE NIC 就是這麼做。每次丟包浪費的是排在遺失封包後面、已經在途的所有封包:最多一個頻寬延遲乘積(BDP),即鏈路速率乘以往返時間。40 Gb/s、24 µs RTT 時是 120 KB;400 Gb/s、22 µs 時是 1.1 MB,約 270 個 4 KB 封包。
  3. Selective retransmission. The receiver keeps packets that arrive out of order, after a later one, and tells the sender exactly which PSN is missing. The sender tracks acknowledgments in a bitmap and resends only the gaps. One loss costs one packet. IRN's example: packets 1–10 are sent and packet 3 is lost; go-back-N resends 8 packets, IRN resends 1 (IRN paper).選擇性重傳。接收端保留亂序(比後面的封包還晚到)的封包,並精確告訴發送端缺了哪個 PSN。發送端用位圖追蹤確認,只重送缺口。一次丟包只花一個封包。IRN 的例子:送出封包 1–10、封包 3 遺失;go-back-N 重送 8 個,IRN 重送 1 個(IRN 論文)。

Figure 7.3 applies the three rules to IRN's example.

圖 7.3 把這三種規則套用到 IRN 的例子。

resent重送數sent; 3 lost送出;3 遺失12✕45678910go-back-0whole message整則訊息1234567891010go-back-Nfrom the loss從遺失處起123456789108selective選擇性重傳only the gap只補缺口123456789101resent重送delivered, not sent again已送達,不再重送lost遺失
Figure 7.3. IRN's example: packets 1–10 form one message, and packet 3 is lost. Go-back-0 resends the whole message (10 packets). Go-back-N resends packet 3 and every packet after it (8). Selective retransmission resends packet 3 only (1). Filled boxes are resent; faded boxes were delivered and are not sent again.圖 7.3。IRN 的例子:封包 1–10 構成一則訊息,封包 3 遺失。go-back-0 重送整則訊息(10 個)。go-back-N 重送封包 3 及其後每個封包(8 個)。選擇性重傳只重送封包 3(1 個)。填色的方框是重送的封包;淡色的方框已送達,不再重送。Drawn for this primer from Mittal et al., SIGCOMM 2018 (IRN §3) and Guo et al., SIGCOMM 2016.

Animation 7.1 plays IRN's example step by step under go-back-N and under selective retransmission; you choose which packet is lost.

動畫 7.1 逐步播放 IRN 的例子,分別在 go-back-N 與選擇性重傳之下;你可以選擇哪個封包遺失。

Animation 7.1動畫 7.1

One lost packet: go-back-N against selective retransmission一個遺失的封包:go-back-N 對上選擇性重傳

Model: IRN's example of one 10-packet message with one loss (packet 3 by default). Simplified: all ten packets leave back to back, the ACKs of the first round are not drawn, and each receiver sends one NACK, although a real NIC sends one for each out-of-order packet. If packet 10 is lost, no later packet arrives to cause a NACK, so the retransmission timer must fire (see "Two timeouts" below).

模型:IRN 的例子,一則 10 個封包的訊息丟了一個(預設是封包 3)。簡化:十個封包一個接一個送出,第一輪的 ACK 沒有畫出,每個接收端只送一個 NACK,而真實 NIC 會為每個亂序封包各送一個。若遺失的是封包 10,之後沒有封包到達來觸發 NACK,只能等重傳計時器到期(見下方「兩個逾時」)。

Why the loss rate matters so much. Write pp for the probability that a packet is lost and WW for the BDP in packets. Under go-back-N each loss wastes about WW packets of link time, so the fraction of useful packets is roughly

為何丟包率如此重要。令 pp 為一個封包遺失的機率、WW 為以封包計的 BDP。在 go-back-N 下每次丟包浪費約 WW 個封包的鏈路時間,所以有用封包的比例大約是

G≈11+pW G \approx \frac{1}{1 + pW}

This approximation ignores NACK waiting time and treats losses as independent, but it shows the cliff. With W=120W = 120, G≈0.89G \approx 0.89 at p=0.001p = 0.001 and 0.450.45 at p=0.01p = 0.01; at 400 Gb/s with W=270W = 270 the same 1% loss gives G≈0.27G \approx 0.27. Under selective retransmission G≈1−pG \approx 1 - p. Under go-back-0 a message of MM packets completes only if none is lost, with probability (1−p)M(1-p)^M: 0.370.37 for M=1,000M = 1{,}000 and p=0.001p = 0.001, and exactly zero under the deterministic 1-in-256 drop for any M>256M > 256. Figure 7.4 shows the same cliff measured on a go-back-N NIC.

這個近似忽略等待 NACK 的時間、並把丟包視為獨立事件,但足以看出懸崖。W=120W = 120 時,p=0.001p = 0.001 給 G≈0.89G \approx 0.89、p=0.01p = 0.01 給 0.450.45;400 Gb/s、W=270W = 270 時,同樣 1% 的丟包給出 G≈0.27G \approx 0.27。在選擇性重傳下 G≈1−pG \approx 1 - p。在 go-back-0 下,MM 個封包的訊息只有一個都不丟時才完成,機率是 (1−p)M(1-p)^M:M=1,000M = 1{,}000、p=0.001p = 0.001 時是 0.370.37,而在確定性的每 256 丟 1 下,任何 M>256M > 256 都正好是零。圖 7.4 是在 go-back-N NIC 上量到的同一個懸崖。

Line chart of goodput in Gb/s against loss rate from 0 to 5% for CX5 and DCP; CX5 drops from about 90 to near 0, DCP from about 90 to about 52.
Figure 7.4. Measured on DCP's 100 Gb/s testbed: the goodput of one long flow as the switch drops 0–5% of packets (the x axis is not to scale). The go-back-N ConnectX-5 (red) falls from about 90 Gb/s to about 55 Gb/s at 0.01% loss, to about 25 Gb/s at 0.1%, and to almost zero at 5%. DCP (blue) is the paper's own NIC, whose switches trim packets instead of dropping them (DCP, SIGCOMM 2025).圖 7.4。在 DCP 的 100 Gb/s 測試平台上實測:交換器丟棄 0–5% 的封包時,一條長流的 goodput(x 軸不按比例)。go-back-N 的 ConnectX-5(紅)從約 90 Gb/s 掉到 0.01% 丟包時的約 55 Gb/s、0.1% 時的約 25 Gb/s,5% 時幾乎歸零。DCP(藍)是論文自己的 NIC,它的交換器修剪封包而不丟棄(DCP,SIGCOMM 2025)。Li et al., SIGCOMM 2025 (DCP), Figure 7.10.

Two timeouts. A tail loss produces no NACK, because no later packet arrives, so the sender also needs a timer. IRN uses two timers. RTOhigh\mathrm{RTO}_{\text{high}}, about 320 µs in their setup (the longest RTT with one congested link), applies in general. RTOlow\mathrm{RTO}_{\text{low}}, 100 µs, applies only when three or fewer packets are in flight. ByteDance's MegaScale tuned NCCL's retransmit timer and retry count so that a link flap of a few seconds does not kill a job, and enabled the NIC's adaptive retransmission for shorter retry intervals (MegaScale).

兩個逾時。尾端的丟包不會產生 NACK,因為沒有後到的封包,所以發送端還需要一個計時器。IRN 用兩個計時器。RTOhigh\mathrm{RTO}_{\text{high}}(他們的設定約 320 µs,即有一條壅塞鏈路時的最長 RTT)一般適用。RTOlow\mathrm{RTO}_{\text{low}}(100 µs)只在在途封包三個以下時適用。字節跳動的 MegaScale 調校 NCCL 的重傳計時器與重試次數,讓幾秒的鏈路抖動不會殺死任務,並啟用 NIC 的自適應重傳以縮短重試間隔(MegaScale)。

Why "lossless" was a NIC property, not a law. A network that drops 0.1% of packets is harmless to a selective-retransmission NIC and costly to a go-back-N NIC. The lossless requirement therefore belongs to the NIC's recovery algorithm, not to RDMA or Ethernet. IRN put it this way: "the need for PFC is an artifact of current RoCE NIC designs rather than a fundamental requirement." Section 7.3 and Section 7.4 are the cost of that artifact; Section 7.6 is what happens once it is removed.

為何「無損」是 NIC 的性質,不是定律。丟 0.1% 封包的網路對選擇性重傳的 NIC 無害,對 go-back-N 的 NIC 卻代價高昂。因此無損需求屬於 NIC 的恢復演算法,不屬於 RDMA 或 Ethernet。IRN 這樣說:「對 PFC 的需求是當前 RoCE NIC 設計的產物,而非根本要求。」第 7.3 節 與 第 7.4 節 是這個產物的代價;第 7.6 節 是把它移除之後會發生的事。

Panel 7.3面板 7.3

Loss recovery goodput: go-back-0, go-back-N, selective丟包恢復的 goodput:go-back-0、go-back-N、選擇性重傳

BDP WW (packets)
BDP WW(封包數)
Resent per loss
每次丟包重送
Goodput, highlighted scheme
強調方案的 goodput
Microsoft test: 1-in-256 drop
微軟測試:每 256 丟 1
IRN example: 10 sent, #3 lost
IRN 例子:送 10 個,第 3 個遺失

Defaults are IRN's setup: 40 Gb/s, a 24 µs round trip (6 hops at 2 µs per link each way), 1 KB packets, so W≈120{W \approx 120} packets, and a 1 MB message. Models: go-back-0 completes a message only if none of its MM packets is lost, G=(1−p)M{G = (1-p)^M}; go-back-N wastes WW packets per loss, G≈1/(1+pW){G \approx 1/(1 + pW)}; selective wastes one, G≈1/(1+p){G \approx 1/(1 + p)}. Try 400G with a 22 µs RTT and 4 KB packets (W≈270{W \approx 270}), then move the loss rate to 1%: go-back-N keeps a quarter of the link.

預設值是 IRN 的設定:40 Gb/s、24 µs 往返(6 跳、每鏈路單向 2 µs)、1 KB 封包,所以 W≈120{W \approx 120} 個封包,訊息 1 MB。模型:go-back-0 只有在 MM 個封包一個都不丟時才完成訊息,G=(1−p)M{G = (1-p)^M};go-back-N 每次丟包浪費 WW 個封包,G≈1/(1+pW){G \approx 1/(1 + pW)};選擇性重傳浪費一個,G≈1/(1+p){G \approx 1/(1 + p)}。試試 400G、22 µs RTT 與 4 KB 封包(W≈270{W \approx 270}),再把丟包率移到 1%:go-back-N 只剩四分之一的鏈路。

Stop and think停下來想一想

A 400G fabric drops one packet in 10510^5. Set the panel to 400G, 22 µs, 4 KB: how much goodput does go-back-N keep, and selective retransmission? Is 10−5{10^{-5}} "lossless"? For a go-back-N NIC, no; that difference is the argument of Section 7.6.

一個 400G 網路每 10510^5 個封包丟一個。把面板設為 400G、22 µs、4 KB:go-back-N 保住多少 goodput?選擇性重傳呢?10−5{10^{-5}} 算「無損」嗎?對 go-back-N 的 NIC 不算;這個差別就是 第 7.6 節 的論證。

7.3Lossless Ethernet: priority flow control無損 Ethernet:優先權流量控制

A switch port has a buffer. When packets arrive faster than they leave, the buffer fills. A normal switch drops the overflow. A lossless switch instead sends a PAUSE frame upstream before the buffer is full. This is PFC (priority flow control). The upstream port stops sending on that priority until it receives a resume. PFC works, but it has side effects. The pause spreads backward hop by hop (congestion spreading), a paused port blocks flows that were not causing the congestion (head-of-line blocking), and in rare cases a cycle of pauses can deadlock the network. Microsoft's 2016 paper on RDMA at scale is the classic account of these failures.

交換器的每個埠都有緩衝區。封包進得比出得快,緩衝區就會滿。一般交換器會把溢出的丟掉;無損交換器則在緩衝區滿之前向上游送出 PAUSE 幀。這就是 PFC(優先權流量控制)。上游埠會停止在該優先權上發送,直到收到恢復通知。PFC 有效,但有副作用。暫停會一跳一跳往回蔓延(壅塞擴散),被暫停的埠會擋住與壅塞無關的流(隊頭阻塞),極端情況下暫停形成循環還會讓網路死鎖。Microsoft 2016 年關於大規模 RDMA 的論文是這些失效的經典記錄。

Mechanism. Priority flow control (IEEE 802.1Qbb) works on one link. Each port keeps an ingress counter per priority class; when a class's counter passes the pause threshold tPFCt_{\text{PFC}}, the port sends a PAUSE naming that class and the upstream port stops sending it. A RESUME follows when the counter falls below a lower threshold. The frame never travels more than one hop, but congestion spreads anyway: the paused upstream port's own buffer fills and it pauses its upstream, hop by hop.

機制。優先權流量控制(IEEE 802.1Qbb)在一條鏈路上運作。每個埠為每個優先權類別維護一個入口計數器;某類別的計數器超過暫停門檻 tPFCt_{\text{PFC}} 時,該埠送出指名該類別的 PAUSE,上游埠停止發送該類別。計數器降到較低門檻之下時送出 RESUME。這個幀永遠只走一跳,但壅塞仍然會擴散:被暫停的上游埠自己的緩衝填滿、再暫停它的上游,一跳一跳往回蔓延。

Headroom. A PAUSE does not stop traffic instantly. The frame must wait for the packet leaving the port, cross the cable, and be processed upstream, and all bytes sent meanwhile still arrive. The buffer reserved for them is the headroom, and a reasonable estimate is

Headroom。PAUSE 不會立刻停住流量。這個幀必須等待正在離開該埠的封包、穿過線纜、再由上游處理,而這段期間送出的所有位元組仍會到達。為它們保留的緩衝就是 headroom,一個合理的估計是

headroom≈2 MTU+C(2Lv+tresp) \text{headroom} \approx 2\,\mathrm{MTU} + C \left( \frac{2L}{v} + t_{\text{resp}} \right)

with one MTU in progress at each end, the link rate CC times the round-trip propagation delay over a cable of length LL (v≈2×108 m/s{v \approx 2 \times 10^8\,\text{m/s}}, 5 ns per meter), and a reaction allowance trespt_{\text{resp}}. For the DCQCN authors' switch, a 32-port 40 Gb/s Broadcom Trident II with a 12 MB shared buffer, 300 m cables and a 1,500-byte MTU, the headroom is about 22.4 KB per port per priority (DCQCN paper); our formula reproduces that figure with tresp≈0.9 μs{t_{\text{resp}} \approx 0.9\,\mu\text{s}}. At 400 Gb/s the cable term is ten times larger, and with two 4 KB MTUs the headroom is about 100 KB per port per priority with 100 m fibers, about 200 KB with 300 m. On a 64-port switch with two lossless classes that is 12.8 MB, the whole buffer of the 2015 switch. Figure 7.5 shows where each term of the formula comes from.

其中每端各一個正在傳送的 MTU,鏈路速率 CC 乘以長度 LL 線纜的往返傳播延遲(v≈2×108 m/s{v \approx 2 \times 10^8\,\text{m/s}},每公尺 5 ns),再加上反應餘裕 trespt_{\text{resp}}。對 DCQCN 作者的交換器——32 埠 40 Gb/s 的 Broadcom Trident II、12 MB 共享緩衝、300 m 線纜、1,500 位元組 MTU——headroom 約為每埠每優先權 22.4 KB(DCQCN 論文);我們的公式以 tresp≈0.9 μs{t_{\text{resp}} \approx 0.9\,\mu\text{s}} 重現這個數字。400 Gb/s 時線纜那一項大十倍,加上兩個 4 KB 的 MTU,headroom 約為100 m 光纖下每埠每優先權 100 KB、300 m 下約 200 KB。一台 64 埠交換器、兩個無損類別,就是 12.8 MB——2015 年那台交換器的全部緩衝。圖 7.5 畫出公式中每一項的來源。

upstream U上游 Udownstream D下游 Dcable, length L線纜長度 Ltime時間counter > tPFC 計數 > tPFC MTUPAUSE, L/vtresp MTUlast byte, L/v最後一個位元組,L/vheadroom:headroom:bytes that超過門檻後still arrive仍會到達的位元組headroom ≈ 2 MTU + C × (2L/v + tresp)40G, 300 m, 1.5 KB: 22.4 KB · 400G, 100 m, 4 KB: ≈ 103 KB40G、300 m、1.5 KB:22.4 KB · 400G、100 m、4 KB:約 103 KB
Figure 7.5. Where headroom comes from, drawn as a time-space diagram (time runs down). D's counter passes tPFCt_{\text{PFC}}, but D must finish the MTU it is sending before the PAUSE can leave. The PAUSE crosses the cable (L/vL/v), U reacts (trespt_{\text{resp}}) and finishes its own MTU, and U's last byte crosses the cable again. Every byte that U sends in this time still arrives at D, so D must reserve room for it.圖 7.5。headroom 從何而來,畫成時空圖(時間向下)。D 的計數器超過 tPFCt_{\text{PFC}},但 D 必須先送完正在傳的 MTU,PAUSE 才能出發。PAUSE 穿過線纜(L/vL/v),U 反應(trespt_{\text{resp}})並送完自己的 MTU,U 的最後一個位元組再穿過線纜一次。這段時間 U 送出的每個位元組仍會到達 D,所以 D 必須為它們保留空間。Drawn for this primer from the headroom formula of Section 7.3 and Zhu et al., SIGCOMM 2015 (DCQCN §4).

The PFC threshold. Headroom is reserved for every lossless class kk on every port nn; the rest of the shared buffer BB is what ingress counters may fill before pausing. Shared equally,

PFC 門檻。Headroom 為每個埠 nn 的每個無損類別 kk 保留;共享緩衝 BB 剩下的部分才是入口計數器在暫停前可以填的空間。均分之下,

tPFC≤B−kn⋅headroomkn t_{\text{PFC}} \le \frac{B - kn \cdot \text{headroom}}{kn}

For the Trident II (12 MB of shared buffer, 32 ports, 22.4 KB of headroom per port per priority), eight lossless priorities against two:

對 Trident II(12 MB 共享緩衝、32 埠、每埠每優先權 22.4 KB 的 headroom),比較八個與兩個無損優先權,逐列計算如下:

Question問題Calculation算式Result結果
Static tPFCt_{\text{PFC}}, all eight priorities lossless (k=8k = 8, n=32n = 32)靜態 tPFCt_{\text{PFC}},八個優先權全部無損(k=8k = 8、n=32n = 32)(12,000,000−8×32×22,400)÷256(12{,}000{,}000 - 8 \times 32 \times 22{,}400) \div 256≈24.47\approx 24.47 KBunder three 9 KB jumbo frames不到三個 9 KB 的 jumbo 幀
Static tPFCt_{\text{PFC}}, two lossless priorities (k=2k = 2)靜態 tPFCt_{\text{PFC}},兩個無損優先權(k=2k = 2)(12,000,000−2×32×22,400)÷64(12{,}000{,}000 - 2 \times 32 \times 22{,}400) \div 64≈165\approx 165 KB

With all eight classes lossless, each class gets less than three jumbo frames per port, which is why Microsoft made only two of the eight classes lossless; with two, the static threshold is about 165 KB. Real switches use a dynamic threshold instead: a port may fill until its ingress counter exceeds the free buffer divided by a parameter β\beta (β=8{\beta = 8} on that switch), so one hot port can use far more than its static share; Panel 7.4 uses that rule, which also bounds the threshold for ECN marking, the earlier congestion signal of Section 7.4.

八個類別全部無損時,每類別每埠不到三個 jumbo 幀,所以微軟只把八個類別中的兩個設為無損;兩個時靜態門檻約 165 KB。真實交換器改用動態門檻:一個埠可以一直填,直到入口計數器超過剩餘空閒緩衝除以參數 β\beta(那台交換器 β=8{\beta = 8}),所以一個熱埠可以用遠超過靜態份額的空間;面板 7.4 使用這條規則,它也限制了 第 7.4 節 那個更早的壅塞訊號——ECN 標記——的門檻。

Panel 7.4面板 7.4

PFC headroom and the ECN bound for one switch一台交換器的 PFC headroom 與 ECN 上界

Headroom / port / priority
每埠每優先權的 headroom
Total reserved headroom
保留的 headroom 總量
Static tPFCt_{\text{PFC}}
靜態 tPFCt_{\text{PFC}}
Max tECNt_{\text{ECN}} (dynamic, β\beta)
最大 tECNt_{\text{ECN}}(動態,β\beta)
Does Meta's 5 MB ECN threshold fit?
Meta 的 5 MB ECN 門檻放得下嗎?

Defaults are the DCQCN paper's Trident II: 12 MB, 32 × 40G, 8 lossless priorities, 1.5 KB MTU, 300 m cables, β=8{\beta = 8}. They reproduce 22.4 KB of headroom, a 24.47 KB static tPFCt_{\text{PFC}}, and a 21.75 KB ECN bound (headroom uses a fixed 0.88 µs reaction allowance). The bar shows how much of the buffer the headroom alone consumes. Switch to 400G and 4 KB, then raise the buffer until 5 MB fits: on a shared-buffer chip it never does, which is why Meta's number belongs to a deep-buffer spine with per-port carving.

預設值是 DCQCN 論文的 Trident II:12 MB、32 × 40G、8 個無損優先權、1.5 KB MTU、300 m 線纜、β=8{\beta = 8}。它們重現 22.4 KB 的 headroom、24.47 KB 的靜態 tPFCt_{\text{PFC}} 與 21.75 KB 的 ECN 上界(headroom 使用固定 0.88 µs 的反應餘裕)。長條顯示光是 headroom 就吃掉多少緩衝。切到 400G 與 4 KB,再把緩衝加大直到 5 MB 放得下:在共享緩衝晶片上永遠放不下,這就是為什麼 Meta 的數字屬於有每埠切分的深緩衝 spine。

The four pathologies. Microsoft's 2016 paper catalogues what PFC does to a production network; the DCQCN paper adds two failures that are properties of pausing whole ports.

四種病症。微軟 2016 年的論文記錄了 PFC 對生產網路做的事;DCQCN 論文再加上兩種源自暫停整個埠的固有失效。

Failure失效Trigger and mechanism觸發與機制Fix and number修法與數字
Livelock活鎖1-in-256 drop; go-back-0 restarts the message, so long messages never finish每 256 丟 1;go-back-0 重頭傳訊息,長訊息永遠無法完成Go-back-N in the NIC; waste per loss bounded by RTT×C{\mathrm{RTT} \times C}NIC 改用 go-back-N;每次丟包的浪費以 RTT×C{\mathrm{RTT} \times C} 為界
Deadlock死鎖Dead server: ARP alive (4 h), MAC expired (5 min); the switch floods lossless packets out every port, closing a pause cycle across two ToRs and two leaves伺服器死亡:ARP 仍在(4 小時)、MAC 已過期(5 分鐘);交換器把無損封包氾濫到每個埠,在兩台 ToR 與兩台 leaf 之間形成暫停迴圈Drop lossless packets with incomplete ARP; never put broadcast or multicast in a lossless class丟棄 ARP 不完整的無損封包;永不把廣播或多播放進無損類別
Pause storm暫停風暴One NIC's receive pipeline stalls and pauses its ToR forever; the ToR pauses its leaves; thousands of servers freeze一張 NIC 的接收管線停滯;它永遠暫停它的 ToR,ToR 再暫停 leaf;數千台伺服器凍結Watchdogs, timers that detect a stuck part and act: NIC stops pausing after a 100 ms stall; ToR drops the port's lossless traffic, re-enabling 200 ms after pauses stopWatchdog(偵測元件卡住並採取動作的計時器):NIC 停滯 100 ms 後停止暫停;ToR 丟棄該埠的無損流量,暫停停止 200 ms 後恢復
Slow receiver慢接收端MTT cache of 2K × 4 KB pages covers 8 MB; a bigger working set misses, stalls, and pauses everyone upstream2K × 4 KB 分頁的 MTT 快取只涵蓋 8 MB;更大的工作集失誤、停滯,並暫停所有上游2 MB pages (512× coverage); dynamic buffer sharing so one slow port cannot eat others' headroom2 MB 分頁(涵蓋 512 倍);動態緩衝共享讓一個慢埠吃不掉別人的 headroom
Unfairness (parking lot)不公平(停車場)Four senders into one receiver: H4 has its own ingress port, H1–H3 share one; pausing is per port, so H4's minimum (up to 20 Gb/s) exceeded the others' maximum四個發送端送往一個接收端:H4 獨占一個入口埠,H1–H3 共用一個;暫停以埠為單位,所以 H4 的最低值(最高達 20 Gb/s)超過其他三者的最高值Per-flow rate control (DCQCN) restores equal shares逐流速率控制(DCQCN)恢復均等份額
Victim flows受害者流A flow sharing no congested link fell from 20 to 10 to 4.5 Gb/s as pauses from an incast (many senders to one receiver) elsewhere cascaded through a switch on its path一條不共用任何壅塞鏈路的流,因別處 incast(多個發送端同時送往一個接收端)的暫停串聯到它路徑上的交換器,從 20 掉到 10、再到 4.5 Gb/sKeep PFC rare: congestion control, deep buffers, or bytes-in-flight caps讓 PFC 罕見:壅塞控制、深緩衝或在途位元組上限

Figure 7.6 traces the last row: how a pause reaches a flow that crosses no congested link.

圖 7.6 追蹤最後一列:暫停如何傳到一條不經過任何壅塞鏈路的流。

ST1T2T3H1H2H3VSRVRPAUSEPAUSEcongested壅塞victim flow受害者流H1–H3 send to R (incast); only the link T2 → R is congestedH1–H3 送往 R(incast);只有 T2 → R 這條鏈路壅塞victim VS → VR, DCQCN paper testbed, PFC only: 20 → 10 → 4.5 Gb/s受害者流 VS → VR,DCQCN 論文測試平台,只有 PFC:20 → 10 → 4.5 Gb/s
Figure 7.6. Congestion spreading, drawn on a simplified topology rather than the paper's exact one, with PAUSE frames and the congested link in red. Only the link T2 → R is congested. T2 pauses S. The bytes in S that came from T1 cannot leave, so S pauses T1. The victim flow VS → VR (green) crosses the paused link T1 → S but no congested link, and it slows down too. In the DCQCN paper's 40 Gb/s testbed with PFC only, a victim flow fell from 20 to 10 Gb/s, and to 4.5 Gb/s when two more incast senders joined.圖 7.6。壅塞擴散的示意圖,畫在簡化的拓樸上而非論文的實際拓樸,PAUSE 幀與壅塞鏈路以紅色標示。只有 T2 → R 這條鏈路壅塞。T2 暫停 S。S 裡來自 T1 的位元組無法離開,所以 S 暫停 T1。受害者流 VS → VR(綠色)經過被暫停的鏈路 T1 → S,但不經過任何壅塞鏈路,它也變慢了。在 DCQCN 論文的 40 Gb/s 測試平台上、只有 PFC 時,一條受害者流從 20 掉到 10 Gb/s,再加入兩個 incast 發送端後掉到 4.5 Gb/s。Drawn for this primer from Zhu et al., SIGCOMM 2015 (DCQCN §2).

Animation 7.2 plays Figure 7.6 in order: the pause moves upstream one hop at a time until it reaches the victim flow.

動畫 7.2 依序播放圖 7.6:暫停一次往上游走一跳,直到碰上受害流。

Animation 7.2動畫 7.2

PFC pauses spread upstream to a victim flowPFC 暫停往上游擴散到受害流

The topology is the schematic of Figure 7.6, a simplified version of the paper's testbed, and we chose where the two extra incast senders sit. The victim's rates of 20, 10 and 4.5 Gb/s are the DCQCN paper's measurements (40 Gb/s links, PFC only), taken directly from the paper. Queue bars are schematic. A paused link alternates between PAUSE and RESUME, so its traffic slows but does not stop; we draw that as fewer packets.

拓撲是圖 7.6 所畫的論文測試平台簡化版,兩個額外 incast 發送端的位置由我們選定。受害流的 20、10 與 4.5 Gb/s 是 DCQCN 論文的量測值(40 Gb/s 鏈路、只開 PFC),直接取自論文。佇列條是示意。被暫停的鏈路在 PAUSE 與 RESUME 之間交替,流量變慢但不會停止;我們以較少的封包表示。

Worked example. A 64-port 400G leaf has a 64 MB shared buffer, 100 m fibers, a 4 KB MTU and two lossless classes. A 400G link moves 50 KB per µs, and 100 m of fiber is a 1.0 µs round trip. The arithmetic, one question per row:

實例。一台 64 埠 400G 的 leaf:64 MB 共享緩衝、100 m 光纖、4 KB MTU、兩個無損類別。400G 鏈路每 µs 搬 50 KB,100 m 光纖的往返是 1.0 µs。逐列計算如下:

Question問題Calculation算式Result結果
Headroom per port per priority: two 4 KB MTUs, plus 50 KB/µs over the 1.0 µs round trip and a 0.9 µs response每埠每優先權的 headroom:兩個 4 KB MTU,加上 50 KB/µs 乘以 1.0 µs 往返與 0.9 µs 反應2×4+50×(1.0+0.9)2 \times 4 + 50 \times (1.0 + 0.9)≈103\approx 103 KB
Headroom reserved for 64 ports and 2 lossless classes64 個埠、2 個無損類別保留的 headroom2×64×103 KB2 \times 64 \times 103\,\text{KB}≈13.2\approx 13.2 MBa fifth of the buffer緩衝的五分之一
Static tPFCt_{\text{PFC}}: the rest of the buffer shared by 128 port-classes靜態 tPFCt_{\text{PFC}}:其餘緩衝由 128 個埠類別均分(64−13.2) MB÷128(64 - 13.2)\,\text{MB} \div 128≈397\approx 397 KB
That threshold as time on a 400G link這個門檻換成 400G 鏈路上的時間397÷50397 \div 50≈8\approx 8 µs
ECN bound tPFC/nt_{\text{PFC}}/n from Section 7.4第 7.4 節 的 ECN 上界 tPFC/nt_{\text{PFC}}/n397÷64397 \div 64≈6.2\approx 6.2 KBone and a half 4 KB packets一個半 4 KB 封包

Headroom alone takes a fifth of the buffer, and the remaining static tPFCt_{\text{PFC}} of about 397 KB is enough for ordinary queueing. But Section 7.4 will show that the ECN threshold must sit below tPFC/nt_{\text{PFC}}/n, here about 6 KB, one and a half packets. A shallow-buffer 400G leaf cannot run DCQCN as the paper intended.

光是 headroom 就占去緩衝的五分之一,剩下約 397 KB 的靜態 tPFCt_{\text{PFC}} 對一般排隊夠用。但 第 7.4 節 會顯示 ECN 門檻必須低於 tPFC/nt_{\text{PFC}}/n,這裡約 6 KB,一個半封包。淺緩衝的 400G leaf 無法以論文原本的方式跑 DCQCN。

Stop and think停下來想一想

In Panel 7.4, keep 12 MB and move only the link speed to 400G. How many lossless priorities can the switch afford before tPFCt_{\text{PFC}} falls below one MTU? That is what "two of eight" becomes at 400G.

在面板 7.4 保留 12 MB,只把鏈路速度移到 400G。在 tPFCt_{\text{PFC}} 掉到一個 MTU 以下之前,交換器負擔得起幾個無損優先權?這就是「八中取二」在 400G 變成的數字。

A slow receiver, step by step一個慢的接收端,一步一步看

Before a buffer can be the target of RDMA, the application registers it: the memory is pinned, and the NIC receives the map from virtual to physical addresses. The NIC keeps that map in a memory translation table (MTT) and caches the hot entries. The Microsoft slow-receiver incident shows what happens when the cache is too small. Their NICs cached 2K entries; with 4 KB pages that covers 8 MB. A receiver with a larger working set missed the cache on nearly every packet, each miss stalled the receive pipeline, the receive buffer filled, and the NIC sent PFC pause frames upstream (Figure 7.7). A healthy server became a source of back-pressure for everyone behind it. The fix was 2 MB huge pages: the same 2K entries then cover 4 GB, 512× more. Training buffers are large regions of HBM registered once, so modern NICs use large pages by default, but the lesson stands: in a lossless network, any slow endpoint is a network problem.

一個緩衝區要能成為 RDMA 的目標,應用程式必須先註冊它:記憶體被釘住,NIC 收到虛擬到物理位址的對應表。NIC 把這張表放在記憶體轉換表(MTT)裡,並快取熱門的項目。Microsoft 的慢接收端事件顯示快取太小時會發生什麼。他們的 NIC 快取 2K 筆項目;用 4 KB 分頁只涵蓋 8 MB。工作集更大的接收端幾乎每個封包都快取失誤,每次失誤拖慢接收管線,接收緩衝填滿,NIC 向上游送出 PFC 暫停幀(圖 7.7)。一台健康的伺服器成了它後面所有人的反壓來源。修法是 2 MB 的大分頁:同樣 2K 筆項目涵蓋 4 GB,多 512 倍。訓練緩衝區是一次註冊的大片 HBM,所以現代 NIC 預設使用大分頁,但教訓仍然成立:在無損網路裡,任何慢的端點都是網路問題。

4 KB pages: before the fix4 KB 分頁:修正前MTT cacheMTT 快取2K × 4 KB = 8 MBworking set工作集> 8 MB: misses> 8 MB:失誤pipeline stalls管線停滯buffer fills緩衝填滿PFC PAUSEsent upstream送往上游2 MB huge pages: the fix2 MB 大分頁:修正後MTT cacheMTT 快取2K × 2 MB = 4 GBworking set工作集fits: hits放得下:命中line rate, no pause frames線速,不送暫停幀same 2K entries, 512× more memory covered同樣 2K 筆項目,涵蓋的記憶體多 512 倍
Figure 7.7. The Microsoft slow-receiver incident. In the top row the NIC uses 4 KB pages, so its MTT cache of 2K entries covers only 8 MB, and a larger working set misses on nearly every packet, which stalls the receive pipeline and fills the receive buffer until the NIC sends PFC pause frames upstream. In the bottom row the same cache maps 2 MB pages and covers 4 GB, and the pauses stop.圖 7.7。Microsoft 的慢接收端事件。上排的 NIC 使用 4 KB 分頁,有 2K 筆項目的 MTT 快取只涵蓋 8 MB,因此更大的工作集幾乎每個封包都失誤,接收管線隨之停滯,接收緩衝逐漸填滿,最後 NIC 向上游送出 PFC 暫停幀。下排的同一個快取改用 2 MB 分頁,涵蓋 4 GB,暫停也就停止了。Drawn for this primer from the Microsoft RoCE paper (SIGCOMM 2016) as Section 2.4 describes it.

Animation 7.3 replays the slow-receiver incident one packet at a time. Switch to 2 MB pages to see the fix.

動畫 7.3 一個封包一個封包地重播慢接收端事件。切到 2 MB 分頁看修法。

Animation 7.3動畫 7.3

An MTT cache miss stalls the NIC, and the NIC sends pauseMTT 快取失誤拖住 NIC,NIC 送出暫停

A sketch of the Microsoft slow-receiver incident (Figure 7.7). The cache figures are the paper's: 2K entries cover 8 MB with 4 KB pages and 4 GB with 2 MB pages. The number of packets, the eight buffer cells and the position of the threshold are illustrative, and time is not to scale.

Microsoft 慢接收端事件的示意(圖 7.7)。快取數字取自論文:2K 筆項目在 4 KB 分頁下涵蓋 8 MB,在 2 MB 分頁下涵蓋 4 GB。封包數、八格緩衝與門檻的位置只是示意,時間不按比例。

7.4Congestion control: ECN and DCQCN壅塞控制:ECN 與 DCQCN

PFC is a last resort. The better fix is to slow the sender before the buffer fills. When a queue passes a threshold, the switch sets the ECN bit in the packet header. The receiver sees the mark and sends a congestion notification packet (CNP) back to the sender. The sender's NIC then cuts its rate, and slowly raises it again. This algorithm is DCQCN (2015), and it is the default on most RoCE NICs. Other designs measure delay instead of marks: TIMELY and Swift (Google), and HPCC (Alibaba), which reads exact queue sizes from in-band telemetry.

PFC 是最後手段。更好的做法是在緩衝區滿之前就讓發送端慢下來。當佇列超過一個門檻,交換器就在封包標頭設定 ECN 位元。接收端看到標記後,回送一個壅塞通知封包(CNP)給發送端。發送端的 NIC 於是降速,再慢慢升回來。這個演算法是 DCQCN(2015),也是多數 RoCE NIC 的預設。其他設計改量延遲而非標記:TIMELY 與 Swift(Google),以及 HPCC(Alibaba)——它從帶內遙測讀取精確的佇列長度。

Panel 7.5面板 7.5

One switch queue: ECN marks, PFC pauses, and the sender's rate一個交換器佇列:ECN 標記、PFC 暫停與發送端速率

Pause frames sent
送出的 PAUSE 幀數
ECN-marked packets
被 ECN 標記的封包數
Link utilization
鏈路使用率
Average queueing delay
平均排隊延遲

A 400G port drains 50 MB per millisecond. Two senders offer the load you set. Thresholds: ECN marking starts at 25% of the buffer; PFC pause is sent at 80% and released at 50%. With PFC only, the queue oscillates near the pause line and the pauses propagate upstream. With DCQCN, the senders back off at the marks and the queue settles low. "Receiver-driven" is Meta's approach: the receiver grants a fixed number of in-flight bytes, so the queue can never exceed what it granted.

一個 400G 埠每毫秒排出 50 MB。兩個發送端以你設定的負載送入。門檻:ECN 標記從緩衝區 25% 開始;PFC 在 80% 送出暫停、50% 解除。只有 PFC 時,佇列在暫停線附近震盪,而且暫停會往上游傳播。有 DCQCN 時,發送端在被標記後退讓,佇列穩定在低水位。「接收端驅動」是 Meta 的做法:接收端授權固定數量的在途位元組,佇列因此不可能超過授權量。

Why PFC alone is not enough. PFC acts on ports, never on flows; the parking-lot and victim-flow rows above are the consequence. The cure is to slow the senders that cause a queue before it reaches tPFCt_{\text{PFC}}. DCQCN (Microsoft and Mellanox, SIGCOMM 2015) does this with three roles that all run in hardware (DCQCN paper). Figure 7.8 shows the loop they form.

為何只有 PFC 不夠。PFC 作用在埠上、永不作用在流上;上表的停車場與受害者流就是後果。解藥是在佇列到達 tPFCt_{\text{PFC}} 之前,先讓造成佇列的發送端減速。DCQCN(微軟與 Mellanox,SIGCOMM 2015)以三個全在硬體中運行的角色做到這點(DCQCN 論文)。圖 7.8 畫出它們構成的迴路。

RP · sender NICRP · 發送端 NICCP · switchCP · 交換器NP · receiver NICNP · 接收端 NICon each CNP:每收到一個 CNP:RT ← RC RC ← RC(1 − α/2)α ← (1 − g)α + gquiet 55 µs: α decays55 µs 無 CNP:α 衰減marked packet →收到標記封包 →send a CNP, but回送 CNP,但at most one per每條流每 50 µsflow per 50 µs最多一個1Pmax mark prob.標記機率queue佇列Kmin Kmax data資料data + ECN資料 + ECNCNP (high-priority class)CNP(高優先權類別)deployed: Kmin 5 KB · Kmax 200 KB · Pmax 1% · g = 1/256 · timer 55 µs部署值:Kmin 5 KB · Kmax 200 KB · Pmax 1% · g = 1/256 · 計時器 55 µs
Figure 7.8. DCQCN's three roles. The switch (CP) marks packets with a probability that is 0 below Kmin⁡K_{\min}, rises to Pmax⁡P_{\max} at Kmax⁡K_{\max}, and is 1 above Kmax⁡K_{\max}; the curve is not to scale. The receiving NIC (NP) turns marks into at most one CNP per flow per 50 µs. The sending NIC (RP) cuts its rate on each CNP, and α\alpha decays when no CNP arrives.圖 7.8。DCQCN 的三個角色。交換器(CP)標記封包的機率在 Kmin⁡K_{\min} 以下為 0,到 Kmax⁡K_{\max} 時升到 Pmax⁡P_{\max},超過 Kmax⁡K_{\max} 則為 1;曲線不按比例。接收端 NIC(NP)把標記轉成每條流每 50 µs 最多一個 CNP。發送端 NIC(RP)每收到一個 CNP 就降低速率,沒有 CNP 時 α\alpha 衰減。Drawn for this primer from Zhu et al., SIGCOMM 2015 (DCQCN §3).

Congestion point (the switch). At each egress queue the switch marks the ECN bits of passing packets with a RED-style probability: zero below a queue length Kmin⁡K_{\min}, rising linearly to Pmax⁡P_{\max} at Kmax⁡K_{\max}, and every packet marked above Kmax⁡K_{\max}. The deployed values were Kmin⁡=5 KB{K_{\min} = 5\,\text{KB}}, Kmax⁡=200 KB{K_{\max} = 200\,\text{KB}}, Pmax⁡=1%{P_{\max} = 1\%}. The marking is deliberately gentle.

壅塞點(交換器)。在每個出口佇列,交換器以 RED 式的機率標記經過封包的 ECN 位元:佇列長度低於 Kmin⁡K_{\min} 時為零,線性上升到 Kmax⁡K_{\max} 時的 Pmax⁡P_{\max},超過 Kmax⁡K_{\max} 則每個封包都標記。部署值為 Kmin⁡=5 KB{K_{\min} = 5\,\text{KB}}、Kmax⁡=200 KB{K_{\max} = 200\,\text{KB}}、Pmax⁡=1%{P_{\max} = 1\%}。標記刻意溫和。

Notification point (the receiving NIC). When a marked packet arrives for a flow, the NIC sends a congestion notification packet (CNP) back to the sender, but at most one per flow every N=50 μs{N = 50\,\mu\text{s}}, however many marked packets arrived. The CNP travels in a high-priority class.

通知點(接收端 NIC)。當某條流的標記封包到達,NIC 送回一個壅塞通知封包(CNP)給發送端,但每條流每 N=50 μs{N = 50\,\mu\text{s}} 最多一個,無論到達了多少標記封包。CNP 走高優先權類別。

Reaction point (the sending NIC). The sender keeps a current rate RCR_C, a target rate RTR_T, and an estimate α\alpha of how congested the path is. On a CNP it remembers the current rate as the target and cuts:

反應點(發送端 NIC)。發送端維護目前速率 RCR_C、目標速率 RTR_T,以及路徑壅塞程度的估計 α\alpha。收到 CNP 時,它把目前速率記為目標並削減:

RT←RCRC←RC(1−α2)α←(1−g) α+g \begin{aligned} R_T &\leftarrow R_C \\ R_C &\leftarrow R_C \left(1 - \frac{\alpha}{2}\right) \\ \alpha &\leftarrow (1 - g)\,\alpha + g \end{aligned}

If no CNP arrives within K=55 μs{K = 55\,\mu\text{s}} (longer than the CNP interval, so a congested flow is not mistaken for an idle one), α\alpha decays: α←(1−g) α{\alpha \leftarrow (1 - g)\,\alpha}. So α\alpha tracks the fraction of windows that carried a mark: a flow marked in every window halves on each CNP, while a flow marked once after a quiet period is cut only slightly. The gain is g=1/256{g = 1/256}; 1/16 was tested and rejected as too jumpy. Rate increase runs on the same 55 µs timer or on a 10 MB byte counter, whichever fires first, in three phases. Fast recovery: five steps of RC←(RT+RC)/2{R_C \leftarrow (R_T + R_C)/2}. Additive increase: RT←RT+RAI{R_T \leftarrow R_T + R_{\text{AI}}} with RAI=40 Mb/s{R_{\text{AI}} = 40\,\text{Mb/s}}, probing above the old target. Hyper increase: after several more quiet rounds, larger and growing steps. There is no slow start; a new flow begins at line rate.

若 K=55 μs{K = 55\,\mu\text{s}} 內沒有 CNP 到達(比 CNP 間隔長,壅塞的流才不會被誤認為閒置),α\alpha 衰減:α←(1−g) α{\alpha \leftarrow (1 - g)\,\alpha}。所以 α\alpha 追蹤帶有標記的窗口比例:每個窗口都被標記的流每個 CNP 都減半,安靜一段時間後只被標記一次的流只被稍微削減。增益是 g=1/256{g = 1/256};1/16 經測試後因太跳動而被否決。速率增加在同一個 55 µs 計時器或 10 MB 的位元組計數器(先到者)上運行,分三個階段。快速恢復:五步 RC←(RT+RC)/2{R_C \leftarrow (R_T + R_C)/2}。加性增加:RT←RT+RAI{R_T \leftarrow R_T + R_{\text{AI}}},RAI=40 Mb/s{R_{\text{AI}} = 40\,\text{Mb/s}},探測舊目標之上。超速增加:再經過幾輪安靜後,用更大、且逐漸增大的步伐。沒有慢啟動;新的流從線速開始。

Animation 7.4 runs one turn of the loop with two senders: mark, CNP, cut, fast recovery and additive increase.

動畫 7.4 以兩個發送端跑一圈迴圈:標記、CNP、降速、快速恢復與加性增加。

Animation 7.4動畫 7.4

One turn of the DCQCN loopDCQCN 迴圈走一圈

Two senders share one 40 Gb/s port, with the deployed parameters: Kmin⁡K_{\min} 5 KB, Kmax⁡K_{\max} 200 KB, Pmax⁡P_{\max} 1%, at most one CNP per flow per 50 µs, a 55 µs timer, g=1/256{g = 1/256}, RAI=40{R_{\text{AI}} = 40} Mb/s and five fast-recovery steps. α\alpha starts at 1, a flow marked in every window, so each cut halves the rate. The rates follow the equations in the text. Simplified: both senders receive their CNPs at the same moment, propagation delay is ignored, the queue is drawn schematically, and it falls below Kmin⁡K_{\min} before the first 55 µs timer fires. The clock counts from the first CNP.

兩個發送端共用一個 40 Gb/s 埠,使用部署參數:Kmin⁡K_{\min} 5 KB、Kmax⁡K_{\max} 200 KB、Pmax⁡P_{\max} 1%、每條流每 50 µs 最多一個 CNP、55 µs 計時器、g=1/256{g = 1/256}、RAI=40{R_{\text{AI}} = 40} Mb/s 與五步快速恢復。α\alpha 從 1 開始,即每個時間窗都被標記的流,所以每次降速都減半。速率依正文的方程式計算。簡化:兩個發送端同時收到 CNP、忽略傳播延遲、佇列以示意方式畫出,並假設佇列在第一個 55 µs 計時器到期前降到 Kmin⁡K_{\min} 以下。時鐘從第一個 CNP 起算。

Why g=1/256{g = 1/256} is slow. With g=1/256{g = 1/256}, α\alpha moves 0.4% of the way toward its target per event, so climbing from 0 to 0.5 takes about 177 marked windows, 8.9 ms. In that time a 400G sender puts 440 MB into the network. A sudden incast therefore overflows any shallow buffer before α\alpha has learned anything, which is why DCQCN kept PFC as the backstop, and why at 400G Meta found the backstop doing most of the work (Section 7.5).

為何 g=1/256{g = 1/256} 很慢。g=1/256{g = 1/256} 時,α\alpha 每個事件只朝目標移動 0.4%,所以從 0 爬到 0.5 約需 177 個被標記的窗口,即 8.9 ms。這段時間一個 400G 發送端放進網路 440 MB。因此突發的 incast 早在 α\alpha 學到任何東西之前就淹沒任何淺緩衝,這就是為什麼 DCQCN 保留 PFC 作為後盾,也是為什麼 Meta 在 400G 發現後盾做了大部分的工作(第 7.5 節)。

Panel 7.6面板 7.6

DCQCN rate dynamics: NN senders into one linkDCQCN 速率動態:NN 個發送端進入一條鏈路

Converged rate per sender
收斂後每發送端速率
Fair share
公平份額
Max queue
最大佇列
CNPs in 100 ms
100 ms 內的 CNP 數
PFC would have fired
PFC 是否會觸發

Defaults are the DCQCN paper's incast of 10 on a 40 Gb/s link with its deployed parameters (Kmin⁡K_{\min} 5 KB, Kmax⁡K_{\max} 200 KB, Pmax⁡P_{\max} 1%, g=1/256{g = 1/256}, CNP every 50 µs, timer 55 µs, byte counter 10 MB, RAIR_{\text{AI}} 40 Mb/s, five fast-recovery steps, 1.5 KB packets; the hyper-increase step is assumed to be 10×RAI{10 \times R_{\text{AI}}}). The simulation runs 100 ms in 1 µs steps (the converged rate is measured over the last 10 ms); all senders start at line rate with no slow start, and each flow gets its own CNP latency of 10–30 µs. The PFC pause line is fixed at 500 KB of egress queue; above it the senders are paused until the queue drains to half, as a lossless switch would. Try 400G with the same thresholds, then try g=1/16{g = 1/16} to see why it was rejected as too jumpy.

預設值是 DCQCN 論文在 40 Gb/s 鏈路上的 10 對 1 incast 與其部署參數(Kmin⁡K_{\min} 5 KB、Kmax⁡K_{\max} 200 KB、Pmax⁡P_{\max} 1%、g=1/256{g = 1/256}、每 50 µs 一個 CNP、計時器 55 µs、位元組計數器 10 MB、RAIR_{\text{AI}} 40 Mb/s、五步快速恢復、1.5 KB 封包;超速增加的步長假設為 10×RAI{10 \times R_{\text{AI}}})。模擬以 1 µs 步長跑 100 ms(收斂速率取最後 10 ms 的平均);所有發送端從線速開始,沒有慢啟動,每條流有自己 10–30 µs 的 CNP 延遲。PFC 暫停線固定在出口佇列 500 KB;超過它時發送端被暫停直到佇列排到一半,如同無損交換器的行為。試試同樣門檻下的 400G,再試 g=1/16{g = 1/16},看看為什麼它因太跳動被否決。

The safety inequality. DCQCN only helps if the switch marks before it pauses. If PFC fires first, senders never slow down and every pathology of Section 7.3 returns. ECN marking happens at the egress queue; PFC thresholds apply to ingress counters. In the worst case, the packets held by one ingress port are spread across all nn egress queues, each just below tECNt_{\text{ECN}}, so that port can hold n⋅tECN{n \cdot t_{\text{ECN}}} bytes without a single mark. For marking to be guaranteed first, the pause threshold must exceed that:

安全不等式。DCQCN 只有在交換器先標記、後暫停時才有幫助。若 PFC 先觸發,發送端永遠不減速,第 7.3 節 的每一種病症都會回來。ECN 標記發生在出口佇列;PFC 門檻作用於入口計數器。最差情況下,一個入口埠持有的封包分散在全部 nn 個出口佇列、每個都剛好低於 tECNt_{\text{ECN}},所以該埠可以持有 n⋅tECN{n \cdot t_{\text{ECN}}} 位元組而沒有任何一個標記。要保證標記先發生,暫停門檻必須超過它:

tPFC>n⋅tECN t_{\text{PFC}} \gt n \cdot t_{\text{ECN}}

The static 24.47 KB threshold of Section 7.3 would allow tECNt_{\text{ECN}} below 0.76 KB, less than one packet; the dynamic threshold rescues it. When one port is hot and the others idle, that port is paused when its counter exceeds the free buffer divided by β\beta: q>(B′−q)/β{q \gt (B' - q)/\beta}, where B′=B−8n⋅headroom=6.27 MBB' = {B - 8n \cdot \text{headroom}} = 6.27\,\text{MB}. Solving, qpause=B′/(1+β)=696 KB{q_{\text{pause}} = {B'/(1 + \beta)} = 696\,\text{KB}} for β=8{\beta = 8}. Dividing by n=32{n = 32} gives the paper's bound:

第 7.3 節 的靜態門檻 24.47 KB 只允許 tECNt_{\text{ECN}} 低於 0.76 KB,不到一個封包;動態門檻救了它。當一個埠熱、其他埠閒置時,該埠在計數器超過空閒緩衝除以 β\beta 時被暫停:q>(B′−q)/β{q \gt (B' - q)/\beta},其中 B′=B−8n⋅headroom=6.27 MBB' = {B - 8n \cdot \text{headroom}} = 6.27\,\text{MB}。解得 qpause=B′/(1+β){q_{\text{pause}} = B'/(1 + \beta)},β=8{\beta = 8} 時為 696 KB。除以 n=32{n = 32} 得到論文的上界:

tECN<B′n(1+β)=21.75 KB t_{\text{ECN}} \lt \frac{B'}{n(1 + \beta)} = 21.75\,\text{KB}

The lesson every AI-network paper inherits: the ECN threshold is bounded by buffer divided by port count. Figure 7.9 draws the worst case behind it.

每篇 AI 網路論文繼承的教訓:ECN 門檻受緩衝除以埠數限制。圖 7.9 畫出它背後的最差情況。

one ingress port一個入口埠n egress queues, each just under tECN n 個出口佇列,各自剛好低於 tECN tPFC holds持有n × tECN 1234n…tECN marking comes first only if tPFC > n × tECN 只有當 tPFC > n × tECN 時,標記才會先發生Trident II, n = 32, β = 8: pause at 696 KB, so tECN < 696 KB / 32 = 21.75 KBTrident II,n = 32、β = 8:在 696 KB 暫停,所以 tECN < 696 KB / 32 = 21.75 KB
Figure 7.9. The worst case behind the mark-before-pause rule. The bytes that one ingress port holds are spread over all nn egress queues. Each queue stays just under tECNt_{\text{ECN}}, so no packet is marked, while the ingress counter already holds n⋅tECNn \cdot t_{\text{ECN}}. The pause threshold must sit above that level, or PAUSE fires before any sender learns of the congestion.圖 7.9。先標記、後暫停規則背後的最差情況。一個入口埠持有的位元組分散在全部 nn 個出口佇列。每個佇列都剛好低於 tECNt_{\text{ECN}},所以沒有封包被標記,而入口計數器已持有 n⋅tECNn \cdot t_{\text{ECN}}。暫停門檻必須高於這個水位,否則 PAUSE 會在任何發送端得知壅塞之前觸發。Drawn for this primer from Zhu et al., SIGCOMM 2015 (DCQCN §4).

Animation 7.5 fills the switch of Figure 7.9 step by step and shows which signal fires first for the tECNt_{\text{ECN}} you choose.

動畫 7.5 逐步填滿圖 7.9 的交換器,並顯示在你選的 tECNt_{\text{ECN}} 下哪個訊號先觸發。

Animation 7.5動畫 7.5

Mark before pause: which signal fires first先標記、後暫停:哪個訊號先觸發

The worst case of Figure 7.9 on the DCQCN authors' Trident II: n=32{n = 32} ports, B′=6.27{B' = 6.27} MB of free buffer and β=8{\beta = 8}. One hot ingress port spreads its bytes evenly over all 32 egress queues, and no egress queue drains. PFC pauses the port at B′/(1+β)=696{B'/(1 + \beta)} = 696 KB, when each egress queue holds 21.75 KB. 5 KB is the deployed Kmin⁡K_{\min}; choose 40 KB to break the rule. How fast the senders react to the marks is not modelled.

DCQCN 作者的 Trident II 上的圖 7.9 最壞情況:n=32{n = 32} 個埠、B′=6.27{B' = 6.27} MB 的可用緩衝、β=8{\beta = 8}。一個熱入口埠把位元組平均分散到全部 32 個出口佇列,且沒有出口佇列在排空。PFC 在 B′/(1+β)=696{B'/(1 + \beta)} = 696 KB 時暫停這個埠,此時每個出口佇列只有 21.75 KB。5 KB 是部署的 Kmin⁡K_{\min};選 40 KB 看規則被打破。發送端對標記反應多快,這裡不模擬。

Results. With DCQCN the parking-lot senders received equal shares and the victim flow stopped losing throughput. In KK-to-1 incast on 40 Gb/s, total throughput stayed above 39 Gb/s for KK up to 19 and the queue never exceeded 100 KB. At incast degree 10, the 10th-percentile flow rate rose from 1.12 Gb/s to 3.43 Gb/s, a 3× better tail. The two spine switches received more than 6 million PAUSE frames without DCQCN and about 3,000 with it. It carried 16× more traffic (80 pairs instead of 5). And with PFC disabled entirely, the 10th-percentile incast throughput was zero: go-back-N never recovered from persistent loss. DCQCN makes PFC rare, not unnecessary.

結果。有 DCQCN 時,停車場的發送端得到相等的份額,受害者流也不再失去吞吐。40 Gb/s 上的 KK 對 1 incast,KK 到 19 時總吞吐仍高於 39 Gb/s,佇列從未超過 100 KB。incast 度為 10 時,第 10 百分位的流速率從 1.12 Gb/s 升到 3.43 Gb/s,尾端改善 3 倍。兩台 spine 交換器沒有 DCQCN 時收到超過六百萬個 PAUSE 幀,有 DCQCN 時約三千個。承載的流量多 16 倍(80 對而非 5 對)。而完全關閉 PFC 時,incast 的第 10 百分位吞吐是零:go-back-N 永遠無法從持續丟包恢復。DCQCN 讓 PFC 罕見,而非不必要。

Stop and think停下來想一想

In Panel 7.6, set 400G with the 2015 thresholds. How many pauses does the simulation count before the first CNP takes effect? Then raise Kmax⁡K_{\max} toward 2 MB: you are doing what Meta did at 200G with 5 MB, trading a little rate control for far fewer pauses.

在面板 7.6 設 400G 與 2015 年的門檻。在第一個 CNP 生效之前,模擬計到幾次暫停?再把 Kmax⁡K_{\max} 提高到 2 MB:你做的就是 Meta 在 200G 以 5 MB 做的事,用一點速率控制換取少得多的暫停。

7.5Why the AI networks diverge from the recipeAI 網路為何偏離標準做法

The recipe and its assumptions. The 2015–2016 design is PFC as a backstop plus DCQCN as the regulator, tuned for 40 Gb/s links, millisecond-scale storage flows, and thousands of flows per switch. Training traffic breaks all three: 200–400 Gb/s links, flows that are either at line rate or silent, and tens of flows per switch that all start at the same moment. Each operator reacted differently (Meta RoCE, MegaScale, Llama 3).

配方與它的假設。2015–2016 年的設計是 PFC 作後盾、DCQCN 作調節器,為 40 Gb/s 鏈路、毫秒級的儲存流與每台交換器數千條流而調校。訓練流量打破這三個假設:200–400 Gb/s 的鏈路、要嘛線速要嘛沉默的流,以及每台交換器只有數十條、且在同一瞬間開始的流。每個營運者的反應不同(Meta RoCE、MegaScale、Llama 3)。

Meta at 200G: relax the thresholds. Meta ran DCQCN with an ECN threshold of 5 MB, 25 times the paper's Kmax⁡K_{\max}. Tightening it toward the recommended values gained about 3% in AlltoAll tests but made PFC pauses two to three times worse: the senders slowed too much and the bursts piled up elsewhere. They kept 5 MB. By the Section 7.4 bound, 5 MB on a 64-port shared-buffer chip would need about 5 MB×64×9≈2.9 GB{5\,\text{MB} \times 64 \times 9} \approx 2.9\,\text{GB} of free buffer; the number only makes sense on Meta's spine, a modular chassis with deep buffers carved per port. Chapter 6 shows where that spine sits in Meta's AI Zone.

Meta 在 200G:放寬門檻。Meta 以 5 MB 的 ECN 門檻跑 DCQCN,是論文 Kmax⁡K_{\max} 的 25 倍。往建議值調緊只讓 AlltoAll 測試多了約 3%,PFC 暫停卻惡化兩到三倍:發送端減速過頭、突發堆到別處。他們保留了 5 MB。依 第 7.4 節 的上界,64 埠共享緩衝晶片上的 5 MB 需要約 5 MB×64×9≈2.9 GB{5\,\text{MB} \times 64 \times 9} \approx 2.9\,\text{GB} 的空閒緩衝;這個數字只在 Meta 的 spine 上說得通:一台深緩衝按埠切分的模組化機箱。第 6 章標出這個 spine 在 Meta AI Zone 中的位置。

The Meta paper reports a surprising decision. When they moved to 400G, DCQCN with default settings reduced performance, and the NIC firmware had bugs in counting CNPs. So they turned DCQCN off. Their 400G clusters ran for over a year with PFC only, and they saw no persistent congestion. Two things made this possible. First, the deep-buffer CTSW spines absorb bursts. Second, NCCL's own protocol is receiver-driven: the receiver sends a clear-to-send message before the sender may post an RDMA write, and the number of channel buffers limits how many bytes are in flight. Meta tuned those buffers and gave the clear-to-send packets a high-priority queue in the switches. The lesson: the collective library and the network are one system, and the library already has a form of admission control.

Meta 的論文報告了一個出人意料的決定。升級到 400G 時,預設參數的 DCQCN 降低了效能,而且 NIC 韌體在計數 CNP 時有錯誤。於是他們關掉了 DCQCN。他們的 400G 叢集只靠 PFC 跑了超過一年,沒有看到持續性壅塞。兩件事讓這成為可能。第一,深緩衝的 CTSW spine 吸收了突發。第二,NCCL 自己的協定是接收端驅動的:接收端先送出 clear-to-send 訊息,發送端才可以提交 RDMA 寫入,而 channel 緩衝區的數量限制了在途位元組數。Meta 調整了這些緩衝區,並在交換器上給 clear-to-send 封包一個高優先權佇列。啟示是:集體通訊函式庫與網路是同一個系統,而函式庫本身已經有一種許可控制。

Meta at 400G: no DCQCN at all. New 400G NIC firmware had bugs in counting CNPs and its defaults reduced performance, so Meta turned DCQCN off. The 400G clusters ran for more than a year on PFC alone, and in four years a spine never sent persistent pauses to the rack switches. Two things made that safe: deep spine buffers absorb bursts that a 50 µs feedback loop cannot catch, and NCCL's protocol is receiver-driven: the sender may post an RDMA write only after the receiver's clear-to-send (CTS) names a free channel buffer, and the number of channel buffers is fixed. That is a static cap on bytes in flight, enforced by the library: IRN's idea of capping bytes in flight (Section 7.6). Meta tuned the buffer count per job and put CTS packets in a high-priority class; their 90th-percentile delay fell from 43 µs to 4 µs. In a 16-to-1 incast test with no DCQCN, no PFC back-pressure was observed. A PFC watchdog still fires at 200 ms of pause, Microsoft's value, and a buffer alarm at 80%. Figure 7.10 draws the handshake.

Meta 在 400G:完全不用 DCQCN。新的 400G NIC 韌體在計數 CNP 時有錯誤、預設參數反而降低效能,所以 Meta 關掉了 DCQCN。400G 叢集只靠 PFC 跑了超過一年,四年來 spine 從未向機櫃交換器送出持續的暫停。兩件事讓這樣是安全的:深的 spine 緩衝吸收 50 µs 回饋迴路抓不到的突發,而 NCCL 的協定是接收端驅動的:發送端只有在接收端的 clear-to-send(CTS)指名空閒 channel 緩衝區後才能提交 RDMA write,而 channel 緩衝區數量固定。那是由函式庫執行的在途位元組靜態上限:IRN 限制在途位元組的想法(第 7.6 節)。Meta 依任務調校緩衝區數量,並把 CTS 封包放進高優先權類別;其第 90 百分位延遲從 43 µs 降到 4 µs。在不用 DCQCN 的 16 對 1 incast 測試中,沒有觀察到 PFC 反壓。PFC watchdog 仍在暫停 200 ms 時觸發(微軟的值),緩衝警報在 80% 觸發。圖 7.10 畫出這個交握。

sender發送端receiver接收端CTS: buffer k is freeCTS:緩衝區 k 空閒waits for CTS等待 CTSRDMA write into buffer kRDMA write 寫入緩衝區 kcopy out,複製出來,recycle回收緩衝區next CTS下一個 CTSnext write …下一次寫入 …bytes in flight ≤ number of channel buffers × buffer size在途位元組 ≤ channel 緩衝區數 × 緩衝區大小Meta put CTS in a high-priority class: P90 CTS delay 43 µs → 4 µsMeta 把 CTS 放進高優先權類別:P90 CTS 延遲 43 µs → 4 µs
Figure 7.10. NCCL's receiver-driven handshake, as Meta's paper describes it. The sender may write only into a channel buffer that a CTS has named. The receiver's GPU copies the data out, the CPU proxies recycle the buffer, and only then does the receiver send the next CTS. A fixed number of buffers therefore puts a fixed cap on the bytes in flight.圖 7.10。Meta 論文描述的 NCCL 接收端驅動交握。發送端只能寫入 CTS 指名的 channel 緩衝區。接收端的 GPU 把資料複製出來,CPU proxy 回收緩衝區,之後接收端才送出下一個 CTS。所以固定數量的緩衝區為在途位元組設下固定的上限。Drawn for this primer from Gangidi et al., SIGCOMM 2024 (Meta RoCE).

Panel 7.7 models this handshake: the buffer count, the CTS delay and the round trip together set how much of a 400G link the data can fill.

面板 7.7 為這個交握建立模型:緩衝區數量、CTS 延遲與往返時間共同決定資料能填滿多少 400G 鏈路。

Panel 7.7面板 7.7

Clear-to-send: how many channel buffers fill a 400G link?Clear-to-send:多少 channel 緩衝區才能塞滿 400G 鏈路?

Cap on bytes in flight kSkS
在途位元組上限 kSkS
One BDP at 400G
400G 下的一個 BDP
Link fill (model)
鏈路使用率(模型)
Buffers needed to fill the link
塞滿鏈路所需的緩衝區數

This is a model in which each channel buffer is used once per cycle, and a cycle is one round trip, plus the CTS delay dd, plus the time to write SS at 400 Gb/s; the receiver's copy-out time is ignored. So the link fill is min⁡(1, kS/(C(RTT+d)+S))\min(1,\ kS/(C(\mathrm{RTT} + d) + S)). Defaults: Meta's measured 22 µs RTT and the P90 CTS delay of 43 µs before Meta put CTS in a high-priority class (4 µs after). The buffer count and size are free inputs: the papers do not give NCCL's default values. Meta reports that more buffers, CTS priority and switch credit tuning together gave more than 2× in many cases.

在這個模型中,每個 channel 緩衝區每個週期用一次,一個週期是一次往返,加上 CTS 延遲 dd,再加上以 400 Gb/s 寫入 SS 的時間;忽略接收端複製資料的時間。所以鏈路使用率是 min⁡(1, kS/(C(RTT+d)+S))\min(1,\ kS/(C(\mathrm{RTT} + d) + S))。預設值:Meta 實測的 22 µs RTT,以及 Meta 把 CTS 放進高優先權類別之前的 P90 CTS 延遲 43 µs(之後為 4 µs)。緩衝區數量與大小是自由輸入:論文沒有給出 NCCL 的預設值。Meta 報告,增加緩衝區、提高 CTS 優先權並調校交換器 credit,合起來在許多情況下帶來超過 2 倍的改善。

Llama 3: the same choice at 24K GPUs. The Llama 3 report confirms the design in production: a three-layer Clos of 24,000 GPUs built from Arista 7800 spines and Minipack2 rack switches, 400 Gb/s per GPU, 16 flows per GPU pair spread over many paths (Chapter 8), deep spine buffers, and no DCQCN.

Llama 3:24K 顆 GPU 上的同一個選擇。Llama 3 報告在生產環境確認了這個設計:由 Arista 7800 spine 與 Minipack2 機櫃交換器組成、24,000 顆 GPU 的三層 Clos,每顆 GPU 400 Gb/s,每對 GPU 16 條流分散到多條路徑上(第 8 章),深的 spine 緩衝,而且不用 DCQCN。

ByteDance's MegaScale: a hybrid signal. On a Tomahawk 4 fabric (64 × 400G, shallower buffers than a modular spine), default DCQCN under large all-to-all produced excessive PFC pauses and head-of-line blocking, so ByteDance built a controller that combines Swift's precise RTT measurement with DCQCN's fast ECN-based reaction. RTT is a continuous per-packet signal and an ECN mark one bit per 50 µs; together they warn earlier on a switch that cannot afford a 5 MB threshold. The paper gives no equations or pause counts.

字節跳動的 MegaScale:混合訊號。在 Tomahawk 4 網路上(64 × 400G,緩衝比模組化 spine 淺),預設 DCQCN 在大規模 all-to-all 下產生過多的 PFC 暫停與隊頭阻塞,所以字節跳動建了一個結合 Swift 精確 RTT 量測與 DCQCN 快速 ECN 反應的控制器。RTT 是連續的逐封包訊號,ECN 標記則是每 50 µs 一個位元;兩者並用,在負擔不起 5 MB 門檻的交換器上能更早示警。論文沒有方程式或暫停次數。

HPCC and Swift, briefly. Two research lines replaced the one-bit mark with a richer signal. Alibaba's HPCC (SIGCOMM 2019) has each switch write its exact queue length into the packet with in-band telemetry, so the sender computes precisely how many bytes to remove, but it needs telemetry-capable switches. Google's Swift (SIGCOMM 2020) uses measured RTT and needs nothing from the switches. Neither paper is in this primer's reading list, so we state only the direction: the signal, not the reaction, was DCQCN's weak part.

HPCC 與 Swift,簡述。兩條研究路線用更豐富的訊號取代單位元標記。阿里的 HPCC(SIGCOMM 2019)讓每台交換器用帶內遙測把精確的佇列長度寫進封包,發送端因此能精確算出該移除多少位元組,但需要支援遙測的交換器。Google 的 Swift(SIGCOMM 2020)使用實測 RTT,對交換器沒有任何要求。兩篇論文都不在本入門的閱讀清單,所以我們只陳述方向:DCQCN 的弱點在訊號,不在反應。

The InfiniBand contrast. InfiniBand's link layer is lossless by construction: each receiver advertises credits per virtual lane, and a sender transmits only the bytes it holds credits for, so there is no pause frame and no headroom calculation. Congestion still spreads backward hop by hop, so InfiniBand adds its own end-to-end congestion control. PFC retrofits the credit property onto Ethernet after the fact; Section 7.6 gives the property up instead.

InfiniBand 的對照。InfiniBand 的鏈路層依構造就是無損的:每個接收端為每條 virtual lane 公告 credit,發送端只送出它持有 credit 的位元組,所以沒有暫停幀、沒有 headroom 計算。壅塞仍會逐跳向後擴散,所以 InfiniBand 另加自己的端到端壅塞控制。PFC 是事後把 credit 性質改裝到 Ethernet 上;第 7.6 節 則是放棄這個性質。

Fabric網路Link / switch buffer鏈路 / 交換器緩衝PFCPFCCongestion control壅塞控制What bounds bursts什麼限制突發
Microsoft 201640G; 9–12 MB shallow ToR/leaf40G;9–12 MB 的淺 ToR/leaf2 of 8 classes lossless8 類中 2 類無損DCQCNECN under 22 KB; watchdogs 100/200 msECN 低於 22 KB;watchdog 100/200 ms
Meta 200G200G; deep-buffer modular spine200G;深緩衝模組化 spineYes有DCQCN, ECN at 5 MBDCQCN,ECN 門檻 5 MBRelaxed marking; tighter cost 2–3× more pauses for +3%寬鬆標記;調緊換 +3% 卻多 2–3 倍暫停
Meta 400G / Llama 3400G; deep-buffer spine, 24K GPUs400G;深緩衝 spine,24K 顆 GPUYes, rarely fires有,很少觸發None (firmware bugs in CNP counting)無(韌體計數 CNP 有錯)NCCL clear-to-send with fixed channel buffers; 16 flows per pairNCCL clear-to-send 與固定 channel 緩衝區;每對 16 條流
ByteDance MegaScale400G Tomahawk 4; 2:1 uplinks400G Tomahawk 4;2:1 上行Yes有Swift RTT + DCQCN ECN hybridSwift RTT + DCQCN ECN 混合Earlier signal; retransmit timers tuned更早的訊號;重傳計時器調校
InfiniBandAny; per-lane receive buffers任意;每 lane 的接收緩衝Not needed不需要Own end-to-end scheme自有的端到端方案Hop-by-hop credits per virtual lane每條 virtual lane 的逐跳 credit

Worked example: judge a fabric. Suppose a 400G leaf-spine of shallow-buffer single-chip switches runs DCQCN at the 2015 thresholds with PFC on one class. The Section 7.3–§4 arithmetic gives about 100 KB of headroom per port, a static tPFCt_{\text{PFC}} of a few hundred KB and an ECN bound of a few KB, so the switch pauses before it marks under any real incast. Meta's recipe does not transfer either: both the 5 MB threshold and the "no DCQCN" decision rest on deep per-port spine buffers this fabric lacks. The honest options are ByteDance's (a faster signal, PFC kept) or Section 7.6's (change the NIC).

實例:判斷一個網路。假設一個淺緩衝單晶片交換器建成的 400G leaf-spine,DCQCN 用 2015 年的門檻,PFC 開一個類別。第 7.3 節–§4 的算術給出每埠約 100 KB 的 headroom、幾百 KB 的靜態 tPFCt_{\text{PFC}} 與只有幾 KB 的 ECN 上界,所以在任何真實的 incast 下交換器都先暫停、後標記。Meta 的配方也不能移植:5 MB 門檻與「不用 DCQCN」都建立在這個網路沒有的深每埠 spine 緩衝之上。誠實的選項是字節跳動的(更快的訊號、保留 PFC)或 第 7.6 節 的(改 NIC)。

7.6After PFC: fix the NIC, cap the bytes in flightPFC 之後:修好 NIC、限制在途位元組

Go-back-N and the need for a lossless fabric are properties of today's RoCE NICs, not laws of nature. The IRN paper (SIGCOMM 2018) showed that selective retransmission plus a simple limit on bytes in flight lets RDMA work well without PFC. That idea is now in products. Amazon's SRD transport sprays packets over many paths and tolerates reordering. The Ultra Ethernet Transport (specification 1.0, 2025) adds multipath spraying, selective retransmission, and optional in-network collectives to Ethernet. Meta's 2026 paper on connecting more than 100,000 GPUs caps the bytes in flight per connection in its own communication library, in the same spirit.

Go-back-N 與對無損網路的依賴,是今天 RoCE NIC 的特性,不是自然定律。IRN 論文(SIGCOMM 2018)證明,選擇性重傳加上簡單的在途位元組上限,就能讓 RDMA 在沒有 PFC 的情況下運作良好。這個想法現在已經進入產品。Amazon 的 SRD 傳輸把封包噴灑到多條路徑並容忍亂序。Ultra Ethernet Transport(規範 1.0,2025 年)把多路徑噴灑、選擇性重傳與可選的網內集體通訊加進 Ethernet。Meta 2026 年的後續論文描述了以這些想法為基礎、面向十萬顆以上 GPU 叢集的傳輸層。

IRN's result. IRN (SIGCOMM 2018) made two changes to a simulated RoCE NIC, selective retransmission and a static bytes-in-flight cap, and ran paired comparisons on a 54-server fat-tree at 40 Gb/s. IRN without PFC beat RoCE with PFC by 6% to 83% across every scenario, and by 2.8–3.7× when neither ran congestion control. Adding PFC to IRN made IRN 1.5–2× worse (up to 2.4×), because a pause stalls every flow on a port while a drop costs IRN one retransmission. Removing PFC from RoCE made RoCE 1.5–3× worse. Only the NIC differed; the hardware cost was 3–10% of its cache (IRN paper).

IRN 的結果。IRN(SIGCOMM 2018)對模擬的 RoCE NIC 做了兩個改動——選擇性重傳與靜態的在途位元組上限——並在 40 Gb/s、54 台伺服器的胖樹上做成對比較。不用 PFC 的 IRN 在每種情境都勝過用 PFC 的 RoCE 6% 到 83%,在兩者都沒有壅塞控制時勝 2.8–3.7 倍。給 IRN 加上 PFC 讓 IRN 差 1.5–2 倍(最多 2.4 倍),因為一次暫停讓埠上每條流停滯,而一次丟包只花 IRN 一次重傳。把 PFC 從 RoCE 拿掉讓 RoCE 差 1.5–3 倍。只有 NIC 不同;硬體成本是 NIC 快取的 3–10%(IRN 論文)。

BDP-FC as a static cap. BDP-FC limits each QP to one bandwidth-delay product of unacknowledged bytes: link rate times the round-trip time of the longest path, divided by the MTU to get a packet count. In IRN's setup, 40 Gb/s with 2 µs per link over six hops gives a 24 µs round trip and a cap of 120 KB, about 110 packets. It is not congestion control: it reacts to nothing and never changes. It bounds the queue any one flow can build, and therefore bounds loss. Scale it to a training fabric: 400 Gb/s×22 μs/8=1.1 MB{400\Gbs \times 22\,\mu\text{s}/8} = 1.1\,\text{MB}, about 270 packets of 4 KB. Meta's fixed number of NCCL channel buffers is the same cap one layer up; the 22 µs RTT is why buffers sized for a 10 µs rack could not fill a 400G link. Figure 7.11 shows the cap and the bitmap that tracks it.

BDP-FC 作為靜態上限。BDP-FC 把每個 QP 的未確認位元組限制在一個頻寬延遲乘積:鏈路速率乘以最長路徑的往返時間,除以 MTU 得到封包數。在 IRN 的設定中,40 Gb/s、每鏈路 2 µs、六跳,往返 24 µs,上限 120 KB,約 110 個封包。它不是壅塞控制:不對任何事反應、永不改變。它限制單一流能堆出的佇列,因此也限制了丟包。把它放大到訓練網路:400 Gb/s×22 μs/8=1.1 MB{400\Gbs \times 22\,\mu\text{s}/8} = 1.1\,\text{MB},約 270 個 4 KB 封包。Meta 固定數量的 NCCL channel 緩衝區是上一層的同一個上限;22 µs 的 RTT 就是為什麼為 10 µs 機櫃設計的緩衝區塞不滿 400G 鏈路。圖 7.11 畫出這個上限,以及追蹤它的位圖。

in flight ≤ one BDP (the cap)在途 ≤ 一個 BDP(上限)123✕5678910111213141516ACKed已確認waits for room等待空位bitmap位圖0111111000lost: resend only this遺失:只重送這一個not yet arrived尚未到達IRN, 40 Gb/s × 24 µs: cap 120 KB, about 110 packets, 128-bit bitmapIRN,40 Gb/s × 24 µs:上限 120 KB,約 110 個封包,128 位元位圖400 Gb/s × 22 µs: cap 1.1 MB, about 270 packets of 4 KB400 Gb/s × 22 µs:上限 1.1 MB,約 270 個 4 KB 封包
Figure 7.11. BDP-FC and the bitmap of selective retransmission. A QP may have at most one BDP of unacknowledged packets in flight, so packets 14–16 wait until the window has room. The receiver keeps the packets that arrive after the lost one, so the sender's bitmap shows a single gap, and only that packet is resent. The bitmap must cover the whole window, so it grows with the link rate times the RTT.圖 7.11。BDP-FC 與選擇性重傳的位圖。一個 QP 的未確認在途封包最多一個 BDP,所以封包 14–16 要等窗口有空位。接收端保留遺失封包之後到達的封包,所以發送端的位圖只顯示一個缺口,只重送那一個封包。位圖必須涵蓋整個窗口,所以它隨鏈路速率乘以 RTT 增長。Drawn for this primer from Mittal et al., SIGCOMM 2018 (IRN §3).

Panel 7.8 sizes the cap for a link and shows the queue that several capped flows can still build at one port.

面板 7.8 為一條鏈路計算上限,並顯示多條受限的流仍能在同一個埠堆出多少佇列。

Panel 7.8面板 7.8

BDP-FC: size a static cap on bytes in flightBDP-FC:為在途位元組設定靜態上限

One BDP C×RTTC \times \mathrm{RTT}
一個 BDP C×RTTC \times \mathrm{RTT}
One flow's link fill
單一條流的鏈路使用率
Worst-case queue at the port
該埠的最差佇列
Bitmap bits for one cap
一個上限所需的位圖位元

Model: a capped QP has at most cap\text{cap} bytes in flight, so one flow fills min⁡(1, cap/BDP)\min(1,\ \text{cap}/\mathrm{BDP}) of the link. NN capped flows into one port have at most N⋅capN \cdot \text{cap} bytes in flight; the path holds one BDP, and the rest, N⋅cap−BDPN \cdot \text{cap} - \mathrm{BDP}, waits in that port's queue. The bitmap needs one bit per packet of the cap. Defaults are IRN's setup: 40 Gb/s, a 24 µs round trip, 1 KB packets and a 120 KB cap, which needs about 118 bits; IRN's bitmaps have 128. Try 400G · 4 KB at 22 µs: the cap that fills the link is 1.1 MB, about 270 packets, and the bitmap grows with it.

模型:受限的 QP 最多有 cap\text{cap} 位元組在途,所以單一條流填滿鏈路的 min⁡(1, cap/BDP)\min(1,\ \text{cap}/\mathrm{BDP})。NN 條受限的流進入同一埠時,在途最多 N⋅capN \cdot \text{cap} 位元組;路徑容納一個 BDP,其餘的 N⋅cap−BDPN \cdot \text{cap} - \mathrm{BDP} 在該埠的佇列中等待。位圖對上限內的每個封包需要一個位元。預設值是 IRN 的設定:40 Gb/s、24 µs 往返、1 KB 封包、120 KB 上限,約需 118 位元;IRN 的位圖是 128 位元。試試 400G · 4 KB、22 µs:塞滿鏈路的上限是 1.1 MB,約 270 個封包,位圖也隨之變大。

Receiver-driven credit transports. The next step lets the receiver hand out credit dynamically: it knows its buffer state and how many senders converge on it, so it grants each a share that cannot overflow its link. NCCL's clear-to-send is a coarse form of this; the general form moves the grant into the NIC so that it covers every flow. Figure 7.12 shows the idea with four senders.

接收端驅動的 credit 傳輸層。下一步讓接收端動態發放 credit:它知道自己的緩衝狀態與有多少發送端匯向它,所以能給每一個不會溢出其鏈路的份額。NCCL 的 clear-to-send 是這個想法的粗略形式;一般形式把授權移進 NIC,讓它涵蓋每一條流。圖 7.12 以四個發送端說明這個想法。

credit: C/4 to each sendercredit:每個發送端得到 C/4S1S2S3S4switch交換器queue ≈ 0佇列 ≈ 0total ≤ C總和 ≤ Creceiver接收端grants C/4發放 C/4the grants add up to C, so the queue stays near empty授權總和為 C,所以佇列幾乎是空的without credit, 4 senders at line rate grow the queue at 3 × C沒有 credit 時,4 個線速發送端讓佇列以 3 × C 增長
Figure 7.12. Receiver-driven credit with four senders. The receiver knows how many senders converge on it, so it grants each a quarter of its link rate CC. The grants cannot add up to more than CC, so the queue in front of the receiver stays near empty. A sender-driven scheme such as DCQCN starts every flow at line rate and reacts only after a queue forms.圖 7.12。四個發送端的接收端驅動 credit。接收端知道有多少發送端匯向它,所以授予每一個四分之一的鏈路速率 CC。授權總和不會超過 CC,所以接收端前的佇列幾乎是空的。DCQCN 這類由發送端驅動的方案讓每條流從線速開始,佇列形成後才反應。Drawn for this primer from the receiver-driven designs that Section 7.6 describes.

Ultra Ethernet and the 2026 designs. The Ultra Ethernet Transport specification (version 1.0, 2025) standardizes this direction for Ethernet NICs: selective retransmission so loss is cheap, multipath packet spraying so a flow uses every path at once, and receiver-side credit as one of its congestion-control modes. Meta's 2026 paper on connecting more than 100,000 GPUs describes how its communication library changed at that scale; the research notes on collectives summarize it.

Ultra Ethernet 與 2026 年的設計。Ultra Ethernet 傳輸層規格(1.0 版,2025 年)為 Ethernet NIC 標準化了這個方向:選擇性重傳讓丟包便宜,多路徑封包噴灑讓一條流同時使用每條路徑,以及作為其壅塞控制模式之一的接收端 credit。Meta 2026 年關於連接十萬顆以上 GPU 的論文,描述了它的通訊函式庫在這個規模下的改變;集體通訊的研究筆記有摘要。

What remains hard. Three things. First, state: a bitmap must cover one BDP of packets, 128 bits at 40 Gb/s but about 270 packets at 400 Gb/s with a 22 µs RTT, and more with spraying over many paths; IRN's FPGA usage already rose at 100 Gb/s. Second, reordering: out-of-order arrival is cheap only with direct placement, which needs the remote address in every packet (IRN adds the RETH to every write packet); buffering in the NIC instead costs about 1 KB per packet, 110 MB for a thousand flows. Third, co-existence: a fabric that still carries go-back-N traffic from older NICs must keep PFC for that class, so the arithmetic of Section 7.3 still applies during a multi-year transition.

仍然困難的事。三件。第一,狀態:位圖必須涵蓋一個 BDP 的封包,40 Gb/s 時是 128 位元,400 Gb/s、22 µs RTT 時約 270 個封包,在許多路徑上噴灑時更多;IRN 的 FPGA 用量在 100 Gb/s 時就已上升。第二,亂序:亂序到達只有在直接放置時才便宜,而直接放置需要每個封包都帶遠端位址(IRN 把 RETH 加進每個 write 封包);若改在 NIC 中緩衝,每個封包約需 1 KB,一千條流需 110 MB。第三,共存:仍承載舊 NIC go-back-N 流量的網路必須為那個類別保留 PFC,所以在多年的過渡期間 第 7.3 節 的算術仍然適用。

Stop and think停下來想一想

In Panel 7.3 at 400G, set the loss rate to 10−4{10^{-4}}: selective retransmission keeps 99.99% of the link. What could a switch do if it were allowed to drop one packet in ten thousand? No headroom, no pause storms, no deadlock, and every buffer available for real queueing. That trade is this section.

在面板 7.3 的 400G 下把丟包率設為 10−4{10^{-4}}:選擇性重傳保住 99.99% 的鏈路。如果允許交換器每一萬個封包丟一個,它能做什麼?不需要 headroom、沒有暫停風暴、沒有死鎖,每個緩衝都可用於真正的排隊。這個交換就是本節。

Chapter summary
本章摘要

RoCEv2 carries RDMA packets inside UDP/IP so that ordinary Ethernet switches can forward them. Today's RDMA NICs recover from a lost packet with go-back-N, resending everything after it, so goodput collapses once losses become common: about 1/(1 + pW) for loss probability p and a window of W packets. Training networks therefore try never to drop a packet. PFC pauses the upstream port before a buffer overflows, at the cost of reserved headroom, pauses that spread upstream to innocent flows, and in rare cases deadlock. DCQCN slows senders before PFC fires: switches mark ECN, receivers return CNPs, senders cut their rate. It only works if marking comes before pausing, which bounds the ECN threshold by buffer divided by port count. The AI networks departed from the recipe: Meta turned DCQCN off at 400G and relies on deep buffers and NCCL's receiver-driven clear-to-send; MegaScale tuned a hybrid; the next generation fixes the NIC (selective repair, a cap on bytes in flight) so that the network may drop packets again.

RoCEv2 把 RDMA 封包包在 UDP/IP 裡,讓一般的 Ethernet 交換器能轉送它們。今天的 RDMA NIC 以 go-back-N 從丟包恢復,重送其後的一切,所以丟包一旦常見,有效吞吐就會崩落:在丟包機率 p、視窗 W 個封包時約為 1/(1 + pW)。因此訓練網路盡量一個封包都不丟。PFC 在緩衝溢出前暫停上游的埠,代價是要保留 headroom、暫停會往上游擴散到無辜的流,少數情況下還會死結。DCQCN 在 PFC 觸發前讓發送端減速:交換器標記 ECN、接收端回送 CNP、發送端降低速率。它只有在標記先於暫停時才有效,這使 ECN 門檻受限於緩衝除以埠數。AI 網路偏離了這套做法:Meta 在 400G 時關掉 DCQCN,依靠深緩衝與 NCCL 的接收端驅動 clear-to-send;MegaScale 調出一種混合做法;下一代則修好 NIC(選擇性修復、限制在途位元組),讓網路可以再次丟包。

Where these ideas go next
這些概念接下來用在哪裡

Chapter 8 turns from how fast packets travel to which path they take: how switches spread flows over equal paths, why that fails for training traffic, and what the three teams did about it.

第 8 章從封包走多快轉向走哪條路:交換器如何把流分散到等價路徑上、為何這對訓練流量失效,以及三個團隊如何因應。

Guided readings for this chapter本章相關的論文導讀

Check your understanding檢驗你的理解