Flow switching method and device, storage medium and computer equipment
By generating target policy snapshots and combining them with a caching mechanism, accurate and real-time traffic switching is achieved during the microservice architecture upgrade process, solving the problem in existing technologies where traffic switching methods cannot adjust strategies in real time, and improving the stability and efficiency of the system.
Patent Information
- Application Number
- CN202511009103.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-22
- Publication Date
- 2025-09-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
During the upgrade of the existing microservice architecture, the traffic switching method cannot adjust the traffic strategy in real time and lacks fine-grained control capabilities, resulting in high risk of service interruption and errors.
By obtaining the traffic to be controlled and generating a target policy snapshot, including policy type, parameter rules, and action direction, the traffic is matched with the target parameter rules. If the match is successful, the traffic is cut to the new service cluster; otherwise, it is forwarded to the old service cluster. This is combined with a caching mechanism and priority management of multiple policy types.
It achieves accurate and real-time switching of traffic, reduces the risk of service interruption, and improves the reliability and response speed during the microservice architecture upgrade process.
Smart Images

Figure CN120639701A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of distributed system architecture, and in particular to a traffic switching method, apparatus, storage medium, and computer equipment. Background Art
[0002] Currently, microservice architecture upgrades primarily utilize either downtime upgrades or rolling upgrades to switch service versions. However, both approaches have drawbacks. Downtime upgrades can cause service interruptions and prevent real-time traffic policy adjustments, impacting user experience. While rolling upgrades can reduce service interruptions to a certain extent, they still present complex traffic switching, lack fine-grained traffic control capabilities, and are prone to errors. Summary of the Invention
[0003] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defects that the traffic switching method used in the microservice architecture upgrade process in the existing technology cannot adjust the traffic strategy in real time and cannot achieve precise traffic control.
[0004] The present application provides a traffic switching method, the method comprising:
[0005] Obtain the traffic to be controlled and the target policy snapshot generated in advance based on the user's latest configured target traffic switching policy. The target policy snapshot includes the target policy type, target parameter rules, and target action direction. Different policy types correspond to different parameter rules and action directions.
[0006] The traffic to be controlled is matched with the target parameter rule. If the match is successful, the traffic to be controlled is cut off according to the target action direction. If the match fails, the traffic to be controlled is forwarded to the old service cluster.
[0007] Optionally, obtaining a target policy snapshot generated in advance according to a target traffic switching policy newly configured by the user includes:
[0008] Determine the policy type and policy configuration time corresponding to the policy snapshot stored in the cache, where the policy snapshot is pre-generated based on the user-configured traffic switching policy;
[0009] According to the policy type and the policy configuration time, a target policy snapshot corresponding to the latest configured target traffic switching policy is obtained from the cache.
[0010] Optionally, obtaining a target policy snapshot corresponding to a newly configured target traffic switching policy from the cache according to the policy type and the policy configuration time includes:
[0011] If the policy type is one type, then according to the policy configuration time, obtain the policy snapshot corresponding to the latest configured traffic switching policy from the cache, and use the latest configured traffic switching policy as the target traffic switching policy, and use the obtained policy snapshot as the target policy snapshot;
[0012] If there are multiple policy types, the policy snapshot with the highest priority is determined according to the priority of each policy type, and the policy snapshot with the highest priority corresponding to the latest configured flow switching policy is obtained from the cache according to the policy configuration time corresponding to the highest priority policy snapshot, and the latest configured flow switching policy is used as the target flow switching policy, and the obtained policy snapshot with the highest priority is used as the target policy snapshot.
[0013] Optionally, the policy types include designated user type, mobile phone number rule type, percentage type and global type;
[0014] The priority of the designated user type is > the priority of the mobile phone number rule type > the priority of the percentage type > the priority of the global type.
[0015] Optionally, when the target policy type is a designated user type, the target parameter rule is a designated user list, and the target action direction is to switch traffic generated by users in the designated user list to a new service cluster;
[0016] The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes:
[0017] Determine the user ID included in the traffic to be controlled;
[0018] Comparing the user ID with the user IDs in the designated user list;
[0019] If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
[0020] Optionally, when the target policy type is the first type in the mobile phone number rule type, the target parameter rule is a first target value corresponding to the first N digits of the mobile phone number, and the target action direction is to switch the traffic corresponding to the first target value to the new service cluster;
[0021] The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes:
[0022] Determine the first N digits of the mobile phone number contained in the traffic to be controlled;
[0023] Compare the first N digits of the mobile phone number with the first target value;
[0024] If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
[0025] Optionally, when the target policy type is the second type in the mobile phone number rule type, the target parameter rule is a second target value corresponding to the last M digits of the mobile phone number, and the target action direction is to switch the traffic corresponding to the second target value to the new service cluster;
[0026] The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes:
[0027] Determine the last M digits of the mobile phone number contained in the traffic to be controlled;
[0028] Compare the last M digits of the mobile phone number with the second target value;
[0029] If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
[0030] Optionally, when the target policy type is the third type of mobile phone number rule type, the target parameter rule is a complete mobile phone number list, and the target action direction is to switch the traffic corresponding to the complete mobile phone number list to a new service cluster;
[0031] The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes:
[0032] Determine the complete mobile phone number contained in the traffic to be controlled;
[0033] Comparing the complete mobile phone number with the complete mobile phone number list;
[0034] If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
[0035] Optionally, when the target policy type is percentage type, the target parameter rule is the numerical range of the last two digits of the mobile phone number, and the target action direction is to switch the traffic corresponding to the numerical range of the last two digits of the mobile phone number to the new service cluster;
[0036] The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes:
[0037] Determine the values of the last two digits of the mobile phone number included in the traffic to be controlled;
[0038] Compare the value of the last two digits of the mobile phone number with the value range of the last two digits of the mobile phone number;
[0039] If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
[0040] Optionally, the method further includes:
[0041] After switching the traffic corresponding to the numerical range of the last two digits of the mobile phone number to the new service cluster, monitoring the error rate of the new service cluster;
[0042] If the error rate of the new service cluster reaches a preset error rate threshold, the numerical range of the last two digits of the mobile phone number is adjusted downward.
[0043] Optionally, when the target policy type is the fourth type in the global type, the target parameter rule is empty, and the target action direction is to switch the to-be-controlled traffic to a new service cluster;
[0044] The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes:
[0045] Directly forward the traffic to be controlled to the new service cluster.
[0046] Optionally, when the target policy type is the fifth type in the global type, the target parameter rule is empty, and the target action direction is to switch the to-be-controlled traffic to the old service cluster;
[0047] The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes:
[0048] The traffic to be controlled is directly forwarded to the old service cluster.
[0049] The present application also provides a flow switching device, comprising:
[0050] An information acquisition module is used to obtain the traffic to be controlled and a target policy snapshot generated in advance based on the user's latest configured target traffic switching policy. The target policy snapshot includes the target policy type, target parameter rules, and target action direction. Different policy types correspond to different parameter rules and action directions.
[0051] The traffic switching module is used to match the traffic to be controlled with the target parameter rule. If the match is successful, the traffic to be controlled is switched according to the target action direction. If the match fails, the traffic to be controlled is forwarded to the old service cluster.
[0052] The present application also provides a computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the traffic switching method described in any of the above embodiments.
[0053] The present application also provides a computer device, comprising: one or more processors, and a memory;
[0054] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the traffic switching method described in any one of the above embodiments are performed.
[0055] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0056] The present application provides a flow switching method, device, storage medium and computer equipment. First, the flow data to be controlled can be obtained, which is the basis for subsequent flow switching operations. At the same time, the system will generate a detailed target policy snapshot in advance based on the target flow switching policy newly configured by the user. The target policy snapshot includes the type of target policy, the rules of target parameters and the direction of target action. Different policy types correspond to different parameter rules and action directions to ensure the accuracy and real-time performance of the flow switching operation. Next, the present application can match the obtained flow to be controlled with the target parameter rules. If the match is successful, the flow switching operation will be performed on the flow to be controlled in accordance with the target action direction to ensure that the flow is correctly distributed according to the preset target flow switching policy. On the contrary, if the match fails, the flow to be controlled will be forwarded to the old service cluster to ensure the continuity and stability of the service and avoid service interruption problems caused by matching failures. Through this series of operation processes, the present application can efficiently and accurately handle flow splitting, thereby effectively improving the reliability and response speed of the overall service. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0058] Figure 1 A flow chart of a flow switching method provided in an embodiment of the present application;
[0059] Figure 2 A system architecture diagram of the flow control process provided in an embodiment of the present application;
[0060] Figure 3 A schematic diagram of the process of obtaining a target policy snapshot provided in an embodiment of the present application;
[0061] Figure 4 A schematic structural diagram of a flow switching device provided in an embodiment of the present application;
[0062] Figure 5 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0064] In one embodiment, Figure 1 As shown, Figure 1 A flow chart of a traffic switching method provided in an embodiment of the present application; the present application provides a traffic switching method, which may include:
[0065] S110: Obtain the traffic to be controlled and the target policy snapshot generated in advance based on the target traffic switching policy newly configured by the user. The target policy snapshot includes the target policy type, target parameter rules and target action direction. Different policy types correspond to different parameter rules and action directions.
[0066] In this step, during the microservice architecture upgrade process, this application can obtain the traffic to be controlled, as well as the target policy snapshot generated in advance based on the user's latest configured target flow switching strategy. Since the target policy snapshot contains the target policy type, target parameter rules and target action direction, this application can determine the flow switching strategy for the traffic to be controlled based on the target policy snapshot.
[0067] Among them, the target flow switching strategy of this application refers to the traffic switching strategy that the user expects to implement during the microservice architecture upgrade process. The strategy is generated based on the user's latest configuration and is saved and referenced in the form of a target policy snapshot. The target policy snapshot records in detail the policy type, parameter rules and action direction of the target flow switching strategy, providing clear guidance for subsequent traffic matching and flow switching operations. By introducing the target policy snapshot, this application can respond to the user's traffic switching needs in real time, ensuring that the traffic switching during the microservice architecture upgrade process is both accurate and efficient.
[0068] Furthermore, the policy types of the present application include but are not limited to designated user type, mobile phone number rule type, percentage type and global type. These policy types cover various traffic switching scenarios that may be encountered during the upgrade of the microservice architecture, and provide users with flexible and diverse traffic control methods. The parameter rules of the present application refer to the specific conditions or rules used to match the traffic to be controlled. These rules are generated based on the target traffic switching strategy configured by the user and are associated with different policy types. For example, in a designated user type policy, the parameter rule can be a list of user IDs used to match the traffic of a specific user; in a mobile phone number rule type policy, the parameter rule may involve specific digits or numerical ranges of a mobile phone number, used to match traffic that meets the rules of a specific mobile phone number; in a percentage type policy, the parameter rule may define a percentage range to match a certain proportion of traffic. By defining these parameter rules, the present application can achieve fine-grained control of traffic and ensure that traffic is switched accurately in the way the user expects.
[0069] The action direction of this application refers to the specific operation path that should be executed after the traffic to be controlled is successfully matched. For example, the traffic is cut from the old service cluster to the new service cluster, or under certain specific conditions, the traffic continues to remain in the old service cluster. As a key component of the target policy snapshot, the action direction directly determines the final result of the traffic switching and is crucial to ensuring a smooth transition in the microservice architecture upgrade process. The traffic switching method of this application can achieve comprehensive and flexible control of traffic by comprehensively considering the target policy type, target parameter rules and target action direction, effectively improving the traffic management capabilities during the microservice architecture upgrade process.
[0070] In a specific implementation, Figure 2 As shown, Figure 2 A system architecture diagram of the flow control process provided in an embodiment of the present application; Figure 2In the , traffic filters are used to control the forwarding of user requests and control whether access is to the new service cluster or the old service cluster. The policy decision engine is used to determine which traffic switching strategy is currently configured in the system and whether the user of the current request matches the strategy. The console is used to access the Apollo Configuration Center, which is a distributed configuration management system used to centrally manage application configuration information. It supports dynamic updates, version control, and environment isolation, helping developers simplify the configuration management process, improve development efficiency, and improve system maintainability. The policy repository is used to receive policy snapshots in a specified format configured by the Apollo Configuration Center and converted by the console into a cache for use by the policy decision engine service.
[0071] S120: Match the traffic to be controlled with the target parameter rule. If the match is successful, perform a flow switching operation on the traffic to be controlled according to the target action direction. If the match fails, forward the traffic to be controlled to the old service cluster.
[0072] In this step, after obtaining the traffic to be controlled through S110 and the target policy snapshot generated in advance based on the user's latest configured target flow cutting policy, this application can match the traffic to be controlled with the target parameter rules in the target policy snapshot, and accurately control the traffic to be controlled based on the matching results.
[0073] Specifically, if the traffic to be controlled successfully matches the target parameter rules, indicating that the traffic meets the user's preset switching conditions, the system will trigger the switching operation and direct the controlled traffic to the new service cluster in the target direction. This step ensures that only traffic that meets the specified conditions is switched to the new service cluster, avoiding unnecessary traffic migration and improving system processing efficiency and stability. After receiving this traffic, the new service cluster will process it according to the established business logic and provide services to users.
[0074] Conversely, if the traffic to be controlled fails to successfully match the target parameter rules, this means that the traffic does not meet the user's preset traffic switching conditions. To ensure service continuity and stability, the system will default to forwarding the traffic to the old service cluster. The old service cluster will continue to process this traffic according to the original business logic until the user decides to perform the next traffic switching operation. This design ensures both flexible traffic switching and service reliability, avoiding service interruptions caused by traffic switching.
[0075] Through the aforementioned traffic switching method, the system achieves comprehensive and flexible control over traffic, ensuring that traffic is precisely switched according to user expectations. This not only improves traffic management capabilities during microservice architecture upgrades, but also effectively reduces the risks and costs associated with traffic switching. Furthermore, this traffic switching method offers excellent scalability and maintainability, adapting to evolving user business needs and providing strong support for the upgrade and evolution of microservice architectures.
[0076] In the above embodiment, first, the traffic data to be controlled can be obtained, which is the basis for subsequent flow switching operations. At the same time, the system will generate a detailed target policy snapshot in advance based on the target flow switching strategy newly configured by the user. The target policy snapshot includes the type of target policy, the rules of target parameters, and the direction of target action. Different policy types correspond to different parameter rules and action directions to ensure the accuracy and real-time performance of the flow switching operation. Next, the present application can match the acquired flow to be controlled with the target parameter rules. If the match is successful, the flow switching operation will be performed on the flow to be controlled in accordance with the target action direction to ensure that the flow is correctly distributed according to the preset target flow switching strategy. On the contrary, if the match fails, the flow to be controlled will be forwarded to the old service cluster to ensure the continuity and stability of the service and avoid service interruption problems caused by matching failures. Through this series of operation processes, the present application can efficiently and accurately handle flow splitting, thereby effectively improving the reliability and response speed of the overall service.
[0077] In one embodiment, Figure 3 As shown, Figure 3 A schematic diagram of a process for obtaining a target policy snapshot provided in an embodiment of the present application; obtaining a target policy snapshot generated in advance based on the user's latest configured target traffic switching policy in S110 may include:
[0078] S111: Determine the policy type and policy configuration time corresponding to the policy snapshot stored in the cache. The policy snapshot is pre-generated according to the traffic switching policy configured by the user.
[0079] S112: According to the policy type and policy configuration time, a target policy snapshot corresponding to the latest configured target traffic switching policy is obtained from the cache.
[0080] In this embodiment, during microservice architecture upgrades or maintenance, to ensure smooth traffic switching, the system can pre-generate policy snapshots based on user-configured traffic switching policies and store them in a cache. These policy snapshots detail the user's desired traffic switching policy, including policy type, parameter rules, and action direction, providing clear guidance for subsequent traffic matching and traffic switching operations.
[0081] Specifically, when traffic switching needs to be performed, the present application can first determine the policy type and policy configuration time corresponding to the policy snapshot saved in the cache. The policy type reflects the traffic control method and conditions expected by the user, while the policy configuration time is used to identify the latest user configuration to ensure that the traffic switching operation is based on the latest user needs. Based on the policy type and policy configuration time, the present application can retrieve the target policy snapshot corresponding to the latest configured target traffic switching policy from the cache. This step ensures that the system can obtain the user's latest configured traffic switching policy, providing an accurate and reliable basis for subsequent traffic matching and traffic switching operations.
[0082] By introducing policy snapshots and caching mechanisms, this application can achieve real-time response and efficient management of user configurations, ensure the accuracy and real-time performance of traffic switching operations, and effectively improve traffic management capabilities during microservice architecture upgrades or maintenance.
[0083] In one embodiment, in S112, obtaining a target policy snapshot corresponding to the latest configured target traffic switching policy from the cache according to the policy type and the policy configuration time may include:
[0084] S1121: If the policy type is one type, obtain a policy snapshot corresponding to the latest configured traffic switching policy from the cache according to the policy configuration time, use the latest configured traffic switching policy as the target traffic switching policy, and use the obtained policy snapshot as the target policy snapshot.
[0085] S1122: If there are multiple policy types, the policy snapshot with the highest priority is determined according to the priority of each policy type, and the policy snapshot with the highest priority corresponding to the latest configured flow switching policy is obtained from the cache according to the policy configuration time corresponding to the highest priority policy snapshot, and the latest configured flow switching policy is used as the target flow switching policy, and the obtained policy snapshot with the highest priority is used as the target policy snapshot.
[0086] In this embodiment, in a microservice architecture, the configuration of traffic switching policies may involve multiple types, each corresponding to different business requirements and switching conditions. To ensure the accuracy and efficiency of traffic switching, this application can determine a policy snapshot with the highest priority as the target policy snapshot based on the multiple policy types configured by the user.
[0087] Specifically, when the policy type is a single type, this application can directly obtain the policy snapshot corresponding to the latest configured flow switching policy from the cache based on the policy configuration time, and use it as the target policy snapshot. However, in more complex scenarios, users may configure multiple types of flow switching policies. At this time, this application can first determine the highest priority among these policy types based on the preset priority rules. The priority rules can be set based on various factors such as business needs, user importance, and traffic characteristics. Once the policy type with the highest priority is determined, this application can retrieve the policy snapshot corresponding to the latest configured flow switching policy from the cache based on the policy type and its corresponding policy configuration time, and use it as the target policy snapshot.
[0088] It's understood that the highest-priority policy type mentioned above refers to the highest-priority policy type among all policy snapshots currently stored in the cache. This step ensures that when faced with multiple policy types, the system can intelligently select the policy snapshot that best meets current business needs, providing an accurate and reliable basis for subsequent traffic matching and traffic switching operations.
[0089] In one embodiment, the policy types may include a designated user type, a mobile phone number rule type, a percentage type, and a global type.
[0090] The priority of the designated user type is > the priority of the mobile phone number rule type > the priority of the percentage type > the priority of the global type.
[0091] In this embodiment, in the microservice architecture, the configuration of the traffic switching strategy may involve multiple types, including but not limited to designated user type, mobile phone number rule type, percentage type and global type.
[0092] Specifically, user-specific policies allow users to precisely specify which users' traffic should be redirected to the new service cluster. This policy type is ideal for scenarios where traffic testing or upgrades require targeting specific user groups. By specifying a user list, the system can precisely identify and redirect these users' traffic, ensuring they access the latest service versions.
[0093] Mobile phone number rule-based policies match and split traffic based on user phone number characteristics. This type of policy allows you to create traffic switching rules based on the first or last digits of a phone number, or a complete phone number list. For example, you can redirect traffic whose first N digits of a phone number are specific values to a new service cluster to test traffic flow for users in a specific area. Mobile phone number rule-based policies provide users with more granular traffic control capabilities, making traffic switching more accurate and efficient.
[0094] The percentage-based policy matches and splits traffic based on the numeric range of the last two digits of the phone number. This policy type is suitable for scenarios where traffic needs to be gradually migrated to the new service cluster in a certain proportion. By setting different numeric ranges, users can flexibly control the traffic distribution ratio between the old and new service clusters, ensuring a smooth transition during service upgrades.
[0095] A global policy is a simpler and more direct way to switch traffic. It doesn't rely on user-specific matching criteria; instead, it directly switches all traffic to the new or existing service cluster. This policy type is ideal for scenarios requiring rapid service version switching or emergency recovery. With a global policy, users can quickly migrate traffic to the target service cluster, ensuring service continuity and stability.
[0096] Furthermore, this application also sets different priorities for different policy types. For example, the priority of the designated user type is higher than the mobile phone number rule type, the priority of the mobile phone number rule type is higher than the percentage type, and the priority of the percentage type is higher than the global type. Such priority setting can not only reflect the importance and applicability of different policy types in the process of microservice architecture upgrade, ensuring that the system can give priority to the policy type that best meets the current business needs when executing traffic switching, but also avoid policy conflicts.
[0097] In one embodiment, when the target policy type is a designated user type, the target parameter rule is a designated user list, and the target action direction is to switch traffic generated by users in the designated user list to a new service cluster.
[0098] In S120, the flow to be controlled is matched with the target parameter rule. If the match is successful, a flow switching operation is performed on the flow to be controlled according to the target action direction, which may include:
[0099] S121: Determine the user ID included in the traffic to be controlled.
[0100] S122: Compare the user ID with the user IDs in the designated user list.
[0101] S123: If the comparison is successful, forward the traffic to be controlled to the new service cluster.
[0102] In this embodiment, when the target policy type is the designated user type, the target parameter rule is the designated user list, and the target action direction is to switch the traffic generated by the users in the designated user list to the new service cluster.
[0103] Based on this, the application first determines the user ID contained in the traffic to be controlled, which is key information for identifying traffic ownership. The application then compares this user ID with the user IDs in the specified user list. This step is the core of traffic matching, determining which traffic meets the user's preset switching conditions and is therefore directed to the new service cluster.
[0104] If the match is successful, meaning the user ID whose traffic is to be controlled appears in the designated user list, the application will immediately trigger a traffic switch, forwarding this traffic to the new service cluster. The new service cluster will then process this traffic according to the latest business logic, providing users with an upgraded service experience. This design not only ensures accurate traffic switching but also significantly improves the system's efficiency in handling specific user traffic.
[0105] Conversely, if the user ID of the traffic to be controlled does not appear in the designated user list, this means that the traffic does not meet the user's preset switching conditions. To ensure service continuity and stability, this application will forward the traffic to the old service cluster by default. The old service cluster will continue to process this traffic according to the original business logic until the user decides to perform the next traffic switching operation or update the designated user list.
[0106] This traffic switching mechanism enables granular control of traffic, ensuring that only traffic meeting specific criteria is switched to the new service cluster. This not only meets user needs for traffic testing or prioritized upgrades for specific user groups, but also avoids unnecessary traffic migration, improving the system's overall processing efficiency and stability. Furthermore, this mechanism offers excellent scalability and maintainability, adapting to evolving business needs and providing strong support for the upgrade and evolution of microservice architectures.
[0107] In one embodiment, when the target policy type is the first type in the mobile phone number rule type, the target parameter rule is the first target value corresponding to the first N digits of the mobile phone number, and the target action direction is to cut the traffic corresponding to the first target value to the new service cluster.
[0108] In S120, the flow to be controlled is matched with the target parameter rule. If the match is successful, a flow switching operation is performed on the flow to be controlled according to the target action direction, which may include:
[0109] S221: Determine the first N digits of the mobile phone number contained in the traffic to be controlled.
[0110] S222: Compare the first N digits of the mobile phone number with the first target value.
[0111] S223: If the comparison is successful, forward the traffic to be controlled to the new service cluster.
[0112] In this embodiment, when the target policy type is the first type of mobile phone number rule type, such as PHONE_PREFIX, the target parameter rule is concretized as the first target value corresponding to the first N digits of the mobile phone number, and the target action direction is to divert this part of the traffic that meets the characteristics of the specific mobile phone number to the new service cluster. To achieve this goal, the system can first extract the mobile phone number information from the traffic to be controlled and accurately obtain the values of its first N digits. This step is the prerequisite for traffic matching, which ensures that the system can accurately identify traffic based on the mobile phone number rules configured by the user.
[0113] The system then compares the extracted first N digits of the phone number with the preset first target value. This comparison determines which traffic meets the user's preset phone number rules and is therefore eligible to be directed to the new service cluster. If the comparison is successful, meaning the first N digits of the phone number to be controlled match the first target value, the system immediately performs a traffic diversion operation, forwarding this traffic to the new service cluster. The new service cluster will process this traffic based on the latest business logic, providing users with a more detailed and personalized service experience.
[0114] Conversely, if the first N digits of the mobile phone number of the traffic to be controlled do not match the first target value, this means that the traffic does not meet the user's preset mobile phone number rules. To ensure service continuity and stability, the system will forward this traffic to the old service cluster by default. The old service cluster will continue to use the original business logic to process this traffic until the user decides to perform the next traffic switch operation or update the mobile phone number rules.
[0115] Through this traffic switching mechanism, the system can achieve refined traffic control based on the characteristics of the user's mobile phone number. This not only meets the user's needs for traffic testing or priority service for specific user groups, but also ensures a smooth transition and efficient operation of the service.
[0116] In one embodiment, when the target policy type is the second type in the mobile phone number rule type, the target parameter rule is the second target value corresponding to the last M digits of the mobile phone number, and the target action direction is to cut the traffic corresponding to the second target value to the new service cluster.
[0117] In S120, the flow to be controlled is matched with the target parameter rule. If the match is successful, a flow switching operation is performed on the flow to be controlled according to the target action direction, which may include:
[0118] S321: Determine the M digits after the mobile phone number contained in the traffic to be controlled.
[0119] S322: Compare the last M digits of the mobile phone number with the second target value.
[0120] S323: If the comparison is successful, forward the traffic to be controlled to the new service cluster.
[0121] In this embodiment, when the target policy type is the second type of mobile phone number rule, such as PHONE_SUFFIX, the target parameter rule is concretized as the second target value corresponding to the last M digits of the mobile phone number, and the target action direction is to guide this part of the traffic that meets the characteristics of the specific mobile phone number to the new service cluster. To achieve this goal, the system can first parse the mobile phone number information from the traffic to be controlled and accurately capture the value of the last M digits. This step is crucial as it ensures that the system can accurately identify traffic based on the mobile phone number rules configured by the user.
[0122] Next, the system compares the last two digits of the parsed phone number with the preset second target value. This comparison determines which traffic meets the user's preset phone number rules and is therefore eligible to be directed to the new service cluster. If the comparison results in a match, meaning that the last two digits of the phone number for the traffic to be controlled match the second target value, the system immediately switches the traffic to the new service cluster. The new service cluster will process this traffic based on the latest business logic, providing users with more refined and personalized services.
[0123] However, if the last M digits of the phone number to be controlled do not match the second target value, this means that the traffic does not meet the user's preset phone number rules. To ensure service continuity and stability, the system will redirect this traffic to the old service cluster by default. The old service cluster will continue to use the original business logic to handle this traffic until the user decides to perform the next traffic switch operation or update the phone number rules.
[0124] Through this traffic switching mechanism, the system can achieve refined traffic management based on the characteristics of the user's mobile phone number. This not only meets the user's needs for traffic testing or priority service for specific user groups, but also ensures a smooth transition and efficient operation of the service.
[0125] In one embodiment, when the target policy type is the third type of mobile phone number rule type, the target parameter rule is a complete mobile phone number list, and the target action direction is to switch the traffic corresponding to the complete mobile phone number list to a new service cluster.
[0126] In S120, the flow to be controlled is matched with the target parameter rule. If the match is successful, a flow switching operation is performed on the flow to be controlled according to the target action direction, which may include:
[0127] S421: Determine the complete mobile phone number included in the traffic to be controlled.
[0128] S422: Compare the complete mobile phone number with the complete mobile phone number list.
[0129] S423: If the comparison is successful, forward the traffic to be controlled to the new service cluster.
[0130] In this embodiment,
[0131] When the target policy type is the third type of phone number rule, such as PHONE_SPECIFY, the target parameter rule is further refined to a complete list of phone numbers, and the target action is to direct traffic that fully matches the phone numbers in the list to the new service cluster. To implement this policy, the system first needs to extract the complete phone number information from the traffic to be controlled. This step is crucial because it ensures that the system can accurately identify and match traffic based on the phone number list provided by the user.
[0132] The system then compares the extracted full phone numbers against a pre-set list of full phone numbers. This comparison determines which traffic fully meets the user's pre-set phone number rules and is therefore eligible to be directed to the new service cluster. If the comparison results in a match, meaning the phone number in the traffic to be controlled appears in the pre-set phone number list, the system immediately triggers a traffic switch, redirecting this traffic to the new service cluster. The new service cluster will process this traffic according to the latest business logic, providing users with a more refined and personalized service experience.
[0133] However, if the phone number in the traffic to be controlled doesn't appear in the pre-set phone number list, this means the traffic doesn't meet the user's pre-set phone number rules. To ensure service continuity and stability, the system will redirect this traffic to the old service cluster by default. The old service cluster will continue to process this traffic using the existing business logic until the user decides to switch traffic or update the phone number list.
[0134] For example, when a financial APP is reconstructing its user registration process, it needs to ensure that unregistered users use the new architecture, while registered users keep using the old architecture to avoid affecting existing user data. In this case, this application can configure a list of unregistered user mobile phone numbers. When a user visits the registration page, the system detects whether the mobile phone number is in the specified list. Unregistered users (in the list) → route to the new registration architecture, and registered users (not in the list) → route to the old registration architecture. This not only allows for precise control of traffic for specific user groups, but also prevents new architecture problems from affecting registered users, and allows for real-time addition / removal of test users without code deployment. In the reconstruction of the registration process, this application successfully verified the stability of the new registration process by configuring 3,000 unregistered user mobile phone numbers for testing the new architecture. During this period, registered users were completely unaffected, achieving zero complaint upgrades.
[0135] In one embodiment, when the target policy type is a percentage type, the target parameter rule is the numerical range of the last two digits of the mobile phone number, and the target action direction is to cut the traffic corresponding to the numerical range of the last two digits of the mobile phone number to the new service cluster.
[0136] In S120, the flow to be controlled is matched with the target parameter rule. If the match is successful, a flow switching operation is performed on the flow to be controlled according to the target action direction, including:
[0137] S521: Determine the values of the last two digits of the mobile phone number included in the traffic to be controlled.
[0138] S522: Compare the value of the last two digits of the mobile phone number with the value range of the last two digits of the mobile phone number.
[0139] S523: If the comparison is successful, forward the traffic to be controlled to the new service cluster.
[0140] In this embodiment, when the target policy type is a percentage type, the target parameter rule is set to the numerical range of the last two digits of the mobile phone number, and the target action direction is to direct the traffic that meets this numerical range to the new service cluster. In order to achieve this goal, the system can first extract the mobile phone number information from the traffic to be controlled and accurately obtain the numerical values of the last two digits. For example, this application can intercept the last two characters of the mobile phone number (such as the last digit of 138xxxx8000 is 00), convert it into an integer (range: 0~99), and the corresponding value is 0. If the last digit is 99, it will be 99 after conversion.
[0141] The system then compares the last two digits of the extracted mobile phone number against a preset range. This comparison determines which traffic meets the user's preset percentage and is therefore eligible to be directed to the new service cluster. If the comparison is successful, meaning the last two digits of the mobile phone number whose traffic is to be controlled fall within the preset range, the system immediately switches traffic and forwards this traffic to the new service cluster. The new service cluster will process this traffic based on the latest business logic, providing users with a more diverse service experience.
[0142] Conversely, if the last two digits of the mobile phone number to be controlled do not fall within the preset range, this means that the traffic does not meet the user's preset percentage rule. To ensure service continuity and stability, the system will forward this traffic to the old service cluster by default. The old service cluster will continue to use the original business logic to process this traffic until the user decides to perform the next traffic switch operation or update the percentage rule.
[0143] For example, an e-commerce system needs to gradually switch users to a new order system, requiring a gradual increase in traffic by 10% while ensuring that the same user is always routed to the same architecture. This application can gradually configure the corresponding switching strategy according to this requirement, as shown in the following table:
[0144] Table 1 is a table for dynamically adjusting the flow ratio
[0145]
[0146] As can be seen from Table 1, the present application can dynamically adjust the flow cutting ratio according to business needs, and realize the gradual migration of traffic by presetting different numerical ranges of the last two digits of the mobile phone number. For example, in the initial stage, the numerical range can be set to 00-09, so that only 10% of the traffic will be directed to the new service cluster. With the stable operation of the new service cluster and the collection of user feedback, the numerical range can be gradually expanded, such as increasing it to 10-19, thereby realizing 20% of traffic migration. In this way, the system can smoothly transition traffic, which not only ensures the gradual verification and optimization of the new service cluster, but also avoids the risks that may be caused by migrating a large amount of traffic at one time.
[0147] To ensure that the same user is always routed to the same architecture, the system can tag the user's first visit based on the last two digits of their phone number and use this tag to route traffic on subsequent visits. This way, even if the value range changes, the same user's traffic will be reliably directed to the service cluster they were routed to during their first visit, ensuring a consistent user experience and continuous service.
[0148] In summary, this application achieves refined management and efficient control of traffic by providing flexible and diverse traffic switching strategies. Whether based on user ID, phone number rules, or percentage rules, the system can be configured and adjusted according to the user's specific needs, providing strong support for the upgrade and evolution of microservice architectures.
[0149] In one embodiment, the method may further include:
[0150] S524: After switching the traffic corresponding to the numerical range of the last two digits of the mobile phone number to the new service cluster, the error rate of the new service cluster is monitored.
[0151] S525: If the error rate of the new service cluster reaches a preset error rate threshold, the numerical range of the last two digits of the mobile phone number is adjusted downward.
[0152] In this embodiment, in the process of dynamically switching traffic based on the numerical range of the last two digits of the mobile phone number, the present application can also introduce an error rate monitoring and dynamic adjustment mechanism, thereby making the traffic switching strategy more robust and flexible.
[0153] Specifically, once the system successfully directs traffic within the last two digits of the phone number to the new service cluster, this application can automatically initiate error rate monitoring for the new service cluster. This step is crucial as it ensures the system can promptly detect and respond to potential issues within the new service cluster, thereby ensuring service stability and reliability.
[0154] During the monitoring process, if the system detects that the error rate of the new service cluster has reached the preset error rate threshold, this means that the new service cluster may have encountered a performance bottleneck, logical error, or other factors that affect service stability. In order to ensure service continuity and user experience, the system will immediately trigger a dynamic adjustment mechanism to lower the range of the last two digits of the mobile phone number that was originally set. This adjustment reduces the proportion of traffic directed to the new service cluster, reduces the pressure on the new service cluster, and also provides the development team with a valuable time window to troubleshoot and fix problems. Compared with traditional methods, this application can achieve improvements in many aspects, as shown in Table 2:
[0155] Table 2 is a comparison between the traditional solution and this solution
[0156]
[0157] As can be seen from Table 2, this application not only improves the robustness and flexibility of the traffic switching strategy by introducing an error rate monitoring and dynamic adjustment mechanism, but also significantly enhances the reliability and user experience of the microservice architecture. Specifically, when a new service cluster encounters a problem, the system can respond quickly and reduce the affected traffic by adjusting the numerical range, thereby effectively avoiding service interruption or performance degradation. This provides the development team with ample time to locate and resolve the problem, ensuring the continued stable operation of the service. In addition, this dynamic adjustment mechanism can also be gradually optimized according to the actual performance of the new service cluster, ultimately achieving a smooth transition of traffic and a comprehensive upgrade of services.
[0158] In one embodiment, when the target policy type is the fourth type in the global type, the target parameter rule is empty, and the target action direction is to switch the to-be-controlled traffic to a new service cluster.
[0159] In S120, the flow to be controlled is matched with the target parameter rule. If the match is successful, a flow switching operation is performed on the flow to be controlled according to the target action direction, which may include:
[0160] S621: Directly forward the traffic to be controlled to the new service cluster.
[0161] In this embodiment, when the target policy type is the fourth type of global policy (e.g., NO), the target parameter rule is set to empty. This means that no specific filtering or matching operations are performed on the traffic to be controlled, and all traffic is directly directed to the new service cluster. This policy is suitable for scenarios where all user traffic needs to be fully and quickly migrated to the new service cluster, such as full system upgrades and the full launch of new business logic.
[0162] To achieve this, the system eliminates the need for complex parsing or matching of control traffic. Instead, it directly switches traffic and forwards all traffic to the new service cluster. This greatly simplifies the traffic switching process and improves switching efficiency. The new service cluster will receive and process all migrated traffic, providing users with the latest service experience.
[0163] In one embodiment, when the target policy type is the fifth type in the global type, the target parameter rule is empty, and the target action direction is to switch the to-be-controlled traffic to the old service cluster.
[0164] In S120, the flow to be controlled is matched with the target parameter rule. If the match is successful, a flow switching operation is performed on the flow to be controlled according to the target action direction, which may include:
[0165] S721: Directly forward the traffic to be controlled to the old service cluster.
[0166] In this embodiment, when the target policy type is the fifth type of global policy, such as NO_FORWARD, the target parameter rule is also set to empty, but the processing method in this case is completely different from the fourth type described above. Under this policy, the system will directly direct all controlled traffic to the old service cluster instead of the new service cluster. This decision is typically used in scenarios where it is necessary to maintain system stability and avoid potential risks of the new service cluster affecting the user experience, such as when the new service cluster is in the testing phase and has not yet been fully optimized.
[0167] To achieve this, the system also eliminates the need for complex filtering or matching of control traffic. Instead, it directly executes the traffic switching command, forwarding all traffic to the old service cluster. This process simplifies operational complexity and ensures efficient traffic switching. The old service cluster will continue to use its existing business logic to handle this traffic, providing users with a stable service experience until the new service cluster is ready and traffic switching can be performed again.
[0168] The flow switching device provided in an embodiment of the present application is described below. The flow switching device described below and the flow switching method described above can be referenced to each other.
[0169] In one embodiment, Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of a flow switching device provided in an embodiment of the present application. The present application also provides a flow switching device, which may include an information acquisition module 210 and a flow switching module 220, specifically including the following:
[0170] The information acquisition module 210 is used to obtain the traffic to be controlled and the target policy snapshot generated in advance based on the target flow switching policy newly configured by the user. The target policy snapshot includes the target policy type, target parameter rules and target action direction. Different policy types correspond to different parameter rules and action directions.
[0171] The traffic switching module 220 is used to match the traffic to be controlled with the target parameter rule. If the match is successful, the traffic to be controlled is switched according to the target action direction. If the match fails, the traffic to be controlled is forwarded to the old service cluster.
[0172] In the above embodiment, first, the traffic data to be controlled can be obtained, which is the basis for subsequent flow switching operations. At the same time, the system will generate a detailed target policy snapshot in advance based on the target flow switching strategy newly configured by the user. The target policy snapshot includes the type of target policy, the rules of target parameters, and the direction of target action. Different policy types correspond to different parameter rules and action directions to ensure the accuracy and real-time performance of the flow switching operation. Next, the present application can match the acquired flow to be controlled with the target parameter rules. If the match is successful, the flow switching operation will be performed on the flow to be controlled in accordance with the target action direction to ensure that the flow is correctly distributed according to the preset target flow switching strategy. On the contrary, if the match fails, the flow to be controlled will be forwarded to the old service cluster to ensure the continuity and stability of the service and avoid service interruption problems caused by matching failures. Through this series of operation processes, the present application can efficiently and accurately handle flow splitting, thereby effectively improving the reliability and response speed of the overall service.
[0173] In one embodiment, the present application also provides a computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the traffic switching method described in any of the above embodiments.
[0174] In one embodiment, the present application further provides a computer device, including: one or more processors, and a memory.
[0175] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the traffic switching method described in any one of the above embodiments are performed.
[0176] Schematically, as Figure 5 As shown, Figure 5 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 can be provided as a server. Figure 5 Computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by memory 301 for storing instructions executable by processing component 302, such as an application. The application stored in memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, processing component 302 is configured to execute the instructions to perform the traffic switching method of any of the above-mentioned embodiments.
[0177] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or the like.
[0178] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0179] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0180] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.
[0181] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A flow switching method, characterized in that: The method comprises: Obtain the traffic to be controlled and the target policy snapshot generated in advance based on the user's latest configured target traffic switching policy. The target policy snapshot includes the target policy type, target parameter rules, and target action direction. Different policy types correspond to different parameter rules and action directions. The traffic to be controlled is matched with the target parameter rule. If the match is successful, the traffic to be controlled is cut off according to the target action direction. If the match fails, the traffic to be controlled is forwarded to the old service cluster.
2. The flow switching method according to claim 1, characterized in that: The step of obtaining a target policy snapshot generated in advance based on the target traffic switching policy newly configured by the user includes: Determine the policy type and policy configuration time corresponding to the policy snapshot stored in the cache, where the policy snapshot is pre-generated based on the user-configured traffic switching policy; According to the policy type and the policy configuration time, a target policy snapshot corresponding to the latest configured target traffic switching policy is obtained from the cache.
3. The flow switching method according to claim 2, characterized in that: The acquiring, from the cache according to the policy type and the policy configuration time, a target policy snapshot corresponding to the latest configured target traffic switching policy includes: If the policy type is one type, then according to the policy configuration time, obtain the policy snapshot corresponding to the latest configured traffic switching policy from the cache, and use the latest configured traffic switching policy as the target traffic switching policy, and use the obtained policy snapshot as the target policy snapshot; If there are multiple policy types, the policy snapshot with the highest priority is determined according to the priority of each policy type, and the policy snapshot with the highest priority corresponding to the latest configured flow switching policy is obtained from the cache according to the policy configuration time corresponding to the highest priority policy snapshot, and the latest configured flow switching policy is used as the target flow switching policy, and the obtained policy snapshot with the highest priority is used as the target policy snapshot.
4. The flow switching method according to claim 1 or 3, characterized in that: The policy types include designated user type, mobile phone number rule type, percentage type and global type; The priority of the designated user type is > the priority of the mobile phone number rule type > the priority of the percentage type > the priority of the global type.
5. The flow switching method according to claim 1, characterized in that: When the target policy type is a designated user type, the target parameter rule is a designated user list, and the target action direction is to switch the traffic generated by the users in the designated user list to the new service cluster; The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes: Determine the user ID included in the traffic to be controlled; Comparing the user ID with the user IDs in the designated user list; If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
6. The flow switching method according to claim 1, characterized in that: When the target policy type is the first type of the mobile phone number rule type, the target parameter rule is the first target value corresponding to the first N digits of the mobile phone number, and the target action direction is to switch the traffic corresponding to the first target value to the new service cluster; The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes: Determine the first N digits of the mobile phone number contained in the traffic to be controlled; Compare the first N digits of the mobile phone number with the first target value; If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
7. The flow switching method according to claim 1, characterized in that: When the target policy type is the second type of the mobile phone number rule type, the target parameter rule is the second target value corresponding to the last M digits of the mobile phone number, and the target action direction is to switch the traffic corresponding to the second target value to the new service cluster; The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes: Determine the last M digits of the mobile phone number contained in the traffic to be controlled; Compare the last M digits of the mobile phone number with the second target value; If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
8. The flow switching method according to claim 1, characterized in that: When the target policy type is the third type of mobile phone number rule type, the target parameter rule is a complete mobile phone number list, and the target action direction is to switch the traffic corresponding to the complete mobile phone number list to the new service cluster; The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes: Determine the complete mobile phone number contained in the traffic to be controlled; Comparing the complete mobile phone number with the complete mobile phone number list; If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
9. The flow switching method according to claim 1, characterized in that: When the target policy type is percentage type, the target parameter rule is the numerical range of the last two digits of the mobile phone number, and the target action direction is to switch the traffic corresponding to the numerical range of the last two digits of the mobile phone number to the new service cluster; The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes: Determine the values of the last two digits of the mobile phone number included in the traffic to be controlled; Compare the value of the last two digits of the mobile phone number with the value range of the last two digits of the mobile phone number; If the comparison is successful, the traffic to be controlled is forwarded to the new service cluster.
10. The flow switching method according to claim 9, characterized in that: The method further comprises: After switching the traffic corresponding to the numerical range of the last two digits of the mobile phone number to the new service cluster, monitoring the error rate of the new service cluster; If the error rate of the new service cluster reaches a preset error rate threshold, the numerical range of the last two digits of the mobile phone number is adjusted downward.
11. The flow switching method according to claim 1, wherein: When the target policy type is the fourth type in the global type, the target parameter rule is empty, and the target action direction is to switch the to-be-controlled traffic to the new service cluster; The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes: Directly forward the traffic to be controlled to the new service cluster.
12. The flow switching method according to claim 1, characterized in that: When the target policy type is the fifth type in the global type, the target parameter rule is empty, and the target action direction is to switch the to-be-controlled traffic to the old service cluster; The matching of the flow to be controlled with the target parameter rule, and if the match is successful, performing a flow switching operation on the flow to be controlled according to the target action direction, includes: The traffic to be controlled is directly forwarded to the old service cluster.
13. A flow switching device, characterized in that: include: An information acquisition module is used to obtain the traffic to be controlled and a target policy snapshot generated in advance based on the user's latest configured target traffic switching policy. The target policy snapshot includes the target policy type, target parameter rules, and target action direction. Different policy types correspond to different parameter rules and action directions. The traffic switching module is used to match the traffic to be controlled with the target parameter rule. If the match is successful, the traffic to be controlled is switched according to the target action direction. If the match fails, the traffic to be controlled is forwarded to the old service cluster.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the traffic switching method according to any one of claims 1 to 12.
15. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the traffic switching method according to any one of claims 1 to 12 are performed.
Citation Information
Patent Citations
Realization method and device for data source switching
CN107862006A
Flow switching method and device and storage medium
CN114465960A
Service flow cutting method and device, computer equipment and storage medium
CN116233254A
Traffic scheduling method and apparatus
WO2024125022A1