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 31, 2023
1 parent 827f113 commit 864eee7
Show file tree
Hide file tree
Showing 6 changed files with 33 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 = "88dd6f93a81871657f177384eeeff1268b58083b" }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "88dd6f93a81871657f177384eeeff1268b58083b" }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "88dd6f93a81871657f177384eeeff1268b58083b"}
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "88dd6f93a81871657f177384eeeff1268b58083b"}

# Use the same workspace-hack across crates.
workspace-hack = { path = "crates/workspace-hack" }
Expand Down
12 changes: 12 additions & 0 deletions crates/sui-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,18 @@ 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 quic_config.socket_send_buffer_size.is_none() {
quic_config.socket_send_buffer_size = Some(20 << 20);
}
if quic_config.socket_receive_buffer_size.is_none() {
quic_config.socket_receive_buffer_size = Some(20 << 20);
}
quic_config.allow_failed_socket_buffer_size_setting = true;
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 = "88dd6f93a81871657f177384eeeff1268b58083b", default-features = false }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "88dd6f93a81871657f177384eeeff1268b58083b", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "88dd6f93a81871657f177384eeeff1268b58083b", 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 = "88dd6f93a81871657f177384eeeff1268b58083b", default-features = false }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "88dd6f93a81871657f177384eeeff1268b58083b", default-features = false }
anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "88dd6f93a81871657f177384eeeff1268b58083b", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "88dd6f93a81871657f177384eeeff1268b58083b", default-features = false }
anes = { version = "0.1" }
ansi_term = { version = "0.12", default-features = false }
anyhow = { version = "1", features = ["backtrace"] }
Expand Down
3 changes: 3 additions & 0 deletions narwhal/primary/src/primary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ 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.allow_failed_socket_buffer_size_setting = true;
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
3 changes: 3 additions & 0 deletions narwhal/worker/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ 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.allow_failed_socket_buffer_size_setting = true;
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 864eee7

Please sign in to comment.