pub struct MemoryStats {Show 15 fields
pub block_cache_hits: u64,
pub block_cache_misses: u64,
pub block_cache_evictions: u64,
pub block_cache_capacity_bytes: usize,
pub key_cache_hits: u64,
pub key_cache_misses: u64,
pub key_cache_evictions: u64,
pub key_cache_invalidations: u64,
pub key_cache_resident_bytes: usize,
pub key_cache_capacity_bytes: usize,
pub row_cache_hits: u64,
pub row_cache_misses: u64,
pub total_memory_used: usize,
pub buffer_allocations: u64,
pub buffer_deallocations: u64,
}Expand description
Memory statistics.
Public-surface-wired (semver) through Database::stats().memory_stats. The
field names and types are preserved verbatim (issue #1568, AK6); only the
source of the block-cache numbers changed — they now reflect the real B1
DecompressedChunkCache.
§Independent sampling (advisory observability)
The block_cache_* fields and the key_cache_* fields are sampled
independently and at different instants: the block-cache figures come from
the MemoryManager (its shared B1 chunk cache), while the key-cache figures
are aggregated from the storage engine’s per-reader B4 caches
(SSTableManager::aggregate_key_cache_stats) in a separate step. Under
concurrent read load the two groups can therefore reflect slightly different
moments in time, so within a single memory_stats snapshot the block-cache vs
key-cache figures are not guaranteed to be mutually coherent. Treat this as
advisory observability (trends, rough ratios), not a transactionally-consistent
point-in-time view of both caches.
Fields§
§block_cache_hits: u64Block cache hits (real B1 cache hit count when wired).
block_cache_misses: u64Block cache misses (real B1 cache miss count when wired).
block_cache_evictions: u64Block cache evictions: entries the B1 decompressed-chunk cache evicted to
stay within its byte budget (issue #1571, B5). Real eviction_count()
when wired; 0 (honest — no cache, no evictions) otherwise. High churn
relative to hits signals an undersized block_cache_capacity_bytes.
block_cache_capacity_bytes: usizeBlock cache configured byte budget (issue #1571, B5): the B1 cache’s
budget_bytes() when wired, so a hit rate can be read against the budget
it was measured under; 0 when no cache is wired / block caching disabled.
key_cache_hits: u64Key cache hits (issue #1571/#2059). A hit lets a repeated point read skip the
Index.db interval parse. Since #2059 the key cache is ONE process-global
instance shared by every open reader, so these counters are PROCESS-GLOBAL: they
aggregate activity across ALL Database instances in the process, not one
reader’s slice (a semantic change from the retired per-reader counters). Real
counter; 0 before any reader touches the cache.
key_cache_misses: u64Key cache misses (issue #1571/#2059). Process-global, like
key_cache_hits — summed across all Database
instances in the process.
key_cache_evictions: u64Key cache evictions: entries evicted from the process-global key cache to
stay within its byte budget (issue #1571/#2059) — DISTINCT from
key_cache_invalidations.
key_cache_invalidations: u64Key cache invalidations: entries dropped from the process-global key cache on
generation removal / compaction / warm-registry evict (issue #2059) — a
distinct counter from budget-driven key_cache_evictions.
key_cache_resident_bytes: usizeKey cache resident bytes: approximate resident footprint of the process-global key cache (issue #1571/#2059).
key_cache_capacity_bytes: usizeKey cache capacity bytes: the process-global key cache’s fixed configured byte
budget (issue #1571/#2059), or 0 when block caching is disabled.
row_cache_hits: u64Row cache hits. Retained for shape compatibility; the row cache was
deleted (issue #1568), so this reports 0 (full surface is Epic B / B5).
row_cache_misses: u64Row cache misses. Retained for shape compatibility; reports 0.
total_memory_used: usizeTotal memory used. Now the B1 cache’s resident decompressed bytes
(resident_bytes()) when wired (issue #1568).
buffer_allocations: u64Buffer pool allocations. Retained for shape compatibility; the buffer
pool was deleted (issue #1568), so this reports 0.
buffer_deallocations: u64Buffer pool deallocations. Retained for shape compatibility; reports 0.
Implementations§
Source§impl MemoryStats
impl MemoryStats
Sourcepub fn block_cache_hit_rate(&self) -> f64
pub fn block_cache_hit_rate(&self) -> f64
Calculate block cache hit rate.
Sourcepub fn key_cache_hit_rate(&self) -> f64
pub fn key_cache_hit_rate(&self) -> f64
Calculate the aggregate key-cache hit rate (issue #1571, B5) from the real
summed hit and miss counts. Returns 0.0 when there has been no key-cache
activity (honest — not a structural pin).
Sourcepub fn row_cache_hit_rate(&self) -> f64
pub fn row_cache_hit_rate(&self) -> f64
Calculate row cache hit rate.
Trait Implementations§
Source§impl Clone for MemoryStats
impl Clone for MemoryStats
Source§fn clone(&self) -> MemoryStats
fn clone(&self) -> MemoryStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more