API7 Enterprise Streamlines API Traffic Management by Traffic Labeling

Sijing Zhang

June 14, 2023

Products

We are excited to announce that the API7 Enterprise is about to launch a groundbreaking new plugin called "traffic-label". This feature will provide unprecedented control and flexibility to API traffic management, allowing your enterprise to optimize performance, personalize user experiences through precise traffic classification, and gain valuable insights through accurate traffic analysis.

Get ready to explore this highly anticipated innovation, as you will experience unparalleled traffic management capabilities.

Traffic Labeling

Traffic labeling, widely used in API traffic management, is a technique that involves precise classification and tagging of traffic. This allows for different strategies and decisions to be made in subsequent processing and analysis based on the type of traffic.

The working principle of traffic labeling involves several steps:

  • Traffic capture: The API gateway or proxy captures incoming API requests and response traffic.
  • Attribute extraction: Key attributes, such as request path, method, headers, etc., are extracted from the captured traffic.
  • Rule matching: The extracted attributes are matched against predefined traffic classification rules to determine the traffic category.
  • Traffic labeling: Based on the matching results, specified fields are added to the request headers to label the traffic.
  • Subsequent processing: Different processing strategies, such as routing, rate limiting, authentication, etc., can be applied based on the traffic category.

Application Scenarios of Traffic Labeling

  1. A/B testing: By labeling traffic, users can be divided into different groups and directed to access different versions or features. This allows for evaluating and comparing the effectiveness of different versions, thereby making better decisions.

  2. Feature release: During the release of new features, traffic labeling can be used to redirect a portion of users to the new feature for evaluating its stability and user experience. This helps mitigate risks and ensure the proper functioning of the new feature.

  3. Performance optimization: By labeling the traffic, a portion of the traffic can be directed to optimized services or infrastructure to verify the effectiveness of performance improvements. This helps enhance system responsiveness and stability.

  4. Troubleshooting: When a system experiences faults or anomalies, traffic labeling can help route specific user traffic to the target system for fault detection and troubleshooting. This enables more precise analysis and problem resolution.

  5. Personalized customization: By applying traffic labeling, user traffic can be divided into different groups, allowing for personalized services or content tailored to each group. This helps enhance user experience and satisfaction.

Application Examples of Traffic Labeling

As shown in the figure, here is an example of traffic labeling.

  1. Distinguish traffic from different terminals based on the UID field in the request, such as distinguished by devices (App/webpage/mini program) or the regions where the users are from.

  2. Take 20% of the requests with UID = 1 as test traffic, and add "env=v1" in the header. This portion of traffic will enter the v1 environment, while the user module, order module, and product module will still use the services in the base environment.

  3. Add "env=v2" in the header of terminal requests with UID = 2, and route all this traffic to the v2 environment. The user and product modules of the v2 environment can be used, while the order module will still use the services in the base environment.

Traffic Labeling Diagram

Differences from Existing Plugins

  1. Differences from the "traffic-split" plugin:

    a. Supports tracking traffic splitting based on headers: The "traffic-split" plugin immediately takes effect on the gateway for traffic splitting and does not modify the requests themselves. You can only obtain the final result of the traffic splitting and can not trace a specific request, such as whether it went through traffic splitting or how it was split, for further detailed analysis.

    b. Supports secondary splitting by other platforms beyond the gateway: In microservices architectures, requests pass through multiple modules, and the "traffic-split" plugin can only perform one round of traffic splitting at the gateway. It cannot further split the traffic into subsequent services.

  2. Differences from the "workflow" plugin:

    Supports setting multiple matching rules and performs separate modifications for requests that match different rules. The difference is that the "traffic-label" plugin allows setting weights for the modification actions, and the traffic will be distributed according to the configured weights.

Implementing Traffic Labeling Using API7 Enterprise

  1. Define clear goals and strategies:

    Before starting with traffic labeling, it's crucial to clearly define your goals and strategies. Determine the specific outcomes you want to achieve and establish corresponding strategies and rules to accomplish those goals. This may involve performance optimization, personalized customization, data analysis, and other aspects.

  2. Configure the "traffic-label" plugin:

    The core configuration of the plugin consists of a match condition and an actions array. The match condition supports logical operators such as "AND" and "OR". The actions define one or more actions to be executed.

    Once a match is successful, actions are allocated based on their weights. For example, if action1 has a weight of 3 and action2 has a weight of 7, 30% of the traffic will execute action1, while 70% will execute action2.

  3. Continuously monitor and fine-tune:

    Traffic labeling is not a one-time task but an ongoing process. Monitoring the effectiveness and results of traffic labeling is crucial to ensure that it achieves the desired outcomes and meets the goals. Based on monitoring results, make timely adjustments and optimizations to improve the accuracy and efficiency of traffic labeling.

  4. Collaboration between development and ops teams:

    The success of traffic labeling requires close collaboration and cooperation between the development and ops teams. The development team is responsible for implementing the technical solution for traffic labeling, while the ops team is responsible for strategy formulation, monitoring the results, and making adjustments. Ensure smooth communication between these two teams and share information and data to collectively drive the successful implementation of traffic labeling.

    By following these best practices, you can effectively apply traffic labeling and enhance the effectiveness and value of API traffic management.

Contact Us for More!

Traffic labeling is not just a feature but represents API7 Enterprise's continuous efforts and innovation in meeting the needs of modern enterprises and developers. We are committed to providing best practices and tools that enable you to fully leverage traffic labeling and achieve more precise and flexible API traffic management.

API7 Enterprise offers rich features such as security, reliability, and scalability, as well as efficient API management tools and analytics capabilities, helping enterprise users achieve efficient and stable application integration. Feel free to reach out to us https://api7.ai/contact for personalized support and solutions.

Tags:
API7 EnterpriseAPI Gateway ConceptsTraffic ManagementAPI7 New Features