Skip to content

Commit

Permalink
improving quic plugin blocking client
Browse files Browse the repository at this point in the history
  • Loading branch information
godmodegalactus committed Dec 12, 2024
1 parent c25c19a commit 753d264
Show file tree
Hide file tree
Showing 18 changed files with 372 additions and 350 deletions.
89 changes: 45 additions & 44 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ license = "AGPL"
edition = "2021"

[workspace.dependencies]
solana-sdk = "~2.0.18"
solana-program = "~2.0.18"
solana-transaction-status = "~2.0.18"
solana-logger = "~2.0.18"
solana-rpc-client = "~2.0.18"
solana-rpc-client-api = "~2.0.18"
solana-account-decoder = "~2.0.18"
agave-geyser-plugin-interface = "=2.0.18"
solana-sdk = "~2.0.19"
solana-program = "~2.0.19"
solana-transaction-status = "~2.0.19"
solana-logger = "~2.0.19"
solana-rpc-client = "~2.0.19"
solana-rpc-client-api = "~2.0.19"
solana-account-decoder = "~2.0.19"
agave-geyser-plugin-interface = "=2.0.19"

itertools = "0.10.5"
serde = "1.0.201"
Expand Down
14 changes: 4 additions & 10 deletions blocking_client/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::configure_client::configure_client;
use crate::quiche_client_loop::client_loop;
use quic_geyser_common::filters::Filter;
use quic_geyser_common::message::Message;
Expand All @@ -18,13 +17,7 @@ impl Client {
server_address: String,
connection_parameters: ConnectionParameters,
) -> anyhow::Result<(Client, std::sync::mpsc::Receiver<Message>)> {
let config = configure_client(
connection_parameters.max_number_of_streams,
connection_parameters.recieve_window_size,
connection_parameters.timeout_in_seconds,
connection_parameters.max_ack_delay,
connection_parameters.ack_exponent,
)?;
log::info!("client configured : {connection_parameters:?}");
let server_address: SocketAddr = parse_host_port(&server_address)?;
let socket_addr: SocketAddr =
parse_host_port("[::]:0").expect("Socket address should be returned");
Expand All @@ -35,7 +28,7 @@ impl Client {
let is_connected_client = is_connected.clone();
let _client_loop_jh = std::thread::spawn(move || {
if let Err(e) = client_loop(
config,
connection_parameters,
socket_addr,
server_address,
rx_sent_queue,
Expand Down Expand Up @@ -168,7 +161,8 @@ mod tests {
timeout_in_seconds: 10,
max_ack_delay: 25,
ack_exponent: 3,
enable_gso: false,
enable_gso: true,
enable_pacing: true,
},
)
.unwrap();
Expand Down
45 changes: 28 additions & 17 deletions blocking_client/src/configure_client.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
use quic_geyser_common::defaults::{ALPN_GEYSER_PROTOCOL_ID, MAX_DATAGRAM_SIZE};
use quic_geyser_common::{
defaults::{ALPN_GEYSER_PROTOCOL_ID, MAX_DATAGRAM_SIZE},
types::connections_parameters::ConnectionParameters,
};

pub fn configure_client(
maximum_concurrent_streams: u64,
recieve_window_size: u64,
timeout_in_seconds: u64,
maximum_ack_delay: u64,
ack_exponent: u64,
connection_parameters: &ConnectionParameters,
) -> anyhow::Result<quiche::Config> {
let mut config = quiche::Config::new(quiche::PROTOCOL_VERSION).unwrap();
config
.set_application_protos(&[ALPN_GEYSER_PROTOCOL_ID])
.unwrap();

config.set_max_idle_timeout(timeout_in_seconds * 1000);
config.set_max_idle_timeout(connection_parameters.timeout_in_seconds * 1000);
config.set_max_recv_udp_payload_size(MAX_DATAGRAM_SIZE);
config.set_max_send_udp_payload_size(MAX_DATAGRAM_SIZE);
config.set_initial_max_data(recieve_window_size);
config.set_initial_max_stream_data_bidi_local(recieve_window_size);
config.set_initial_max_stream_data_bidi_remote(recieve_window_size);
config.set_initial_max_stream_data_uni(recieve_window_size);
config.set_initial_max_streams_bidi(maximum_concurrent_streams);
config.set_initial_max_streams_uni(maximum_concurrent_streams);
config.set_initial_max_data(connection_parameters.recieve_window_size);
config.set_initial_max_stream_data_bidi_local(connection_parameters.recieve_window_size);
config.set_initial_max_stream_data_bidi_remote(connection_parameters.recieve_window_size);
config.set_initial_max_stream_data_uni(connection_parameters.recieve_window_size);
config.set_initial_max_streams_bidi(connection_parameters.max_number_of_streams);
config.set_initial_max_streams_uni(connection_parameters.max_number_of_streams);

config.set_disable_active_migration(true);
config.set_cc_algorithm(quiche::CongestionControlAlgorithm::BBR2);
config.set_max_ack_delay(maximum_ack_delay);
config.set_ack_delay_exponent(ack_exponent);
config.enable_pacing(false);
config.set_cc_algorithm(quiche::CongestionControlAlgorithm::CUBIC);
config.set_max_connection_window(48 * 1024 * 1024);
config.set_max_stream_window(16 * 1024 * 1024);

config.enable_early_data();
config.grease(true);
config.enable_hystart(true);
config.discover_pmtu(true);

config.set_active_connection_id_limit(16);
config.set_max_ack_delay(connection_parameters.max_ack_delay);
config.set_ack_delay_exponent(connection_parameters.ack_exponent);
config.set_initial_congestion_window_packets(1024);

config.enable_pacing(true);
Ok(config)
}
Loading

0 comments on commit 753d264

Please sign in to comment.