pub struct MemoryStats {Show 14 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_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: aggregate across the per-reader B4 key→partition-offset
caches (issue #1571, B5). A hit lets a repeated point read skip the
Index.db/trie descent. Real summed counter; 0 when no reader is open.
key_cache_misses: u64Key cache misses: aggregate across the per-reader B4 caches (issue #1571).
key_cache_evictions: u64Key cache evictions: aggregate across the per-reader B4 caches (issue #1571) — entries evicted to stay within each reader’s byte budget.
key_cache_resident_bytes: usizeKey cache resident bytes: aggregate approximate resident footprint of the per-reader B4 caches (issue #1571).
key_cache_capacity_bytes: usizeKey cache capacity bytes: summed configured byte budget across the per-reader B4 caches (issue #1571).
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