Measure cache offload for a domain
Filter Real-Time Metrics to one domain and read how much of its data and requests came from cache, in Azion Console or with the GraphQL API.
You can measure how much of one domain’s traffic your applications serve from cache with Real-Time Metrics, in Azion Console or with the GraphQL API.
Three measures answer the question. Offload is the share of data or requests that the data center delivered from its cache. Saved counts the data or requests it delivered from cache, without fetching the content from the origin. Missed counts what it delivered after fetching the content from the origin. For the full definition of each chart, refer to Build dashboards.
The examples read the last 24 hours of the host www.example.com. Replace it with a domain your workload answers on.
Select your interface once. The prerequisites and every task below show only that path.
Prerequisites
- An Azion account. To create one, refer to Create an account.
- An application served by a workload, with requests to the domain in the last 24 hours.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
Filter to the domain
With no filter, the cache charts cover every application of the account. A filter on the host keeps only the requests to that domain.
In the API, the hostEq filter keeps the requests of one host, next to the tsRange filter that sets the period. Before you read the cache values, confirm that the host has requests in the range.
Send a POST request to https://api.azion.com/v4/metrics/graphql. Replace [TOKEN VALUE] with your personal token, and the host and dates with your own:
The API answers 200 with the request count of the host:
requestsTotal counts the requests to the host in the range. A requestsTotal of 0 means no request to that host reached your applications in the range. Correct the host or the dates before you read the cache values.
Read the offload of data and requests
Real-Time Metrics measures the cache in two units. The Data Transferred dashboard counts bytes, and the Requests dashboard counts requests.
To read the same values with the API, select the cache fields of the httpMetrics dataset with the same filter:
The API answers 200 with one row for the host:
The row covers the whole range. Read the fields as follows:
requestsOffloadedis the percentage of requests served from cache:savedRequestsdivided byrequestsTotal.offloadis the percentage of data served from cache:savedDatadivided by the sum ofsavedDataandmissedData.bandwidthOffloadis the same share, measured on bandwidth.savedDataandmissedDataare in bytes.
savedRequests and missedRequests add up to requestsTotal. For every field of the dataset, refer to Real-Time Metrics GraphQL fields.
Find what reached the origin
Missed data and missed requests are the content the data center fetched from your origin before it delivered it. The higher they are, the more of the domain’s demand your origin handles. When the application uses Tiered Cache, the Tiered Cache Offload chart of the Tiered Cache tab shows the share of data that the Tiered Cache layer delivered to the data center without fetching it from the origin.
To see how the requests of the host split by cache status, group them by upstreamCacheStatus, the status of the local cache for each request. The query sums requests for each status, the largest first:
The API answers 200 with one row for each cache status:
Each row sums the requests that carry one value of upstreamCacheStatus, such as HIT, MISS, REVALIDATED, EXPIRED, or -. For every value of upstreamCacheStatus, refer to Real-Time Metrics GraphQL fields.