pub struct SourceTuning {
pub batch_size: usize,
pub batch_size_memory_mb: Option<usize>,
pub throttle_ms: u64,
pub statement_timeout_s: u64,
pub max_retries: u32,
pub retry_backoff_ms: u64,
pub lock_timeout_s: u64,
pub memory_threshold_mb: usize,
pub max_batch_memory_mb: Option<usize>,
pub on_batch_memory_exceeded: BatchMemoryPolicy,
pub adaptive: bool,
/* private fields */
}Fields§
§batch_size: usize§batch_size_memory_mb: Option<usize>§throttle_ms: u64§statement_timeout_s: u64§max_retries: u32§retry_backoff_ms: u64§lock_timeout_s: u64§memory_threshold_mb: usizeRSS limit in MB before chunk processing throttles. 0 = no limit (disabled).
max_batch_memory_mb: Option<usize>Hard cap on a single Arrow batch in MB. None = no cap.
on_batch_memory_exceeded: BatchMemoryPolicy§adaptive: boolWhen true, Rivet samples DB pressure metrics every
super::ADAPTIVE_SAMPLE_INTERVAL batches and shrinks/restores the
fetch size in response. Default: false.
Implementations§
Source§impl SourceTuning
impl SourceTuning
Sourcepub fn from_config(config: Option<&TuningConfig>) -> Self
pub fn from_config(config: Option<&TuningConfig>) -> Self
Build tuning with the legacy Balanced fallback. Public for downstream
callers and tests; production resolution in [crate::plan::build] uses
Self::from_config_with_default_profile so that source.environment:
can pick the right default.
Sourcepub fn from_config_with_default_profile(
config: Option<&TuningConfig>,
fallback_profile: TuningProfile,
) -> Self
pub fn from_config_with_default_profile( config: Option<&TuningConfig>, fallback_profile: TuningProfile, ) -> Self
Like Self::from_config but lets the caller override the fallback
profile used when config.profile is unset.
pub fn profile_name(&self) -> &'static str
Sourcepub fn effective_batch_size(&self, schema: Option<&SchemaRef>) -> usize
pub fn effective_batch_size(&self, schema: Option<&SchemaRef>) -> usize
If batch_size_memory_mb is set, compute and return an adjusted batch_size
from the schema; otherwise return the configured batch_size.
Sourcepub fn batch_memory_bytes(batch: &RecordBatch) -> usize
pub fn batch_memory_bytes(batch: &RecordBatch) -> usize
Return the actual Arrow memory footprint of a batch in bytes.
Sums get_array_memory_size() across all columns — includes buffers for
validity bitmaps, offsets, and value data. Does not include Arrow struct
overhead (~few hundred bytes) which is negligible at batch scale.
Sourcepub fn resource_summary(&self) -> ResourceSummary
pub fn resource_summary(&self) -> ResourceSummary
Produce a ResourceSummary from the resolved tuning settings.
The summary requires no database connection. It reports two batch-memory
bounds based on narrow-table (~200 B/row) and wide-table (~10 KB/row)
heuristics. A wide_table_risk flag is set when the upper bound exceeds
128 MB per batch.
Trait Implementations§
Source§impl Clone for SourceTuning
impl Clone for SourceTuning
Source§fn clone(&self) -> SourceTuning
fn clone(&self) -> SourceTuning
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more