2b.3 observability: log shared-L2 pool report in lane-stats

The CP_HICACHE_LANE_STATS occ/used_tokens are derived from _cp_counts, which the
accounting explicitly skips for shared-L2 metadata (_cp_account_*: `not
_is_cp_shared_l2_metadata`), so they read 0 with l2 pooling on regardless of
actual fill -- wrong gauge for the shared pool. Add cache_controller
.cp_shared_l2_cache_report() (pages_used / pages_capacity / objects_committed /
objects_aborted / objects_evicted + load_hits/misses from the replicated
CpSharedL2PageAllocator stats) to the lane-stats line as `shared_l2_pool=...`
when the allocator is constructed, so fill->evict->load-back is observable.
Read-only; rank-0 only; takes effect on next restart.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-20 18:43:25 +00:00
parent eefc678660
commit 9ac42450e1

View File

@@ -3293,10 +3293,28 @@ class HiRadixCache(RadixCache):
}
self._cp_fallback_counts_last = dict(fallback_counts)
# Shared physical L2 pool report -- the REAL occupancy when l2 pooling is on.
# occ/used_tokens above are derived from _cp_counts, which the accounting
# explicitly skips for shared-L2 metadata (_cp_account_*: `not
# _is_cp_shared_l2_metadata`), so they read 0 even when the pool is full. The
# shared pool tracks its own pages_used/objects_committed/objects_evicted +
# load_hits/misses in the replicated CpSharedL2PageAllocator stats.
shared_l2_report = None
controller = getattr(self, "cache_controller", None)
if controller is not None and getattr(
controller, "cp_shared_l2_page_allocator", None
) is not None:
report_fn = getattr(controller, "cp_shared_l2_cache_report", None)
if report_fn is not None:
try:
shared_l2_report = report_fn()
except Exception:
shared_l2_report = None
logger.info(
"[CP_HICACHE_LANE_STATS] occ=%s cap_tokens=%s used_tokens=%s max=%.3f "
"min=%.3f spread=%.3f imbalance=%s hot_prefix_short=%d hot_prefix_long=%d "
"skew_token_threshold=%d drops_since_last=%s drops_total=%s",
"skew_token_threshold=%d drops_since_last=%s drops_total=%s shared_l2_pool=%s",
[round(x, 3) for x in occ],
list(capacity),
list(used),
@@ -3309,6 +3327,7 @@ class HiRadixCache(RadixCache):
skew_token_threshold,
drops_since_last,
dict(fallback_counts),
shared_l2_report,
)
def _probe_existing_radix_prefix_len_no_split(self, key: RadixKey) -> int: