pub struct CacheConfig {
pub lane_count: usize,
pub pending_batch: usize,
pub driver_batch: usize,
pub driver_interval: Duration,
pub channel_capacity: u64,
}Expand description
Optional knobs for the cache + driver. Pass to
crate::SpanCache::with_config /
crate::SpanCache::with_predicate_and_config; the no-config
constructors use CacheConfig::default.
Fields§
§lane_count: usizeNumber of in-flight slab shards. Silently clamped to [1, 256] and
rounded up to the next power of two (so 3 becomes 4, 200
becomes 256, 1000 is capped at 256). More lanes = more
concurrent writers without contention; each lane adds a
Mutex<Slab<SpanRecord>> plus consumes one more bit of the encoded
tracing::span::Id for shard selection.
Default: DEFAULT_LANE_COUNT.
pending_batch: usizeFlush the thread-local PENDING buffer to the spillway after this many span closures on a single thread. Smaller = lower visibility latency for low-traffic threads at the cost of more spillway sends. Default: 8.
driver_batch: usizeFlush the driver’s accumulated batch into the shared map after this many spans have been received. Smaller = lower visibility latency at the cost of more map write-lock acquisitions. Default: 600.
driver_interval: DurationUpper bound on how long the driver will wait before flushing whatever
it has, even if driver_batch hasn’t been reached. Default: 1 second.
channel_capacity: u64Soft upper bound on each spillway channel (span + event) that moves
closed records from producer threads to the driver. When producers
outrun the driver (e.g. many cores + few async workers), this caps
spillway’s internal buffers so the producer can’t grow process
memory unboundedly. send_many rejects whole batches when the
limit is hit and flush_pending drops the rejected drain (logging
at DEBUG). Decoupled from the user-facing capacity (the
BTreeMap bound): the channel is intermediate buffering and only
needs enough headroom for normal bursts. Default: 65536.
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more