> For the complete documentation index, see [llms.txt](https://www.axisnow.io/zh/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.axisnow.io/zh/docs/multi-edge/services/routing.md). Agents can also search and read this documentation through its [MCP server](https://www.axisnow.io/zh/docs/~gitbook/mcp).

# 流量调度

多 CDN 流量调度：按地区和运营商配置路由规则，支持固定、主备故障切换和按质量评分优选三种模式

流量调度（Routing）决定不同地区和运营商的访客分别走哪一家边缘提供商，并根据拨测到的可用性和性能动态调整：一家故障或变差时自动切到其他家，恢复后切回。您只需在服务（Service）的 **流量调度** 标签页配置规则，拨测、判定和 DNS 更新由 AxisNow 完成。

## 创建路由规则 <a href="#create-routing-rule" id="create-routing-rule"></a>

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-5edcf18599eeeaf85544cd838eb9df659ab96cee%2Frouting-01.png?alt=media" alt="创建路由规则：地域为中国，模式为质量优选，选择拨测组和边缘提供商"><figcaption></figcaption></figure>

### 访客范围 <a href="#choose-visitor-scope" id="choose-visitor-scope"></a>

**地域** 是规则覆盖的访客范围：**默认**（Default，所有访客）、大洲、国家/地区，或中国运营商。范围可以重叠，访客按最精细的那条规则处理；同一个范围只能有一条规则。

第一条规则锁定为 **默认**，它是所有访客的兜底。之后再为需要区别对待的地区添加规则，例如让中国大陆访客走 ESA、其他地区在 Cloudflare 与 CloudFront 之间择优。

### 路由模式 <a href="#choose-routing-mode" id="choose-routing-mode"></a>

<table data-search="false"><thead><tr><th width="150">模式</th><th>行为</th><th width="140">拨测</th><th>适合</th></tr></thead><tbody><tr><td>固定（Fixed）</td><td>始终使用指定的一家</td><td>可选，只用于观测</td><td>某个地区固定走一家；服务暂时只有一家边缘</td></tr><tr><td>主备（Failover）</td><td>按顺序使用第一家可用的；主用不可用时切到备用，恢复后切回</td><td>必需</td><td>有明确主用边缘，其他家只作容灾</td></tr><tr><td>质量优选（Quality）</td><td>在可用的边缘中按质量评分择优。评分领先明显且稳定时才切换，不会因为短暂的小幅领先而切换</td><td>必需</td><td>几家同等对待，让数据决定谁来服务</td></tr></tbody></table>

规则创建后再添加到服务的边缘提供商不会自动加入规则，需要编辑规则。

### 拨测配置 <a href="#probe-config-on-create" id="probe-config-on-create"></a>

创建默认规则时，需要同时完成服务的拨测配置：

* **拨测 URL**：预填为 `https://` 加服务域名，建议改为一个可缓存的小文件，见[拨测最佳实践](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probing.md#probing-best-practices)。留空则使用 TCP 拨测，两种方式的区别见[拨测方式](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probing.md#probe-type)。
* **拨测组**：默认规则没有推荐的拨测组，需要按访客来源选择，见[拨测组](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probing.md#probe-groups)。

异常条件和阈值已有默认值，可以按需调整，含义见[可用性判定](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probing.md#availability-judgment)。固定模式的规则不开启拨测时，不需要以上配置。

之后创建的规则共用服务的拨测 URL，只需要选择拨测组。

### 质量优选的评分 <a href="#quality-score" id="quality-score"></a>

质量优选按 **首字节时间**（TTFB）为每家边缘打分。TTFB 是一次拨测中 TCP 连接、TLS 握手和等待响应首字节三段耗时之和，不包含拨测点解析边缘 CNAME 的时间，也不包含响应体的下载时间；只统计成功的拨测。

评分范围 0–100，综合 TTFB 的高低、波动和近期稳定性得出，越高越好。评分只在判定为可用的边缘之间比较，不可用的边缘不参与，可用性的判定见[可用性判定](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probing.md#availability-judgment)。

择优每 10 分钟进行一次，评分更高不代表立即切换：

* **领先幅度**：另一家的评分需要明显高于当前生效的边缘。两家评分接近时保持不变，避免来回切换。
* **历史波动**：评分计入 TTFB 的波动和近期的异常情况。一家边缘偶尔很快但波动大，评分会低于持续稳定的一家。

TTFB 衡量的是什么，取决于拨测 URL 是否被边缘缓存：

* **被缓存**：请求由边缘直接响应，TTFB 反映访客到这家边缘的网络质量。这是多数站点应该比较的指标。
* **不被缓存**：每次拨测都回源，TTFB 主要是源站的响应时间。各家边缘回的是同一个源站，评分差距被源站耗时淹没，择优结果容易随机波动。

服务未设置拨测 URL 时，评分使用 TCP 连接时间。

## 相关页面 <a href="#related" id="related"></a>

* [拨测](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probing.md)：拨测方式、可用性判定、拨测组和最佳实践。
* [运行状态与调度记录](https://www.axisnow.io/zh/docs/multi-edge/services/routing/status.md)：各项指标的定义和 24 小时调度记录。
* [拨测洞察](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probe-insight.md)：一家边缘的拨测明细，用于定位延迟和异常的来源。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.axisnow.io/zh/docs/multi-edge/services/routing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
