From 5505a178a0e8b839f67d489121bd57ee8e01bf52 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 25 Jan 2019 14:15:58 +0200 Subject: Increase network queue sizes for better reliability under high load --- bbot/agent/machine.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bbot/agent/machine.cxx b/bbot/agent/machine.cxx index db51e0b..14b4e21 100644 --- a/bbot/agent/machine.cxx +++ b/bbot/agent/machine.cxx @@ -96,6 +96,13 @@ namespace bbot run_exit (trace, "sudo", "ip", "tuntap", "delete", t, "mode", "tap"); run (trace, "sudo", "ip", "tuntap", "add", t, "mode", "tap", "user", uid); + + // Increase the transmission queue from default 1000 to prevent dropping + // packets under high load. See also rx/tx_queue_size in the QEMU + // networking setup (it's fuzzy how this is all related to each other). + // + run (trace, "sudo", "ip", "link", "set", t, "txqueuelen", "10000"); + run (trace, "sudo", "ip", "link", "set", t, "up"); run (trace, "sudo", "ip", "link", "set", t, "master", br); @@ -289,8 +296,14 @@ namespace bbot // Network. // + // The rx/tx queue size is between 256 (default) and 1024 and must be a + // power of 2. Also, maximum (1024) requires some extra support from the + // guest driver so we start with 512. + // add ("-netdev", "tap,id=net0,script=no,ifname=" + net.iface); - add ("-device", "virtio-net-pci,netdev=net0,mac=" + mac); + add ("-device", ("virtio-net-pci,netdev=net0,mac=" + mac + + ",tx_queue_size=512" + + ",rx_queue_size=512")); // Disk. // -- cgit v1.1