存储

缓存指标


缓存命中情况可以通过日志浏览器中的metadata.response.headers.cf_cache_status字段来判定。任何值为HITSTALEREVALIDATEDUPDATING的情况都属于缓存命中。

以下示例查询将显示edge_logs中排名前50的缓存未命中情况:

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;

您可以在日志浏览器中尝试此查询

要计算时间维度上的缓存命中率,可以使用以下查询:

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;

您可以在日志浏览器中尝试此查询