pub struct TaobenchConfig {
pub client_threads: usize,
pub slow_threads: usize,
pub cache_capacity_mib: usize,
pub target_hit_pct: usize,
pub slow_path_sleep_us: u64,
pub slow_path_p99_us: u64,
pub arrival_rate: usize,
}Expand description
User-facing config for the Taobench
workload.
User-facing config for the Taobench
workload — a bounded, evicting key-value cache with a fast hit path and a slow
miss path, driven to a steady-state hit ratio.
All fields are integer/scalar so the type keeps Eq + Hash (fractional knobs
are expressed as integer percents). Every field has a chainable builder
setter; Default is a useful working config.
Fields§
§client_threads: usizeCLIENT threads that issue lookups and serve hits. 0 resolves
to the allocated guest cpuset CPU count (one client per CPU).
slow_threads: usizeSLOW dispatcher threads that serve misses (sleep + fill + wake). 0
resolves to max(1, client_threads / 3), the real’s fast:slow staffing
ratio.
cache_capacity_mib: usizeResident cache budget in MiB. The cache FIFO-evicts to stay near this many bytes’ worth of objects; larger than the guest LLC makes the value touch a real memory-bandwidth cost.
target_hit_pct: usizeTarget steady-state hit ratio, in percent (1..=99). The key range is
sized capacity / target_hit so a uniform key stream hits at this rate at
equilibrium. Clamped into range at consumption.
slow_path_sleep_us: u64Simulated backing-store fetch latency on a miss, in microseconds (the slow
dispatcher sleeps this long before filling). 0 keeps the slow path as a
pure thread hop with no sleep (and disables the heavy tail — a zero median
has no Pareto scale, so the fetch stays a no-op regardless of
slow_path_p99_us). When slow_path_sleep_us > 0 and slow_path_p99_us > slow_path_sleep_us this is the MEDIAN (p50) of a heavy-tailed service-time
distribution rather than a fixed latency (see slow_path_p99_us).
slow_path_p99_us: u64Heavy-tailed slow-path service time: the p99 of the simulated backing-store
fetch, in microseconds. When > slow_path_sleep_us, each miss’s fetch sleep
is drawn from a Pareto distribution whose median is slow_path_sleep_us and
whose 99th percentile is this value — most fetches near the median, a heavy
tail of rare slow fetches (GC pauses, cold cache, disk seeks), the realistic
power-law shape a backing store exhibits. 0 (default), any value
<= slow_path_sleep_us, OR slow_path_sleep_us == 0 (a zero median has no
Pareto scale) keeps the fixed-latency behavior (every fetch sleeps exactly
slow_path_sleep_us — the legacy path, byte-identical). The tail is
clamped at a fixed maximum so a pathological draw cannot park a dispatcher
off-CPU unboundedly. A ktstr enhancement beyond the reference, whose
per-request slow-path service time is a FIXED sleep with no tail (the
reference’s [target/2, 2×target] uniform jitter + idle-poll backoff is a
separate poll/idle-wait knob, not the per-request fetch), so the open-loop
serve-latency tail (crate::workload::TaobenchConfig::arrival_rate)
reflects realistic
backing-store variance.
arrival_rate: usizeOpen-loop arrival rate, AGGREGATE ops/sec across all client threads (the
taobench analog of schbench’s -R). 0 (default) = CLOSED loop: each
client blocks until its request completes before issuing the next (the
legacy behavior, byte-identical). Non-zero = OPEN loop: each client has a
fixed intended-arrival SCHEDULE (arrival_rate / client_threads per client)
independent of completion, and serve latency is measured from that intended
time. A client still holds at most one outstanding request, so a slow
completion delays the next issue; that backlog is folded into the late
requests’ serve latency (coordinated-omission correction) rather than
omitted. Divided evenly across resolved clients. (Named for the standard
queueing-theory term; the schbench analog is requests_per_sec, which is a
verbatim mirror of schbench’s own -R CLI flag — a constraint this
ktstr-added field, with no reference -R to mirror, does not share.)
Implementations§
Source§impl TaobenchConfig
impl TaobenchConfig
Sourcepub fn client_threads(self, n: usize) -> Self
pub fn client_threads(self, n: usize) -> Self
Set the client thread count (0 = one per allocated CPU).
Sourcepub fn slow_threads(self, n: usize) -> Self
pub fn slow_threads(self, n: usize) -> Self
Set the slow dispatcher thread count (0 = max(1, client_threads/3)).
Sourcepub fn cache_capacity_mib(self, mib: usize) -> Self
pub fn cache_capacity_mib(self, mib: usize) -> Self
Set the resident cache budget in MiB.
Sourcepub fn target_hit_pct(self, pct: usize) -> Self
pub fn target_hit_pct(self, pct: usize) -> Self
Set the target steady-state hit ratio in percent (1..=99).
Sourcepub fn slow_path_sleep_us(self, us: u64) -> Self
pub fn slow_path_sleep_us(self, us: u64) -> Self
Set the simulated backing-store fetch latency on a miss, microseconds (the
MEDIAN when slow_path_p99_us enables the heavy tail; 0 keeps the fetch a
no-op and also disables the tail — a zero median has no Pareto scale).
Sourcepub fn slow_path_p99_us(self, us: u64) -> Self
pub fn slow_path_p99_us(self, us: u64) -> Self
Set the heavy-tailed slow-path service-time p99 in microseconds (0 or
<= slow_path_sleep_us = fixed latency, the legacy behavior; also fixed when
slow_path_sleep_us == 0, a zero median having no Pareto scale). When larger
than a non-zero slow_path_sleep_us, each miss’s fetch is drawn from a Pareto
with median slow_path_sleep_us and this p99.
Sourcepub fn arrival_rate(self, ops_per_sec: usize) -> Self
pub fn arrival_rate(self, ops_per_sec: usize) -> Self
Set the open-loop AGGREGATE arrival rate in ops/sec across all clients
(0 = closed loop). Divided evenly across resolved client threads; serve
latency is then measured from the intended arrival (coordinated-omission).
Trait Implementations§
Source§impl Clone for TaobenchConfig
impl Clone for TaobenchConfig
Source§fn clone(&self) -> TaobenchConfig
fn clone(&self) -> TaobenchConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TaobenchConfig
impl Debug for TaobenchConfig
Source§impl Default for TaobenchConfig
impl Default for TaobenchConfig
Source§impl<'de> Deserialize<'de> for TaobenchConfig
impl<'de> Deserialize<'de> for TaobenchConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for TaobenchConfig
impl Hash for TaobenchConfig
Source§impl PartialEq for TaobenchConfig
impl PartialEq for TaobenchConfig
Source§impl Serialize for TaobenchConfig
impl Serialize for TaobenchConfig
impl Eq for TaobenchConfig
impl StructuralPartialEq for TaobenchConfig
Auto Trait Implementations§
impl Freeze for TaobenchConfig
impl RefUnwindSafe for TaobenchConfig
impl Send for TaobenchConfig
impl Sync for TaobenchConfig
impl Unpin for TaobenchConfig
impl UnwindSafe for TaobenchConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more