reifydb_sub_server/config/
network.rs

1// Copyright (c) reifydb.com 2025
2// This file is licensed under the AGPL-3.0-or-later, see license.md file
3
4#[derive(Debug, Clone)]
5pub struct NetworkConfig {
6	/// Number of worker threads (defaults to number of physical CPU cores)
7	pub listeners: Option<usize>,
8
9	/// Enable SO_REUSEPORT for load balancing across workers
10	pub reuse_port: bool,
11
12	/// Pin worker threads to specific CPU cores for cache locality
13	pub pin_threads: bool,
14
15	/// TCP_NODELAY setting for connections
16	pub nodelay: bool,
17
18	/// Maximum buffer size for outgoing data per connection
19	pub max_outbox_bytes: usize,
20
21	/// Maximum number of connections per worker
22	pub max_connections_per_worker: usize,
23}
24
25impl Default for NetworkConfig {
26	fn default() -> Self {
27		Self {
28			listeners: None,
29			reuse_port: true,
30			pin_threads: true,
31			nodelay: true,
32			max_outbox_bytes: 1 << 20, // 1MB per connection
33			max_connections_per_worker: 1_000,
34		}
35	}
36}