pub struct RuntimeConfig {
pub global_queue_interval: Option<u32>,
pub log_overrides: HashMap<String, String>,
pub max_connections: Option<u32>,
pub max_memory_bytes: Option<usize>,
pub threads: usize,
pub upstream_ca_file: Option<String>,
pub upstream_keepalive_pool_size: Option<usize>,
pub work_stealing: bool,
}Expand description
Configuration for the runtime of the proxy server.
use praxis_core::config::RuntimeConfig;
let cfg = RuntimeConfig::default();
assert_eq!(cfg.threads, 0);
assert!(cfg.work_stealing);
assert_eq!(cfg.global_queue_interval, Some(61));
assert!(cfg.log_overrides.is_empty());
assert_eq!(cfg.upstream_keepalive_pool_size, Some(64));
assert!(cfg.upstream_ca_file.is_none());
let cfg: RuntimeConfig = serde_yaml::from_str("threads: 4\nwork_stealing: true").unwrap();
assert_eq!(cfg.threads, 4);
assert!(cfg.work_stealing);Fields§
§global_queue_interval: Option<u32>Tokio scheduler global queue check interval, in ticks.
Controls how often worker threads check the global task
queue. The default of 61 (a prime) reduces contention
under proxy workloads where most tasks are I/O-bound.
Set to null to use the tokio default. Valid range is
any positive u32.
use praxis_core::config::RuntimeConfig;
let cfg = RuntimeConfig::default();
assert_eq!(cfg.global_queue_interval, Some(61));
let cfg: RuntimeConfig = serde_yaml::from_str("global_queue_interval: 128").unwrap();
assert_eq!(cfg.global_queue_interval, Some(128));log_overrides: HashMap<String, String>Per-module log level overrides.
use praxis_core::config::RuntimeConfig;
let yaml = r#"
log_overrides:
praxis_filter::pipeline: trace
praxis_protocol: debug
"#;
let cfg: RuntimeConfig = serde_yaml::from_str(yaml).unwrap();
assert_eq!(cfg.log_overrides.len(), 2);
assert_eq!(cfg.log_overrides["praxis_filter::pipeline"], "trace");max_connections: Option<u32>Process-wide maximum concurrent connections across all listeners (both HTTP and TCP).
When set, new connections beyond this limit are rejected
with HTTP 503 (or TCP close for non-HTTP listeners),
regardless of per-listener limits. Connections are shed
before filter pipeline execution. None (the default)
means no global limit.
use praxis_core::config::RuntimeConfig;
let cfg: RuntimeConfig = serde_yaml::from_str("max_connections: 10000").unwrap();
assert_eq!(cfg.max_connections, Some(10_000));
let cfg = RuntimeConfig::default();
assert!(cfg.max_connections.is_none());max_memory_bytes: Option<usize>Maximum resident memory (RSS) in bytes before shedding load.
When set, Praxis monitors process RSS and rejects new
requests with 503 when the threshold is exceeded. None
(the default) disables memory pressure monitoring.
use praxis_core::config::RuntimeConfig;
let cfg: RuntimeConfig = serde_yaml::from_str("max_memory_bytes: 1073741824").unwrap();
assert_eq!(cfg.max_memory_bytes, Some(1_073_741_824));
let cfg = RuntimeConfig::default();
assert!(cfg.max_memory_bytes.is_none());threads: usizeNumber of worker threads per service.
0 (the default) auto-detects based on available CPU
cores. Values above the CPU count are valid but yield
diminishing returns for I/O-bound workloads.
upstream_ca_file: Option<String>Path to a PEM CA file used as the root certificate store for all upstream TLS connections.
When set, this replaces the system trust store (not additive). If backends use both a private CA and public CAs, create a combined PEM bundle containing all required root certificates.
use praxis_core::config::RuntimeConfig;
let cfg: RuntimeConfig =
serde_yaml::from_str("upstream_ca_file: /etc/praxis/ca-bundle.pem").unwrap();
assert_eq!(
cfg.upstream_ca_file.as_deref(),
Some("/etc/praxis/ca-bundle.pem")
);
let cfg = RuntimeConfig::default();
assert!(cfg.upstream_ca_file.is_none());upstream_keepalive_pool_size: Option<usize>Maximum number of idle upstream connections kept per worker thread, shared across all clusters.
When a worker’s pool is full, the oldest idle connection
is evicted. Set to null to use Pingora’s built-in
default. This is a per-thread limit, not per-cluster.
use praxis_core::config::RuntimeConfig;
let cfg = RuntimeConfig::default();
assert_eq!(cfg.upstream_keepalive_pool_size, Some(64));
let cfg: RuntimeConfig = serde_yaml::from_str("upstream_keepalive_pool_size: 32").unwrap();
assert_eq!(cfg.upstream_keepalive_pool_size, Some(32));work_stealing: boolAllow work-stealing between worker threads of the same service.
Trait Implementations§
Source§impl Clone for RuntimeConfig
impl Clone for RuntimeConfig
Source§fn clone(&self) -> RuntimeConfig
fn clone(&self) -> RuntimeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more