cache-observability

majiayu000's avatarfrom majiayu000

Track cache hit rates, latency, and detect cache-related issues

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026

When & Why to Use This Skill

This Claude skill provides comprehensive cache observability by tracking critical performance metrics such as hit rates, latency, and memory usage. It empowers developers and SREs to proactively detect bottlenecks like cache stampedes or high eviction rates, ensuring optimal application speed and resource efficiency for systems like Redis and Memcached.

Use Cases

  • Performance Optimization: Analyze hit rates to fine-tune TTL settings and cache warming strategies, ensuring high-speed data retrieval.
  • Latency Troubleshooting: Monitor GET operation durations and p99 metrics to identify network bottlenecks or serialization overhead.
  • Capacity Planning: Track memory consumption and eviction counts to prevent memory pressure and inform infrastructure scaling decisions.
  • Incident Prevention: Detect 'cache stampedes' and high-cardinality issues early to prevent backend system overload during traffic spikes.
namecache-observability
description"Track cache hit rates, latency, and detect cache-related issues"
priority2

Cache Observability

Cache is performance-critical. Track hit rate, latency, and evictions.

Key Metrics

Metric Type Description
cache.hits Counter Successful reads
cache.misses Counter Reads that missed
cache.gets.duration Histogram GET latency
cache.evictions Counter Keys evicted
cache.memory.used Gauge Memory consumption

Span Attributes

Attribute Example Required
cache.system redis, memcached Yes
cache.operation GET, SET Yes
cache.hit true/false Yes
cache.key_prefix user:* Recommended (not full key!)

Hit Rate

hit_rate = cache.hits / (cache.hits + cache.misses)
  • Good: >90%
  • Concerning: <80% → Check TTL, warming strategy

Issues to Detect

Issue Detection Fix
Low hit rate <80% Tune TTL, warm cache
Cache stampede Many misses for same key Distributed locks
High latency p99 >10ms Check network, value size
Memory pressure memory >90% of max Eviction policy, sizing

Cache Wrapper Pattern

Before GET: Start timer
After GET:  Record duration, increment hits or misses, set cache.hit on span

Anti-Patterns

  • Full keys in metrics → High cardinality, use prefix only
  • No eviction monitoring → Can't detect memory pressure
  • Ignoring serialization time → Track total time including marshal

References

  • references/platforms/{platform}/cache.md