---
title: "API7 Enterprise's Canary Traffic Shifting Strategy for Precise Traffic Control - API7.ai"
description: "Discover how API7 Enterprise empowers enterprises in canary traffic shifting for efficient testing and performance optimization."
url: "https://api7.ai/blog/api7-canary-traffic-shifting"
---

[Blog](https://api7.ai/blog)

[Products](https://api7.ai/category/products)[Technology](https://api7.ai/category/technology)[Ecosystem](https://api7.ai/category/ecosystem)[Case Study](https://api7.ai/category/usercase)[Team & Community](https://api7.ai/category/community)

Search

⌘ + K

[Blog](https://api7.ai/blog)

Products

# API7 Enterprise's Canary Traffic Shifting Strategy for Precise Traffic Control

January 29, 2024

[Products](https://api7.ai/category/products)

In a modern microservices architecture, the API gateway serves as the traffic entry of systems, handling crucial tasks such as request routing, identity authentication, rate limiting, and circuit breaker. [API7 Enterprise](https://api7.ai/enterprise), as a robust API management platform built on the APISIX, offers users rich and flexible functionalities, with canary traffic shifting playing a pivotal role in scenarios like seamless service upgrades and validation of new features.

## Overview of Features

### Creating Upstream Based on Upstream Services

Upon a service being deployed to the gateway groups of API7 Enterprise, administrators can effortlessly derive a new upstream for canary traffic shifting from services of existing baseline upstream. The upstream can inherit all configurations from the baseline upstream or selectively inherit the tested historical configurations. This design significantly simplifies the configuration process, reducing repetitive work and potential configuration errors. Additionally, the canary traffic shifting upstream supports configuring new nodes or integrating service discovery mechanisms. This means that without affecting existing business logic, a portion of the traffic can be redirected to new servers or environments for performance testing, feature validation, or other types of evaluation.

### Flexible Shifting Conditions and Weights

When initiating canary traffic shifting strategies, administrators can finely define the conditions and weights for shifting traffic:

**Shifting Conditions**: These determine which traffic should be directed to the canary traffic shifting upstream. Administrators can combine multiple conditions using logical operators (such as "AND" and "OR") to ensure that only requests meeting specific conditions enter the canary traffic shifting environment.

Properties that can be used for judgment include:

- **Header**: Specific fields in the request header, such as `User-Agent`.

- **Cookie**: Cookie information sent by the client, commonly used for user identification or session state recognition.

- **Query Parameters**: Query string parameters in the URL.

- **Variables**: System or custom variables, such as geographic location or user roles.

  Matching logic includes equal to (==), not equal to (\~=), regular matching (\~\~), among other methods, ensuring the flexibility and precision of condition judgment.

  For example, administrators can set the following shifting condition: "When the `User-Agent` field in the request header contains 'iPhone' and the `user_group` field in the Cookie equals 'test\_group', redirect the request to the traffic shifting upstream."

**Shifting Weights**: These determine what percentage of traffic should be directed to the canary traffic shifting upstream. It's a percentage value that allows administrators to gradually increase or decrease the traffic entering the canary traffic shifting environment.

Initially, the weight may be set to a low value (e.g., 10%) to ensure that new features are tested within a small range. As testing progresses and results are collected, the weight can gradually increase until eventually, 100% of the traffic switches to the new version.

By flexibly adjusting shifting conditions and weights, administrators can effectively control the scope and impact of canary traffic shifting testing, ensuring the smooth rollout of new features and system stability.

![Traffic Shifting of API7 Enterprise](https://static.api7.ai/uploads/2024/01/29/Mm2x59Vk_canary-release.png?imageMogr2/format/webp)

## Practical Application Scenarios

1. **New Feature Validation**: When a development team completes a new feature and prepares to release it, canary traffic shifting can be used to initially roll out the new feature to a small subset of users or specific user groups. This allows for collecting user feedback in a real environment while ensuring that if any issues arise, the scope of impact is manageable.
2. **Performance Testing**: During significant events or high-concurrency scenarios, administrators can use canary traffic shifting to redirect a portion of the traffic to newly configured, higher-capacity nodes to test the system's performance limits and stability.
3. **Gradual Migration**: During service upgrades or migrations, canary traffic shifting can help administrators gradually transition traffic from the old environment to the new environment, ensuring a smooth migration process.

## Best Practices

1. **Reasonably Setting Shifting Conditions**: Choosing appropriate shifting conditions based on actual needs is crucial. For example, for tests targeting specific user groups, precise shifting can be achieved through user identifiers in Cookies or Headers.
2. **Dynamic Adjustment of Weights**: During testing, dynamically adjusting shifting weights based on test results and user feedback can expedite the collection of valid data or narrow down the scope of issues.
3. **Monitoring and Alerting**: Strengthening monitoring of relevant metrics during traffic shifting and setting appropriate alert mechanisms enables timely detection and resolution of issues.

## Conclusion

Through the canary traffic shifting of [API7 Enterprise](https://docs.api7.ai/enterprise/introduction), enterprises can not only ensure service stability but also flexibly conduct new feature testing, performance optimization, and other operations, providing robust support for rapid business growth.

Tags:

[Traffic Management](https://api7.ai/tags/traffic-management)

Share article link

Share

Related Posts

[![Traffic Split in Apache APISIX Ingress Controller](https://static.api7.ai/uploads/2024/09/06/4ZG5lbPP_Traffic%20Split.png)](https://api7.ai/blog/traffic-split-in-apache-apisix-ingress-controller)

## [Traffic Split in Apache APISIX Ingress Controller](https://api7.ai/blog/traffic-split-in-apache-apisix-ingress-controller)

[![AISIX 1.10.0: Keep AI Coding Sessions on a Matched Semantic Route](https://static.api7.ai/uploads/2026/11/13/5rPD4mvs_aisix-1-10-0-semantic-routing-session-affinity.webp)](https://api7.ai/blog/aisix-1-10-0-semantic-routing-session-affinity)

## [AISIX 1.10.0: Keep AI Coding Sessions on a Matched Semantic Route](https://api7.ai/blog/aisix-1-10-0-semantic-routing-session-affinity)

Table of Contents

- [Overview of Features](#overview-of-features)

  - [Creating Upstream Based on Upstream Services](#creating-upstream-based-on-upstream-services)
  - [Flexible Shifting Conditions and Weights](#flexible-shifting-conditions-and-weights)

- [Practical Application Scenarios](#practical-application-scenarios)

- [Best Practices](#best-practices)

- [Conclusion](#conclusion)

## Related Posts

[![API7 Enterprise 3.0: Accelerating Business Growth](https://static.api7.ai/uploads/2024/01/23/RXTQoan0_enterprise3.0.png)](https://api7.ai/blog/api7-enterprise-3.0)

Products

August 31, 2023

#### [API7 Enterprise 3.0: Accelerating Business Growth](https://api7.ai/blog/api7-enterprise-3.0)

Unleash the power of API7 Enterprise 3.0! Experience GraphQL plugin support, seamless SOAP integration, traffic labeling, gateway group releases, declarative APIs, and enhanced token management.

[API7 Enterprise](https://api7.ai/tags/api7-enterprise)

[SOAP](https://api7.ai/tags/soap)

[Traffic Management](https://api7.ai/tags/traffic-management)

[![API7 Enterprise Streamlines API Traffic Management by Traffic Labeling](https://static.api7.ai/uploads/2024/12/25/DEIRFiDW_api7-traffic-labeling.png)](https://api7.ai/blog/api7-enterprise-traffic-labeling)

Products

June 14, 2023

#### [API7 Enterprise Streamlines API Traffic Management by Traffic Labeling](https://api7.ai/blog/api7-enterprise-traffic-labeling)

API7 Enterprise supports a new plugin called "traffic-label", allowing more flexible and precise traffic control.

[API7 Enterprise](https://api7.ai/tags/api7-enterprise)

[API Gateway Concepts](https://api7.ai/tags/api-gateway-concepts)

[Traffic Management](https://api7.ai/tags/traffic-management)

[![Apache APISIX Unifies Full Traffic Management with Service Mesh](https://static.api7.ai/uploads/2024/09/06/9D7kJMeJ_Service%20Mesh.png)](https://api7.ai/blog/apisix-unifies-traffic-management-with-service-mesh)

Products

October 28, 2022

#### [Apache APISIX Unifies Full Traffic Management with Service Mesh](https://api7.ai/blog/apisix-unifies-traffic-management-with-service-mesh)

The article introduces how Apache APISIX unifies full traffic management with Service Mesh around APISIX-based Service Mesh Solution.

[APISIX Basics](https://api7.ai/tags/apisix-basics)

[Traffic Management](https://api7.ai/tags/traffic-management)

[Service Mesh](https://api7.ai/tags/service-mesh)
