Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit the amount of datagrams produced per connection driver iteration
Creating datagrams using `poll_transmit` is rather CPU intensive, and while doing that no other events can be handled (e.g. processing new incoming ACKs). This change places an upper bound on the amount of datagrams produced. This significantly reduces RTT for a loopback connection since the connection is no longer busy producing packets. Raw throughput can be a bit slower since a lot more ACK packets are now processed in the loopback test. However RTT is halfed. The difference in ACK packets (7200 vs 83000) and RTT (800us vs 400us) is very visible in the benchmark: **Before:** ``` Overall stats: Sent 1073741824 bytes on 1 streams in 1.70s (603.88 MiB/s) Server connection stats: ConnectionStats { frame_tx: FrameStats { ACK: 7199, }, frame_rx: FrameStats { ACK: 903129, }, path: PathStats { rtt: 459.755µs, cwnd: 12320, }, } Client connection stats: ConnectionStats { frame_tx: FrameStats { ACK: 903129, }, frame_rx: FrameStats { ACK: 7199, }, path: PathStats { rtt: 769.84µs, cwnd: 1094264975, }, } ``` **After:** ``` Sent 5389680640 bytes on 1 streams in 8.51s (603.90 MiB/s) Server connection stats: ConnectionStats { frame_tx: FrameStats { ACK: 83555, }, frame_rx: FrameStats { ACK: 4563602, STREAM: 4562497, }, path: PathStats { rtt: 205.582µs, cwnd: 12320, }, } Client connection stats: ConnectionStats { frame_tx: FrameStats { ACK: 4563602, STREAM: 4562497, }, frame_rx: FrameStats { ACK: 83555, }, path: PathStats { rtt: 393.448µs, cwnd: 495821204, }, } ```
- Loading branch information