mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 12:16:52 +01:00
tun: Hold one transmit mode per routine
With staged transmit, an idle reader encrypted and sent a small read itself, while larger reads went to the workers and left from the ordered sender. Each read chose on its own, so under load a routine alternated between the two paths. Their packets left from different CPUs, and the receiver's TCP saw them out of order: on 100 GbE, summed over four hosts, dsack_dups rose from 0-1 on master to about 25k and reord_seen from 0 to 13k-19k. Each routine now holds one mode, inline on the reader or fanout to the workers and the sender. It switches only after tun.staged.gate_hold (default 64) reads in a row want the other mode, and before going inline it waits until every batch in flight is on the wire, so a switch never lets a later packet overtake an earlier one. Going to fanout nothing is in flight. flow.tx.gate_switches counts the switches. On the same hosts dsack_dups fell to 20-52 and reord_seen to 0-2, while throughput matched or beat per-read mixing (many-to-one 34.9 instead of 30.7 Gbit/s). The affinity test waited only for the previous batch's packets to be captured before the next read, but the sender returns the slot after its write, so the reader could still see it in flight and stage the small read. Switching to inline now drains, which makes the inline send deterministic there.
This commit is contained in:
1 parent
d16a52f921
commit
51591b0cec
7 files changed
+232
-23
No files matched your search
+3
-2
@@ -358,9 +358,10 @@ func stagedOn(n int) stagedConfig {
|
||||
return stagedConfig{workers: n, tx: true, rx: true, txSlots: stagedTxSlots, rxSlots: 6}
|
||||
}
|
||||
|
||||
// adaptive is staging with the inline threshold parseStagedConfig sets.
|
||||
// adaptive is staging with the inline threshold and gate hold parseStagedConfig sets.
|
||||
func adaptive(n int) stagedConfig {
|
||||
return stagedConfig{workers: n, tx: true, rx: true, inlineBelow: 256, txSlots: stagedTxSlots, rxSlots: 6}
|
||||
return stagedConfig{workers: n, tx: true, rx: true, inlineBelow: 256, gateHold: stagedGateHold,
|
||||
txSlots: stagedTxSlots, rxSlots: 6}
|
||||
}
|
||||
|
||||
func stagedName(sc stagedConfig) string {
|
||||
|
||||
Reference in new issue
Block a user