mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 07:26:52 +01:00
tun: Benchmark the staged transmit pipeline
Run reads of eight 45-segment superpackets through listenIn into a discarding socket, inline and with four workers, for both ciphers.
This commit is contained in:
1 parent
eccaf1ca23
commit
82488caa32
1 file changed
+25
@@ -496,3 +496,28 @@ func TestFlowStagedTXAdaptiveBudget(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// BenchmarkFlowStagedTX runs reads of eight 45-segment superpackets through listenIn into a socket that discards
|
||||
// them, inline and staged.
|
||||
func BenchmarkFlowStagedTX(b *testing.B) {
|
||||
for _, cipher := range []noise.CipherFunc{noiseutil.CipherAESGCM, noise.CipherChaChaPoly} {
|
||||
for _, sc := range []stagedConfig{{}, stagedOn(4)} {
|
||||
b.Run(cipher.CipherName()+"/"+stagedName(sc), func(b *testing.B) {
|
||||
if sc.tx && cipher.CipherName() == noiseutil.CipherAESGCM.CipherName() && noiseutil.EncryptLockNeeded {
|
||||
b.Skip("AES-GCM requires encryption in nonce order")
|
||||
}
|
||||
sender, _ := newFlowTestPair(b, cipher, sc)
|
||||
sender.f.writers = []udp.Conn{udp.NoopConn{}}
|
||||
batch, _ := flowTestBatches(1, 8, 4, 45)
|
||||
batches := make([][]tio.Packet, b.N)
|
||||
for i := range batches {
|
||||
batches[i] = batch[0]
|
||||
}
|
||||
b.SetBytes(int64(8 * 45 * flowTestMSS))
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
sender.f.listenIn(newFlowBatchQueue(batches), 0)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user