Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quic tpu: create fewer timeout futures (#3151)
* quic tpu: create fewer timeout futures Use a cancellation token instead of polling an Arc<bool> to exit connection tasks. Before this change we used to create a timeout future for each tx, and immediately cancel it since virtually all connections always have incoming tx pending. Cancelling timeout futures is expensive as it goes inside the tokio driver and takes a mutex. On high load (1M tps), cancelling timeout futures takes 8% (!) of run time. With this change we create a cancellation token _once_ when a connection is established and that's it - no overhead after that. * quic tpu: lower stream timeout from 10s to 2s Don't wait 10s for one piece of a transaction to come before timing out. Lower the timeout to 2s, after which we assume a stream is dead. 2s is enough round trips to account for non catastrophic packet loss. If packet loss is causing >2s stream latency, the connection is hosed and the best thing we can do is save server resources for peers with better connectivity.
- Loading branch information