How to Monitor Cache Hit Ratio: Metrics, Logs, Alerts, and Troubleshooting Workflow
Cache MonitoringCDNVarnishNginxPerformance MetricsTroubleshooting

How to Monitor Cache Hit Ratio: Metrics, Logs, Alerts, and Troubleshooting Workflow

CCaching.website Editorial Team
2026-11-14
8 min read

Learn how to monitor cache hit ratio across CDNs, proxies, and application caches, interpret misses, and build a recurring troubleshooting workflow.

Cache hit ratio is useful only when it is measured in the right place and compared with response time, origin load, and traffic patterns. This guide provides a repeatable workflow for monitoring website caching across a CDN, reverse proxy, web server, and application cache, including the metrics to collect, log fields to inspect, alert thresholds to consider, and a decision process for troubleshooting misses and bypasses.

Overview

A cache hit occurs when a request is served by the cache without requiring the next layer or the origin application to generate the response. A cache miss occurs when the cache does not have a usable object and forwards the request. The basic cache hit ratio is:

Cache hit ratio = cache hits ÷ (cache hits + cache misses) × 100

For example, if a CDN records 8,500 hits and 1,500 misses for a defined group of requests, its hit ratio is 85%. That number describes the selected request population and time period; it is not a universal score for the whole website.

Measure each caching layer separately. A CDN may report a hit while the origin-facing reverse proxy records a miss, and an application may use a Redis object cache even when the page itself was not served from a full-page cache. Treat these as different events:

  • Edge or CDN caching: measures whether the visitor-facing edge returned the response.
  • Reverse-proxy or server caching: includes Varnish, Nginx FastCGI cache, or a hosting platform page cache.
  • Application caching: includes WordPress object caching, Redis, database query caching, and application-level fragments.
  • Browser caching: affects repeat visitors but is often invisible in origin logs because the browser may not send a request at all.

The most useful monitoring setup combines cache status with request count, cacheable traffic, origin requests, origin response time, error rate, bandwidth, and resource type. A high ratio can be misleading if only static assets are cached while dynamic HTML continues to overload the origin.

What to track

Build a cache-hit-ratio reference table

Record metrics in a consistent table so that monthly or quarterly comparisons are meaningful. Use the same hostname, path group, HTTP methods, geographic scope, and time window whenever possible.

MetricWhy it mattersUseful breakdowns
RequestsEstablishes the volume behind every percentage.Hostname, path, status code, method, region
Cache hits and missesShows whether the cache is serving eligible requests.CDN, reverse proxy, page cache, asset type
Hit ratioProvides a compact trend indicator.Cacheable HTML, static assets, APIs, bots
Bypass and pass eventsIdentifies requests deliberately sent to the origin.Cookie, authorization, query string, method, rule
Origin request rateShows the work still reaching the application or server.Requests per minute, endpoint, status
TTFB and origin latencyConnects cache behavior to user-facing speed.Cache status, region, endpoint, percentile
Stale responses and revalidationsShows how often cached objects are refreshed or served beyond freshness.Object type, TTL, purge event, status code
ErrorsSeparates caching problems from application or infrastructure failures.4xx, 5xx, timeout, origin, edge

Capture cache status in response headers and logs

Expose a diagnostic header in a controlled way, such as a value that identifies a hit, miss, bypass, or revalidation. Provider names vary, so use the field documented by your CDN or proxy rather than assuming that one header applies everywhere. Also inspect Cache-Control, Age, ETag, Vary, and expiration-related headers when diagnosing an individual response.

At the CDN, collect the cache status, cache key or normalized URL where available, response status, request method, host, path, query-string treatment, and cacheable or uncacheable reason. At Nginx or another reverse proxy, log the cache outcome alongside upstream response time and upstream status. For Varnish, monitor hit, miss, pass, and fetch events, then compare them with backend response time. For an application cache such as Redis, track gets, hits, misses, evictions, memory pressure, and connection errors. Object-cache hits do not prove that full HTML page caching is working.

Use logs to answer specific questions

Log queries should be adapted to the fields and syntax of your platform. The following examples are deliberately generic patterns:

  • CDN: group requests by cache-status field and calculate hits divided by hits plus misses, excluding methods and responses that are never intended to be cached.
  • Nginx: count values such as $upstream_cache_status if that variable is enabled, and compare HIT, MISS, BYPASS, EXPIRED, and STALE with upstream response time.
  • Varnish: compare hit-for-pass, pass, hit, miss, and backend fetch events. A high pass count usually calls for inspection of cookies, authorization, request methods, or VCL rules.
  • Application cache: calculate hit and miss counts by cache namespace or operation, then check evictions and latency. A falling hit ratio caused by memory eviction is different from one caused by incorrect keys.

Keep a small sample of full request and response details for investigation, but avoid logging credentials, session identifiers, payment data, or other sensitive values. Redact query parameters before storing them when they can contain personal or secret information.

Cadence and checkpoints

Monitor the cache continuously if your platform supports it, but review the data at different levels of detail on a schedule.

  • Per request: inspect cache status, cache headers, and timing during deployments, testing, and incident response.
  • Hourly or daily: watch for sudden changes in hit ratio, origin request rate, latency, errors, and bandwidth.
  • After every deployment: test representative anonymous pages, logged-in pages, APIs, static assets, and checkout or account flows. Confirm that purge or warm-up behavior matches the release plan.
  • Monthly: compare cacheable traffic, bypass reasons, top miss paths, TTL behavior, and origin load with the previous period.
  • Quarterly: review cache rules, cache keys, cookie handling, query-string normalization, exclusions, and storage capacity. Include CDN, web-server, application, and hosting changes.

Thresholds should be based on your normal baseline, not copied blindly from another site. As a starting point, investigate a sustained hit-ratio decline of roughly 10 percentage points from the established baseline, a sharp increase in bypasses, or a material rise in origin latency. For low-volume sites, use request counts and longer windows because a small number of misses can distort a percentage.

Create alerts for symptoms that affect users or capacity: rising origin traffic, increased TTFB, elevated 5xx responses, cache storage exhaustion, repeated purge events, or a sudden change in the proportion of cacheable responses. A ratio-only alert can create noise and may miss a serious issue on a high-value path.

How to interpret changes

Start with scope. Compare the same path group, response classes, methods, regions, and visitor types. Then use this decision workflow:

  1. Did request volume or traffic composition change? A bot crawl, campaign, API surge, or new uncached endpoint can lower the overall ratio without a configuration failure. Break the result down by path and user agent before changing rules.
  2. Are the requests eligible for caching? Check HTTP method, authorization, session cookies, response status, Cache-Control, Set-Cookie, and explicit bypass rules. Login, cart, checkout, and personalized responses often require different policies.
  3. Did the cache key change? Inspect host, path, query strings, cookies, device variants, language, compression, and other Vary inputs. An unnecessarily broad key creates fragmentation; an incomplete key can serve the wrong representation.
  4. Are objects expiring too quickly? Review TTL settings, revalidation behavior, deployment purges, and cache capacity. A short TTL may be intentional, but it increases origin requests and can make a healthy cache appear ineffective.
  5. Are requests being bypassed or passed? Look for rule-order changes, cookies added by a plugin, authorization headers, cache-control directives, or a proxy configuration change. Compare the reason code for bypasses rather than treating all misses alike.
  6. Is the origin the actual bottleneck? If hit ratio is stable but TTFB and origin latency rise, investigate web hosting capacity, database performance, upstream dependencies, or server caching. If origin load rises with misses, follow the request path through each layer.

Stale responses require separate analysis. Serving a stale object during an origin problem may protect availability, while stale content after a deployment may indicate an invalidation or TTL problem. Record whether stale behavior is intentional and test purge procedures before relying on them during an incident.

For WordPress, separate anonymous page-cache results from logged-in traffic and admin requests. For WooCommerce or another ecommerce application, measure product and category pages separately from cart, checkout, account, and personalized API requests. For APIs, inspect authentication, HTTP methods, ETags, and explicit cache-control policy before enabling more aggressive caching.

When to revisit

Revisit this monitoring plan at least monthly, with a deeper review each quarter. Return to it immediately after a CDN migration, hosting change, DNS or origin change, cache-plugin update, web-server upgrade, major release, traffic surge, or incident involving stale or incorrect content. These events can change cache keys, headers, purge behavior, routing, or the share of requests that are eligible for caching.

Keep a dated baseline containing the observation window, traffic volume, hit and miss counts, bypass reasons, origin request rate, latency, errors, and configuration version. When a metric changes, annotate the timeline with deployments, rule edits, purges, and infrastructure events. This makes it easier to distinguish a real regression from a normal change in traffic.

Use this practical review sequence:

  1. Choose representative URLs and request types for anonymous, authenticated, dynamic, API, and static traffic.
  2. Record response headers and timing from more than one network location when geography matters.
  3. Calculate hit ratio from raw counts, and report cacheable traffic separately from intentionally bypassed traffic.
  4. Compare CDN, reverse-proxy, application-cache, origin-load, and error metrics for the same period.
  5. Investigate the largest miss and bypass categories before changing TTLs or cache rules.
  6. Test invalidation, stale handling, and uncached flows after any configuration change.
  7. Update dashboards, runbooks, and alert thresholds when the normal baseline has permanently changed.

For related implementation work, use a cache configuration matrix to document layers and ownership, review cache keys before changing CDN rules, and maintain a hosting performance benchmark before and after migrations. Monitoring is most effective when it remains connected to those configuration and deployment records rather than being treated as a single percentage on a dashboard.

Related Topics

#Cache Monitoring#CDN#Varnish#Nginx#Performance Metrics#Troubleshooting
C

Caching.website Editorial Team

Technical Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.