---
name: azion-measure-cache-offload-for-a-domain
description: >-
  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.
---

# Measure cache offload for a domain

You can measure how much of one domain's traffic your applications serve from cache with [Real-Time Metrics](/en/documentation/platform/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](/en/documentation/platform/real-time-metrics/build-dashboards/#data-transferred).

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](/en/documentation/fundamentals/creating-account/).
- An [application](/en/documentation/platform/applications/) served by a [workload](/en/documentation/platform/workloads/), with requests to the domain in the last 24 hours.

**Console**

- Access to Azion Console. To sign in, refer to [How to access Azion Console](/en/documentation/guides/platform/account-and-billing/how-to-access-azion-console/).

**API**

- A personal token. To create one, refer to [How to manage a personal token](/en/documentation/guides/platform/account-and-billing/personal-tokens/).
- `curl`.

---

## 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.

**Console**

To filter the dashboards to one domain in Azion Console:

1. **Open Real-Time Metrics**

   Access [Azion Console](https://console.azion.com/) > **Real-Time Metrics**.

   The page opens on the **Build** category, the **Applications** tab, and the **Data Transferred** dashboard.

2. **Select Last 24 hours**

   In the time-range picker, in the **Quick** tab, under **Commonly used**, select **Last 24 hours**.

3. **Select Update**

4. **Add a filter**

   In the filter row, select the filter icon, whose tooltip reads **Add filter**.

5. **Select the Host field**

   In **Filter**, select **Host**.

6. **Select the Equals operator**

   In **Operator**, select **Equals**.

7. **Enter the domain**

   Enter `www.example.com` as the value.

8. **Select Apply**

A chip under the filter row reads `Host equals: www.example.com`. Every chart of **Data Transferred** now shows only the requests to that domain, over the last 24 hours.

To keep every domain of one workload instead, select the **Domain** field, labeled **Workload** on some accounts, and select the workload from its list.

**API**

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:

```bash
curl -X POST 'https://api.azion.com/v4/metrics/graphql' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token [TOKEN VALUE]' \
  -d '{"query":"query RequestsForHost($begin: DateTime!, $end: DateTime!) { httpMetrics(limit: 1, filter: { tsRange: { begin: $begin, end: $end }, hostEq: \"www.example.com\" }) { requestsTotal } }","variables":{"begin":"2026-01-01T12:00:00","end":"2026-01-02T12:00:00"}}'
```

The API answers `200` with the request count of the host:

```json
{
  "data": {
    "httpMetrics": [
      {
        "requestsTotal": 982
      }
    ]
  }
}
```

`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.

**Console**

To read the offload of the domain in Azion Console, with the host filter applied:

1. **Read the data offload**

   On the **Data Transferred** dashboard, find the **Offload** entry in the legend of the **Edge Offload** chart.

2. **Read the saved and missed data**

   In the legends of the **Saved Data** and **Missed Data** charts, find the byte totals of the range.

3. **Select Requests in the dashboard selector**

4. **Read the request offload**

   In the **Requests Offloaded** chart, find the **Requests Offloaded** entry in the legend.

5. **Read the saved and missed requests**

   In the legends of the **Saved Requests** and **Missed Requests** charts, find the request totals of the range.

The host filter stays applied on **Requests**. Both dashboards read the `httpMetrics` dataset, and only a switch to a dashboard that reads another dataset clears the filters.

The aggregation tag of **Edge Offload** and **Requests Offloaded** reads **Average**. Their legends show the average of the chart's points, not the share over the whole range. For the share of data over the whole range, divide the **Saved Data** total by the sum of the **Saved Data** and **Missed Data** totals.

**API**

To read the same values with the API, select the cache fields of the `httpMetrics` dataset with the same filter:

```bash
curl -X POST 'https://api.azion.com/v4/metrics/graphql' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token [TOKEN VALUE]' \
  -d '{"query":"query CacheOffloadForHost($begin: DateTime!, $end: DateTime!) { httpMetrics(limit: 1, filter: { tsRange: { begin: $begin, end: $end }, hostEq: \"www.example.com\" }) { requestsTotal requestsOffloaded savedRequests missedRequests dataTransferredTotal offload savedData missedData bandwidthOffload } }","variables":{"begin":"2026-01-01T12:00:00","end":"2026-01-02T12:00:00"}}'
```

The API answers `200` with one row for the host:

```json
{
  "data": {
    "httpMetrics": [
      {
        "requestsTotal": 982,
        "requestsOffloaded": 5.19,
        "savedRequests": 51.0,
        "missedRequests": 931.0,
        "dataTransferredTotal": 114490585.0,
        "offload": 0.51,
        "savedData": 577373.0,
        "missedData": 113387464.0,
        "bandwidthOffload": 0.51
      }
    ]
  }
}
```

The row covers the whole range. Read the fields as follows:

- `requestsOffloaded` is the percentage of requests served from cache: `savedRequests` divided by `requestsTotal`.
- `offload` is the percentage of data served from cache: `savedData` divided by the sum of `savedData` and `missedData`.
- `bandwidthOffload` is the same share, measured on bandwidth.
- `savedData` and `missedData` are in bytes.

`savedRequests` and `missedRequests` add up to `requestsTotal`. For every field of the dataset, refer to [Real-Time Metrics GraphQL fields](/en/documentation/devtools/graphql/gql-real-time-metrics-fields/#workloadmetrics).

---

## 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](/en/documentation/platform/applications/cache/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.

**Console**

To find the missed content of the domain in Azion Console, with the host filter applied:

1. **Read the missed data**

   On the **Data Transferred** dashboard, find the **Missed Data** entry in the legend of the **Missed Data** chart.

2. **Select Requests in the dashboard selector**

3. **Read the missed requests**

   In the **Missed Requests** chart, find the **Missed Requests** entry in the legend.

4. **Find the peaks**

   In the **Missed Requests** chart, place the cursor on the highest point. The tooltip shows the value at that point.

The peaks of **Missed Requests** show when the data center sent the most requests of the domain to your origin. The tooltip shows only in a window wider than 540 px.

**API**

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:

```bash
curl -X POST 'https://api.azion.com/v4/metrics/graphql' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token [TOKEN VALUE]' \
  -d '{"query":"query RequestsByCacheStatus($begin: DateTime!, $end: DateTime!) { httpMetrics(limit: 20, filter: { tsRange: { begin: $begin, end: $end }, hostEq: \"www.example.com\" }, aggregate: { sum: requests }, groupBy: [upstreamCacheStatus], orderBy: [sum_DESC]) { upstreamCacheStatus sum } }","variables":{"begin":"2026-01-01T12:00:00","end":"2026-01-02T12:00:00"}}'
```

The API answers `200` with one row for each cache status:

```json
{
  "data": {
    "httpMetrics": [
      {
        "upstreamCacheStatus": "-",
        "sum": 334
      },
      {
        "upstreamCacheStatus": "REVALIDATED",
        "sum": 301
      },
      {
        "upstreamCacheStatus": "MISS",
        "sum": 281
      },
      {
        "upstreamCacheStatus": "HIT",
        "sum": 50
      },
      {
        "upstreamCacheStatus": "EXPIRED",
        "sum": 16
      }
    ]
  }
}
```

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](/en/documentation/devtools/graphql/gql-real-time-metrics-fields/#workloadmetrics).

---

## Next steps

- [Build dashboards](/en/documentation/platform/real-time-metrics/build-dashboards.md#data-transferred): What each chart of the Data Transferred dashboard measures, its unit, and its field.
- [Cache](/en/documentation/platform/applications.md#cache): Change how your applications cache content, to raise the share served from cache.
- [Tiered Cache](/en/documentation/platform/applications/cache/tiered-cache.md): Add a second cache layer between the data center and your origin.
- [Real-Time Metrics best practices](/en/documentation/platform/real-time-metrics/best-practices.md): Choose ranges, filters, and row limits that keep the numbers you read reliable.
