Storage

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
select r.path as path, r.search as search, count(id) as countfrom edge_logs as f cross join unnest(f.metadata) as m cross join unnest(m.request) as r cross join unnest(m.response) as res cross join unnest(res.headers) as hwhere starts_with(r.path, '/storage/v1/object') and r.method = 'GET' and h.cf_cache_status in ('MISS', 'NONE/UNKNOWN', 'EXPIRED', 'BYPASS', 'DYNAMIC')group by path, searchorder by count desclimit 50;

Try out this query in the Logs Explorer.

Your cache hit ratio over time can then be determined using the following query:

1
2
3
4
5
6
7
8
9
10
11
12
select timestamp_trunc(timestamp, hour) as timestamp, countif(h.cf_cache_status in ('HIT', 'STALE', 'REVALIDATED', 'UPDATING')) / count(f.id) as ratiofrom edge_logs as f cross join unnest(f.metadata) as m cross join unnest(m.request) as r cross join unnest(m.response) as res cross join unnest(res.headers) as hwhere starts_with(r.path, '/storage/v1/object') and r.method = 'GET'group by timestamporder by timestamp desc;

Try out this query in the Logs Explorer.