Skip to content

Commit

Permalink
Increase UDP socket buffer sizes for Anemo networks
Browse files Browse the repository at this point in the history
  • Loading branch information
aschran committed May 27, 2023
1 parent 827f113 commit 518c41c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "c27e87fb
fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "c27e87fb539c88b6fe1eac7dd82561254bb1e07a", package = "fastcrypto-zkp" }

# anemo dependencies
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7" }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7" }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7"}
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7"}
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613" }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613" }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613"}
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613"}

# Use the same workspace-hack across crates.
workspace-hack = { path = "crates/workspace-hack" }
Expand Down
11 changes: 11 additions & 0 deletions crates/sui-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,17 @@ impl SuiNode {
// staking events in the epoch change txn.
anemo_config.max_frame_size = Some(2 << 30);

// Set a higher default value for socket send/receive buffers if not already
// configured.
let mut quic_config = anemo_config.quic.unwrap_or_default();
if let None = quic_config.socket_send_buffer_size {
quic_config.socket_send_buffer_size = Some(20 << 20);
}
if let None = quic_config.socket_receive_buffer_size {
quic_config.socket_receive_buffer_size = Some(20 << 20);
}
anemo_config.quic = Some(quic_config);

let server_name = format!("sui-{}", chain_identifier);
let alt_server_name = "sui";
let network = Network::bind(config.p2p_config.listen_address)
Expand Down
14 changes: 7 additions & 7 deletions crates/workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ aho-corasick = { version = "0.7" }
aliasable = { version = "0.1" }
alloc-no-stdlib = { version = "2", default-features = false }
alloc-stdlib = { version = "0.2", default-features = false }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7", default-features = false }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7", default-features = false }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613", default-features = false }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613", default-features = false }
anes = { version = "0.1" }
ansi_term = { version = "0.12", default-features = false }
anyhow = { version = "1", features = ["backtrace"] }
Expand Down Expand Up @@ -700,10 +700,10 @@ aho-corasick = { version = "0.7" }
aliasable = { version = "0.1" }
alloc-no-stdlib = { version = "2", default-features = false }
alloc-stdlib = { version = "0.2", default-features = false }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7", default-features = false }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7", default-features = false }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "cf95fa2268b6b273ee1b3e9180c8adf525ed80b7", default-features = false }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613", default-features = false }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613", default-features = false }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "7c5705fcfcd8fddf12ab5872f1d1ad29e9e03613", default-features = false }
anes = { version = "0.1" }
ansi_term = { version = "0.12", default-features = false }
anyhow = { version = "1", features = ["backtrace"] }
Expand Down
2 changes: 2 additions & 0 deletions narwhal/primary/src/primary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ impl Primary {
quic_config.receive_window = Some(200 << 20);
quic_config.send_window = Some(200 << 20);
quic_config.crypto_buffer_size = Some(1 << 20);
quic_config.socket_receive_buffer_size = Some(20 << 20);
quic_config.socket_send_buffer_size = Some(20 << 20);
quic_config.max_idle_timeout_ms = Some(30_000);
// Enable keep alives every 5s
quic_config.keep_alive_interval_ms = Some(5_000);
Expand Down
2 changes: 2 additions & 0 deletions narwhal/worker/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ impl Worker {
quic_config.receive_window = Some(200 << 20);
quic_config.send_window = Some(200 << 20);
quic_config.crypto_buffer_size = Some(1 << 20);
quic_config.socket_receive_buffer_size = Some(20 << 20);
quic_config.socket_send_buffer_size = Some(20 << 20);
quic_config.max_idle_timeout_ms = Some(30_000);
// Enable keep alives every 5s
quic_config.keep_alive_interval_ms = Some(5_000);
Expand Down

0 comments on commit 518c41c

Please sign in to comment.