Cache Metrics
Cache hits can be determined via the metadata.response.headers.cf_cache_status
key in our Logs Explorer. Any value that corresponds to either HIT
, STALE
, REVALIDATED
, or UPDATING
is categorized as a cache hit.
The following example query will show the top cache misses from the edge_logs
:
_17select_17 r.path as path,_17 r.search as search,_17 count(id) as count_17from_17 edge_logs as f_17 cross join unnest(f.metadata) as m_17 cross join unnest(m.request) as r_17 cross join unnest(m.response) as res_17 cross join unnest(res.headers) as h_17where_17 starts_with(r.path, '/storage/v1/object')_17 and r.method = 'GET'_17 and h.cf_cache_status in ('MISS', 'NONE/UNKNOWN', 'EXPIRED', 'BYPASS', 'DYNAMIC')_17group by path, search_17order by count desc_17limit 50;
Try out this query in the Logs Explorer.
Your cache hit ratio over time can then be determined using the following query:
_12select_12 timestamp_trunc(timestamp, hour) as timestamp,_12 countif(h.cf_cache_status in ('HIT', 'STALE', 'REVALIDATED', 'UPDATING')) / count(f.id) as ratio_12from_12 edge_logs as f_12 cross join unnest(f.metadata) as m_12 cross join unnest(m.request) as r_12 cross join unnest(m.response) as res_12 cross join unnest(res.headers) as h_12where starts_with(r.path, '/storage/v1/object') and r.method = 'GET'_12group by timestamp_12order by timestamp desc;
Try out this query in the Logs Explorer.