mirror of
https://github.com/slackhq/nebula.git
synced 2026-08-15 09:57:00 +02:00
more ram -> more speed
This commit is contained in:
@@ -45,6 +45,11 @@ func (b *SendBatch) Reserve(sz int) []byte {
|
||||
return b.backing[start : start+sz : start+sz]
|
||||
}
|
||||
|
||||
// Len reports how many packets are queued for the next Flush. Callers use
|
||||
// it to flush incrementally once a full sendmmsg batch has accumulated,
|
||||
// bounding how long the first packet of a large read batch waits.
|
||||
func (b *SendBatch) Len() int { return len(b.bufs) }
|
||||
|
||||
func (b *SendBatch) Commit(pkt []byte, dst netip.AddrPort, outerECN byte) {
|
||||
b.bufs = append(b.bufs, pkt)
|
||||
b.dsts = append(b.dsts, dst)
|
||||
|
||||
@@ -28,9 +28,12 @@ const tunRxBufSize = 64 * 1024
|
||||
// tunRxBufCap is the total size we allocate for the per-reader rx
|
||||
// buffer. With reads landing directly in rxBuf, each drain iteration
|
||||
// consumes up to tunRxBufSize of headroom for the kernel-supplied bytes.
|
||||
// Sized to two such iterations so the initial blocking read plus one
|
||||
// drain read both fit without partial-drop.
|
||||
const tunRxBufCap = tunRxBufSize * 2
|
||||
// Sized to eight such iterations so a single poll wake can drain several
|
||||
// TSO/USO superpackets under bulk load, amortizing the wake and giving
|
||||
// the sendmmsg planner longer same-destination runs. Hold latency stays
|
||||
// bounded because listenIn flushes its send batch incrementally rather
|
||||
// than only at end-of-drain.
|
||||
const tunRxBufCap = tunRxBufSize * 8
|
||||
|
||||
// tunDrainCap caps how many packets a single Read will accumulate via
|
||||
// the post-wake drain loop. Sized to soak up a burst of small ACKs while
|
||||
|
||||
Reference in New Issue
Block a user