Skip to content

Commit

Permalink
quic tpu: create fewer timeout futures (#3151)
Browse files Browse the repository at this point in the history
* 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
alessandrod authored Oct 22, 2024
1 parent 05ac482 commit 137b6af
Show file tree
Hide file tree
Showing 5 changed files with 217 additions and 214 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions streamer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ solana-sdk = { workspace = true }
solana-transaction-metrics-tracker = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tokio-util = { workspace = true }
x509-parser = { workspace = true }

[dev-dependencies]
Expand Down
Loading

0 comments on commit 137b6af

Please sign in to comment.