Skip to content

Commit

Permalink
Readme.md fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunwangs committed Oct 30, 2024
1 parent ba65a02 commit 257e49a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 40 deletions.
4 changes: 2 additions & 2 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 streamer/src/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ pub fn spawn_server(
)
}

#[derive(Clone)]
pub struct QuicServerParams {
pub max_connections_per_peer: usize,
pub max_staked_connections: usize,
Expand Down
18 changes: 10 additions & 8 deletions vortexor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use {
solana_clap_utils::input_parsers::keypair_of,
solana_net_utils::{bind_in_range_with_config, bind_more_with_config, SocketConfig},
solana_sdk::net::DEFAULT_TPU_COALESCE,
solana_streamer::{nonblocking::quic::DEFAULT_WAIT_FOR_CHUNK_TIMEOUT, streamer::StakedNodes},
solana_streamer::{nonblocking::quic::DEFAULT_WAIT_FOR_CHUNK_TIMEOUT, quic::QuicServerParams, streamer::StakedNodes},
solana_vortexor::{
cli::{app, DefaultArgs},
vortexor::{TpuSockets, TpuStreamerConfig, Vortexor},
Expand Down Expand Up @@ -54,13 +54,15 @@ pub fn main() {
tpu_metrics_name: "quic_streamer_tpu",
tpu_fwd_thread_name: "solQuicTpuFwd",
tpu_fwd_metrics_name: "quic_streamer_tpu_forwards",
max_connections_per_peer: max_connections_per_peer.try_into().unwrap(),
max_staked_connections: max_tpu_staked_connections.try_into().unwrap(),
max_unstaked_connections: max_tpu_unstaked_connections.try_into().unwrap(),
max_streams_per_ms,
max_connections_per_ipaddr_per_min,
wait_for_chunk_timeout: DEFAULT_WAIT_FOR_CHUNK_TIMEOUT,
sender_coalesce_duration: tpu_coalesce,
quic_server_params: QuicServerParams {
max_connections_per_peer: max_connections_per_peer.try_into().unwrap(),
max_staked_connections: max_tpu_staked_connections.try_into().unwrap(),
max_unstaked_connections: max_tpu_unstaked_connections.try_into().unwrap(),
max_streams_per_ms,
max_connections_per_ipaddr_per_min,
wait_for_chunk_timeout: DEFAULT_WAIT_FOR_CHUNK_TIMEOUT,
coalesce: tpu_coalesce,
}
};

let quic_config = SocketConfig { reuseport: true };
Expand Down
41 changes: 11 additions & 30 deletions vortexor/src/vortexor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ use {
solana_perf::packet::PacketBatch,
solana_sdk::{quic::NotifyKeyUpdate, signature::Keypair},
solana_streamer::{
quic::{spawn_server_multi, EndpointKeyUpdater},
quic::{spawn_server_multi, EndpointKeyUpdater, QuicServerParams},
streamer::StakedNodes,
},
std::{
net::UdpSocket,
sync::{atomic::AtomicBool, Arc, Mutex, RwLock},
thread::{self, JoinHandle},
time::Duration,
},
};

Expand All @@ -27,13 +26,7 @@ pub struct TpuStreamerConfig {
pub tpu_metrics_name: &'static str,
pub tpu_fwd_thread_name: &'static str,
pub tpu_fwd_metrics_name: &'static str,
pub max_connections_per_peer: usize,
pub max_staked_connections: usize,
pub max_unstaked_connections: usize,
pub max_streams_per_ms: u64,
pub max_connections_per_ipaddr_per_min: u64,
pub wait_for_chunk_timeout: Duration,
pub sender_coalesce_duration: Duration,
pub quic_server_params: QuicServerParams,
}

pub struct Vortexor {
Expand Down Expand Up @@ -84,48 +77,36 @@ impl Vortexor {
tpu_metrics_name,
tpu_fwd_thread_name,
tpu_fwd_metrics_name,
max_connections_per_peer,
max_staked_connections,
max_unstaked_connections,
max_streams_per_ms,
max_connections_per_ipaddr_per_min,
wait_for_chunk_timeout,
sender_coalesce_duration,
mut quic_server_params,
} = config;


let tpu_result = spawn_server_multi(
tpu_thread_name,
tpu_metrics_name,
tpu_quic,
keypair,
tpu_sender.clone(),
exit.clone(),
max_connections_per_peer,
staked_nodes.clone(),
max_staked_connections,
max_unstaked_connections,
max_streams_per_ms,
max_connections_per_ipaddr_per_min,
wait_for_chunk_timeout,
sender_coalesce_duration,
quic_server_params.clone(),
)
.unwrap();

// Fot TPU forward -- we disallow unstaked connections. Allocate all connection resources
// for staked connections:
quic_server_params.max_staked_connections += quic_server_params.max_unstaked_connections;
quic_server_params.max_unstaked_connections = 0;
let tpu_fwd_result = spawn_server_multi(
tpu_fwd_thread_name,
tpu_fwd_metrics_name,
tpu_quic_fwd,
keypair,
tpu_fwd_sender,
exit.clone(),
max_connections_per_peer,
staked_nodes.clone(),
max_staked_connections,
max_unstaked_connections,
max_streams_per_ms,
max_connections_per_ipaddr_per_min,
wait_for_chunk_timeout,
sender_coalesce_duration,
quic_server_params

)
.unwrap();

Expand Down

0 comments on commit 257e49a

Please sign in to comment.