Routing and forwarding methods, devices, equipment, and storage media

By obtaining available instances from the microservice management center and using a dynamic routing algorithm to detect their health status, the problem of the microservice management center being unable to identify sub-healthy states is solved, thus achieving efficient routing and forwarding.

CN119629107BActive Publication Date: 2026-04-03CHINA MERCHANTS BANK
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

The existing microservice management center cannot detect the sub-health status of downstream applications, which can easily cause routing overload when faced with a large number of requests from upstream applications, leading to the downtime of related instances of downstream applications.

Method used

By receiving instance transaction requests, the system obtains available instances through the microservice management center and distributes requests based on the health information of the instances using a preset dynamic routing algorithm, thereby identifying sub-healthy states and avoiding overload.

Benefits of technology

This effectively avoids the problem of sub-healthy instances experiencing excessive load under high traffic conditions, and improves routing and forwarding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119629107B_ABST
    Figure CN119629107B_ABST
Patent Text Reader

Abstract

This application discloses a routing and forwarding method, apparatus, device, and storage medium, relating to the field of network communication technology. The routing and forwarding method includes: receiving an instance transaction request; obtaining a first available instance through a microservice management center based on the instance transaction request; and distributing the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance. This application, through the above solution, can identify instances in a sub-healthy state, effectively avoiding the problem of excessive load on sub-healthy instances under high traffic conditions, thereby improving the efficiency of routing and forwarding.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communication technology, and in particular to a routing and forwarding method, apparatus, device, and storage medium. Background Technology

[0002] Currently, in distributed architectures, upstream and downstream applications often interact through a microservice management center. However, existing microservice management centers typically only detect whether downstream application instances are functioning correctly, failing to detect their suboptimal health. When faced with a large number of requests from upstream applications, this can easily lead to routing overload, causing downstream application instances to crash.

[0003] As can be seen from the above, how to perform routing and forwarding based on the instance health status of the microservice management center is an urgent problem to be solved.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of this application is to provide a routing and forwarding method, apparatus, device, and storage medium, which aims to solve the technical problem of how to perform routing and forwarding based on the instance health status of a microservice management center.

[0006] To achieve the above objectives, this application proposes a routing and forwarding method, the method comprising:

[0007] Receive instance transaction requests;

[0008] Based on the instance transaction request, obtain the first available instance through the microservice management center;

[0009] Based on a preset dynamic routing algorithm, the instance transaction request is distributed to the first available instance according to the health information of the first available instance.

[0010] In one embodiment, before the step of distributing the instance transaction request to the first available instance based on the health information of the first available instance using a preset dynamic routing algorithm, the method includes:

[0011] Confirm whether the health information contains the first health score assessment information;

[0012] When the first health score assessment information is not available, the instance transaction request is distributed to the first available instance according to the preset random balanced traffic strategy, and the instance transaction information within the preset period is obtained.

[0013] Based on a preset first health assessment algorithm, the first available instance is assessed for health according to the instance transaction information, the first health score assessment information is calculated and saved locally;

[0014] When the health score assessment information exists, the following steps are performed: Based on a preset dynamic routing algorithm, the instance transaction request is distributed to the first available instance according to the health information of the first available instance.

[0015] In one embodiment, the step of performing a health assessment on the first available instance based on the instance transaction information according to a preset first health assessment algorithm, and calculating the first health score assessment information, includes:

[0016] Based on a preset first health assessment algorithm, the first available instance is assessed for health according to the instance transaction information, and the transaction success rate factor and time consumption factor of the first available instance are calculated.

[0017] The first health score assessment information is calculated based on the transaction success rate factor and the time consumption factor.

[0018] In one embodiment, the first available instance includes a plurality of second available instances, the health information includes first health score assessment information, and the step of distributing the instance transaction request to the first available instance based on the health information of the first available instance using a preset dynamic routing algorithm includes:

[0019] Based on the first health score assessment information, and according to the preset traffic weight rules, the traffic weight information of several second available instances is calculated.

[0020] Based on the traffic weight information of the second available instance, the instance transaction request is distributed to the second available instance.

[0021] In one embodiment, the step of distributing the instance transaction request to the first available instance based on the health information of the first available instance using a preset dynamic routing algorithm further includes:

[0022] When all of the first health score assessment information are preset values, the instance transaction request is distributed to the first available instance according to the preset random balanced traffic strategy, and an instance alarm notification is sent to relevant personnel.

[0023] In one embodiment, the method further includes:

[0024] According to the preset liveness detection strategy, liveness detection is performed on faulty instances in the first available instance, and liveness detection information is recorded.

[0025] Based on the health recovery mechanism, the second health score assessment information of the faulty instance is calculated according to the detection information.

[0026] In one embodiment, the step of calculating the second health score assessment information of the faulty instance based on the health recovery mechanism and the detection information includes:

[0027] Based on the preset second health assessment algorithm, the health assessment of the faulty instance is performed according to the detection information, and the detection success rate factor and time consumption factor of the faulty instance are calculated.

[0028] The second health score assessment information is calculated based on the success rate factor and the time consumption factor of the detection.

[0029] Furthermore, to achieve the above objectives, this application also proposes a routing forwarding device, which includes:

[0030] The receiving module is used to receive instance transaction requests;

[0031] The acquisition module is used to obtain the first available instance through the microservice management center based on the instance transaction request;

[0032] The request forwarding module is used to distribute the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance.

[0033] In addition, to achieve the above objectives, this application also proposes a routing and forwarding device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the routing and forwarding method described above.

[0034] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the routing and forwarding method described above.

[0035] One or more technical solutions proposed in this application have at least the following technical effects:

[0036] The routing and forwarding method, apparatus, device, and storage medium proposed in this application specifically involve receiving an instance transaction request; obtaining a first available instance through a microservice management center based on the instance transaction request; and distributing the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance.

[0037] This application receives instance transaction requests and obtains the first available instance capable of handling the requests through the microservice management center. Then, based on a preset dynamic routing algorithm and the health information of the first available instance, it determines how to allocate the instance transaction request to the first available instance and distributes the instance transaction request to the first available instance. This enables dynamic routing and forwarding based on the health status of the instance, can identify instances in a sub-healthy state, effectively avoid the problem of excessive load on sub-healthy instances under high traffic conditions, and thus improve the efficiency of routing and forwarding. Attached Figure Description

[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a flowchart illustrating an embodiment of the routing and forwarding method of this application.

[0041] Figure 2 This is a flowchart illustrating Embodiment 2 of the routing and forwarding method of this application;

[0042] Figure 3 This is a flowchart illustrating Embodiment 3 of the routing and forwarding method of this application;

[0043] Figure 4 This is a flowchart illustrating Embodiment 4 of the routing and forwarding method of this application;

[0044] Figure 5 This is an example flowchart of a routing and forwarding method involved in an embodiment of this application;

[0045] Figure 6 This is a schematic diagram of the module structure of the routing and forwarding device according to an embodiment of this application;

[0046] Figure 7 This is a schematic diagram of the device structure of the hardware operating environment involved in the routing and forwarding method in this application embodiment.

[0047] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0048] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0049] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0050] The main solution of this application embodiment is: receiving an instance transaction request; obtaining a first available instance through the microservice management center according to the instance transaction request; and distributing the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance.

[0051] Technical terms used in this application:

[0052] Microservices Management Center: The Microservices Management Center is a centralized management platform used to manage various service instances in a microservices architecture. It provides core functionalities such as service registration and discovery, configuration management, service monitoring, and service governance, helping developers and operations personnel better understand and control the microservices architecture.

[0053] Service Instance: This refers to a specific service instance, typically a running microservice process. Each service instance has its own network address (e.g., IP address and port number) and provides specific business functionalities.

[0054] Node: A node typically refers to the physical or virtual machine where an application or service resides. In a microservices architecture, a single node can run multiple service instances or only one service instance.

[0055] Currently, in distributed architectures, upstream and downstream applications often interact through a microservice management center. However, existing microservice management centers typically only detect whether downstream application instances are operational, failing to detect their sub-optimal health. For example, when downstream application instances experience network congestion due to underlying hardware or geographical limitations, their health may appear as if all instances are available, but some experience longer latency than others. However, when faced with a large number of requests from upstream applications, relying on random load balancing for request forwarding can easily lead to routing overload, causing some downstream application instances to crash.

[0056] As can be seen from the above, how to perform routing and forwarding based on the instance health status of the microservice management center is an urgent problem to be solved.

[0057] This application provides a solution that receives instance transaction requests and obtains the first available instance capable of handling the requests through the microservice management center. Then, based on a preset dynamic routing algorithm and the health information of the first available instance, it determines how to allocate the instance transaction request to the first available instance and distributes the instance transaction request to the first available instance. This enables dynamic routing based on the health status of the instance, can identify instances in a sub-healthy state, effectively avoids the problem of excessive load on sub-healthy instances under high traffic conditions, and thus improves the efficiency of routing.

[0058] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or a routing and forwarding device capable of performing the above functions. The following description uses a routing and forwarding device as an example to illustrate this embodiment and the subsequent embodiments.

[0059] Based on this, embodiments of this application provide a routing and forwarding method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the routing and forwarding method of this application.

[0060] In this embodiment, the routing and forwarding method includes steps S110 to S130:

[0061] Step S110: Receive instance transaction request;

[0062] Specifically, the routing and forwarding device first needs to receive external instance transaction requests, understand the request type, request path, request parameters, and requested service information contained in the instance transaction request, so that it can subsequently obtain the instance that can be used to process the instance transaction request and forward the instance transaction request to the available instance.

[0063] Instance transaction requests refer to business requests received from external clients via upstream applications. These requests typically need to be distributed to the relevant instances of downstream applications through the microservice management center. Upstream applications are those at the front of the request chain, usually responsible for receiving business requests from external clients and forwarding them to downstream services, such as API gateways. Downstream applications need to be pre-registered with the microservice management center for easy discovery. They are also those at the back of the request chain, responsible for handling specific business logic or data processing tasks.

[0064] Step S120: Based on the instance transaction request, obtain the first available instance through the microservice management center;

[0065] Specifically, the routing and forwarding device parses the aforementioned instance transaction request. Based on the request content of the instance transaction request, including but not limited to the request path, request parameters, request header information, and request service information, the microservice management center identifies the first available instance that can handle the current instance transaction request from the registered service instances. Specifically, it can match and search among the registered service instances based on the request path and request parameters, or match and search based on the request service information and the service instance information obtained by parsing the service instance name, thereby identifying the first available instance.

[0066] For example, if an external instance transaction request needs to obtain order user information, the routing and forwarding device resolves the service instance name and finds a service instance that can run normally and obtain order user information in the service instance registry in the microservice management center. This service instance is then used as the first available instance to process the transaction request.

[0067] It should be understood that in this application, in actual network communication scenarios, there may be several external business requests initiated by the client, i.e., instance transaction requests. Instance transaction requests for the same requirement may have a first available instance to provide the corresponding service.

[0068] Step S130: Based on a preset dynamic routing algorithm, the instance transaction request is distributed to the first available instance according to the health information of the first available instance.

[0069] It should be noted that the preset dynamic routing algorithm refers to a routing and forwarding algorithm designed by relevant personnel based on actual routing and forwarding needs. This algorithm can dynamically adjust the request distribution strategy according to the health status of the first available instance, identify the sub-health status of the first available instance, and thus avoid routing overload. The sub-health status of an instance is usually caused by network communication problems, hardware failures, software configuration issues, dependent services, or sudden surges in traffic. The sub-health status of an instance is related to metrics such as response time, error rate, resource utilization, throughput, cache hit rate, network performance, and the number of inter-service calls. In this embodiment, the preset dynamic routing algorithm can be a shortest path algorithm based on node distance (e.g., Dixtra algorithm, Bellman-Ford algorithm), an optimal path algorithm based on link state (e.g., minimum latency algorithm, minimum hop count algorithm), a round-robin routing algorithm, or a random routing algorithm.

[0070] In this embodiment, the routing and forwarding device parses the health information of the first available instance using a preset dynamic routing algorithm to confirm the health status of the first available instance. When there are multiple available instances among the first available instances, the routing and forwarding device performs a health status rating on each available instance based on its health status. Based on this rating, the traffic for requests to be forwarded is reallocated, thereby achieving dynamic routing and forwarding based on the health information of available instances. This effectively avoids the problem of overload on sub-healthy instances under high traffic conditions, thus improving the efficiency of routing and forwarding. Here, the traffic for requests to be forwarded refers to the amount of requests received within a certain period.

[0071] Understandably, in order to ensure the security of data interaction, the routing and forwarding device needs to perform security authentication and authorization operations on the instance transaction request before forwarding it, to ensure that the instance transaction request comes from a legitimate client with the right to access the corresponding service instance.

[0072] Furthermore, considering the possibility of newly added service instances, which may lack health information due to their new registration in the microservice management center, steps A01 to A04 can be included before step S130 to maximize service instance utilization and improve routing efficiency.

[0073] Step A01: Confirm whether the health information contains the first health score assessment information;

[0074] Step A02: When the first health score assessment information does not exist, the instance transaction request is distributed to the first available instance according to the preset random balanced traffic strategy, and the instance transaction information within the preset period is obtained.

[0075] Step A03: Based on the preset first health assessment algorithm, perform a health assessment on the first available instance according to the instance transaction information, calculate the first health score assessment information, and save it locally;

[0076] It should be noted that the preset random traffic balancing strategy is a traffic allocation strategy pre-configured by operations personnel. It is used to randomly distribute instance transaction requests when no health assessment information for available instances is available. The preset random traffic balancing strategy can be a uniform random traffic allocation strategy or a weighted random traffic allocation strategy based on instance load. The preset first health assessment algorithm is an algorithm pre-configured by operations personnel based on actual routing and forwarding needs to assess the health status of the first available instance. It can be a health assessment algorithm based on monitoring indicator thresholds or a predictive assessment algorithm based on machine learning.

[0077] Specifically, the routing and forwarding device first needs to confirm whether there is a first health score assessment information for the first available instance based on the health information of the first available instance. If there is no first health score assessment information for the first available instance, the device needs to process the forwarding of instance transaction requests according to the preset random balanced traffic strategy, and then re-evaluate the health of the first available instance to obtain the health score assessment information of the first available instance.

[0078] Furthermore, the routing and forwarding device needs to collect instance transaction information within a preset period, that is, the forwarding information of instance transaction requests within a certain period of time, including but not limited to the response time of available instances to instance transaction requests, the number of successful transactions, the processing time, and the IP address of the available instance processing the instance transaction request. The preset period is a time duration pre-set by operations and maintenance personnel based on actual routing and forwarding needs and experience. The instance transaction information within the preset period is used to assess the health status of service instances in real time.

[0079] Then, based on the collected instance transaction information, a preset first health assessment algorithm is used to assess the health status of multiple available instances in the first available instance set. The first health score assessment information for the first available instance is calculated based on indicators such as instance response time, error rate, resource utilization, throughput, cache hit rate, network performance, and inter-service call count. To ensure the reusability of instance health data, the instance health data is stored locally. Understandably, if no instance transaction information exists within a preset period, and the routing and forwarding device cannot perceive the health status of the first available instance in real time, the health score assessment information from the locally cached instance health data can be used.

[0080] Step A04: When the health score assessment information exists, execute the following steps: Based on a preset dynamic routing algorithm, distribute the instance transaction request to the first available instance according to the health information of the first available instance.

[0081] Understandably, when the local cached instance health data contains the first health score assessment information of the first available instance, the routing and forwarding device can directly utilize the health score assessment information of the first available instance to redistribute the traffic of the request to be forwarded through a preset dynamic routing algorithm, thereby achieving dynamic routing and forwarding based on the health information of the available instance.

[0082] This embodiment provides a routing and forwarding method, which involves receiving an instance transaction request; obtaining a first available instance through a microservice management center based on the instance transaction request; and distributing the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance.

[0083] This application receives instance transaction requests and obtains the first available instance capable of handling the requests through the microservice management center. Then, based on a preset dynamic routing algorithm and the health information of the first available instance, it determines how to allocate the instance transaction request to the first available instance and distributes the instance transaction request to the first available instance. This enables dynamic routing and forwarding based on the health status of the instance, can identify instances in a sub-healthy state, effectively avoid the problem of excessive load on sub-healthy instances under high traffic conditions, and thus improve the efficiency of routing and forwarding.

[0084] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 The steps include: based on a preset first health assessment algorithm, performing a health assessment on the first available instance according to the instance transaction information, and calculating the first health score assessment information; and further including steps S210 to S220:

[0085] Step S210: Based on the preset first health assessment algorithm, perform a health assessment on the first available instance according to the instance transaction information, and calculate the transaction success rate factor and time consumption factor of the first available instance.

[0086] Step S220: Calculate the first health score assessment information based on the transaction success rate factor and the time consumption factor.

[0087] In this embodiment, the preset first health assessment algorithm refers to an algorithm that assesses the health status of the first available instance based on the success rate and response time of the first available instance in processing instance transaction requests. The instance transaction information is preferably instance transaction information within 1 minute.

[0088] Specifically, the routing and forwarding device first collects information from the instance transaction information, such as the response time of available instances to instance transaction requests, the number of successful transactions, and the total number of transactions. It then confirms the number of transactions that have not timed out within one minute according to a preset response timeout. Finally, it calculates the health score of the first available instance based on a preset first health assessment algorithm, as follows:

[0089] Success rate factor = Number of successful trades / Total number of trades

[0090] Transaction timeout factor = Number of transactions that did not time out / Total number of transactions

[0091] The transaction success rate factor and transaction time factor of the first available instance are calculated using the above formulas. Then, the health score of each instance in the first available instance is calculated using the following formula, which is the first health score assessment information:

[0092] Health Score = ((Transaction Success Rate Factor + Transaction Time Factor) / 2) × 100

[0093] It should be understood that when the instance transaction information is within 1 minute, the health score assessment information representing the first available instance needs to be recalculated and updated every minute by the preset first health assessment algorithm.

[0094] This embodiment provides a routing and forwarding method, which involves receiving an instance transaction request; obtaining a first available instance through a microservice management center based on the instance transaction request; confirming whether a first health score assessment information exists in the health information; when the first health score assessment information does not exist, distributing the instance transaction request to the first available instance according to a preset random balanced traffic strategy, and obtaining instance transaction information within a preset period; performing a health assessment on the first available instance based on a preset first health assessment algorithm and the instance transaction information, calculating the first health score assessment information, and saving it locally; when the health score assessment information exists, executing the step: distributing the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance.

[0095] This embodiment, through the above-described scheme, ensures that even when the routing and forwarding device cannot perceive the health status information of the first available instance in real time, it can still forward requests using a preset random balanced traffic strategy and update the health score assessment information of the currently available instance by confirming whether health score assessment information exists in the health information of the first available instance. Furthermore, when health score assessment information exists in the health information of the first available instance, a preset dynamic routing algorithm can determine how to allocate instance transaction requests to the first available instance based on the health score assessment information, and distribute the instance transaction requests to the first available instance. This enables dynamic routing and forwarding based on the health status of instances, identifies instances in a sub-healthy state, effectively avoids the problem of excessive load on sub-healthy instances under high traffic conditions, and thus improves the efficiency of routing and forwarding.

[0096] Based on the first and / or second embodiments of this application, in the third embodiment of this application, the content that is the same as or similar to the first and / or second embodiments described above can be referred to the above description and will not be repeated hereafter. Furthermore, the first available instance includes several second available instances, and the health information includes first health score assessment information, please refer to... Figure 3 Step S130 includes steps S310 to S320:

[0097] Step S310: Based on the first health score assessment information, and according to the preset traffic weight rules, calculate the traffic weight information of several second available instances;

[0098] Step S320: Distribute the instance transaction request to the second available instance according to the traffic weight information of the second available instance.

[0099] It should be noted that the preset traffic weighting rules are used to calculate the traffic allocation weight for instance transaction requests.

[0100] In this embodiment, the first available instance includes several second available instances. Based on the aforementioned first health score assessment information, the health score of each second available instance is further obtained. Then, the traffic allocation weight of each second available instance is calculated according to the following traffic weighting rules:

[0101] Traffic weight = 100% × (Second Availability Instance Health Score) / Sum of Health Score of All Second Availability Instances

[0102] Then, based on the calculated traffic allocation weight, the traffic of the instance transaction requests to be forwarded is dynamically forwarded according to the traffic allocation weight. This enables dynamic routing and forwarding based on the instance health status in the microservice management center, allowing healthy instances to bear most of the traffic. This avoids the problem of sub-healthy instances being overloaded under high traffic conditions, which would lead to long processing times and low success rates for instance transaction requests.

[0103] Furthermore, in order to enable health status monitoring and early warning for the first available instance, step S130 further includes step B01:

[0104] Step B01: When all the first health score assessment information is a preset value, the instance transaction request is distributed to the first available instance according to the preset random balanced traffic strategy, and an instance alarm notification is sent to relevant personnel.

[0105] It should be noted that the preset value is an experience value of health score obtained by the operation and maintenance personnel based on the operation and maintenance status of the instance. It is used to determine whether the health status of the currently available instance is unhealthy, that is, in an unresponsive state or in a state of continuous error response.

[0106] In this embodiment, the preset value is preferably 0. When the routing and forwarding device confirms that the health score of all second available instances in the first available instance is 0, that is, when the first health score evaluation information is all the preset value, it needs to process the forwarding of instance transaction requests according to the pre-set random balanced traffic strategy, distribute the instance transaction requests evenly to all second available instances in the first available instance, and at the same time, it needs to alert relevant personnel that the first available instance is in an unhealthy state so that relevant personnel can handle the service instance according to the instance alarm notification.

[0107] This embodiment uses the above scheme to calculate the traffic weight information of several second available instances based on the first health score assessment information and according to the preset traffic weight rules. Then, based on the traffic weight information, the traffic of the request to be forwarded is redistributed, and the instance transaction request is distributed to the second available instance. This achieves dynamic routing and forwarding based on the instance health status of the microservice management center, so that instances in a healthy state bear most of the traffic, thereby avoiding the problem of overload on unhealthy instances under high traffic conditions, which would lead to long processing time and low success rate of instance transaction requests.

[0108] Based on the third embodiment of this application, in the fourth embodiment of this application, the content that is the same as or similar to that in the third embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 4 Following step S130, steps S410 to S420 are also included:

[0109] Step S410: According to the preset liveness detection strategy, perform liveness detection on the faulty instances in the first available instances and record the liveness detection information;

[0110] Step S420: Based on the health recovery mechanism, calculate the second health score assessment information of the fault instance according to the detection information.

[0111] It is understandable that some service instances may have failed, with a health score of 0. These service instances do not receive traffic allocation, meaning no requests are distributed to them, causing the routing and forwarding devices to be unable to perceive the health status of these service instances in real time. In order to maximize the utilization of service instances, improve the efficiency of routing and forwarding, and ensure the accuracy and reliability of routing and forwarding, this application proposes an instance health recovery mechanism based on a liveness detection strategy.

[0112] It should be noted that the preset liveness detection strategy refers to a fault instance handling mechanism pre-configured by operations and maintenance personnel based on actual routing and forwarding needs. This mechanism attempts to confirm the working status of a faulty instance after it is detected by the routing and forwarding device. This can be a strategy of scheduled liveness detection, limiting the number of liveness detections, or detecting liveness within a fixed time period. The health recovery mechanism, on the other hand, refers to the mechanism by which the routing and forwarding device, after recovering a faulty instance, reassesses whether the instance has truly recovered to health based on the liveness detection information. The health recovery mechanism is used to identify truly recovered instances from the faulty instances and enable these instances to re-participate in the processing of instance transaction requests.

[0113] In this embodiment, the preset liveness detection strategy is to perform a timed liveness detection strategy on faulty instances at 10-second intervals.

[0114] Specifically, after the routing and forwarding device detects a faulty instance, it first needs to automatically restart or retry the faulty instance. Then, every 10 seconds, it performs a liveness check on the faulty instance among the first available instances. This involves forwarding a preset number of instance transaction requests to the faulty instance to confirm whether it can return correct response information and collecting liveness check information, including but not limited to the faulty instance's response time to instance transaction requests, the total number of liveness checks, the faulty instance's IP address, and the number of successful liveness checks. The preset number is pre-set by operations and maintenance personnel based on experience and can be customized.

[0115] Then, the routing and forwarding device uses the health recovery mechanism and the collected liveness detection information to confirm the instance's response time, error rate, resource utilization, throughput, cache hit rate, network performance, and number of inter-service calls, thereby calculating the second health score assessment information of the faulty instance.

[0116] In one embodiment, step 420 includes steps C01 to C02:

[0117] Step C01: Based on the preset second health assessment algorithm, perform a health assessment on the faulty instance according to the liveness detection information, and calculate the liveness detection success rate factor and the time consumption factor of the faulty instance.

[0118] Step C02: Calculate the second health score assessment information based on the success rate factor and time consumption factor for the detection of life.

[0119] In this embodiment, the health recovery mechanism includes a preset second health assessment algorithm, which is an algorithm that assesses the health status of a faulty instance based on the success rate and response time of the faulty instance's transaction requests.

[0120] Specifically, the routing and forwarding device first collects information such as the response time of the faulty instance to the instance transaction request, the number of successful activation attempts, and the total number of activation attempts from the activation detection information. It then confirms the number of activation attempts that did not time out within one minute according to the preset response timeout. Finally, it calculates the health score of the faulty instance based on the preset second health assessment algorithm, as follows:

[0121] Active user search success rate factor = Number of successful active user searches / Total number of active user searches

[0122] Detection time factor = Number of detection entries that did not time out / Total number of detection entries

[0123] The above formulas are used to calculate the liveness detection success rate factor and liveness detection time factor of the faulty instance. Then, the health score of each instance in the faulty instance is calculated using the following formula, which is the second health score assessment information:

[0124] Health Score = ((Vital Detection Success Rate Factor + Vital Detection Time Factor) / 2) × 70

[0125] It should be understood that even if a faulty instance is successfully revived, limiting the maximum health score of the faulty instance allows for a more robust and gradual recovery of the instance's health status, thereby ensuring the stability and reliability of routing and forwarding devices.

[0126] Meanwhile, when the activity detection information is instance transaction information within 1 minute, the health score assessment information representing the faulty instance needs to be recalculated and updated every minute by the preset second health assessment algorithm.

[0127] This embodiment provides a routing and forwarding method, which involves receiving an instance transaction request; obtaining a first available instance through a microservice management center based on the instance transaction request; distributing the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance; performing a liveness detection on faulty instances in the first available instance according to a preset liveness detection strategy and recording the liveness detection information; and calculating a second health score assessment information of the faulty instance based on the liveness detection information using a health recovery mechanism.

[0128] This embodiment, through the above scheme and health recovery mechanism, firstly, according to the preset detection strategy, detects the failure instances in the first available instances and records the detection information; then, based on the detection information, it calculates the second health score assessment information of the failure instances, thereby enabling the routing and forwarding device to perceive the health status of failure instances, and through this health recovery mechanism, the failure instances can be re-identified as available instances, which can ensure the maximum utilization of service instances and improve the efficiency of routing and forwarding.

[0129] For example, to aid in understanding this application, please refer to the implementation flow of the routing and forwarding method obtained in conjunction with the above-described embodiment four. Figure 5 , Figure 5 A sample flowchart of a routing and forwarding method is provided, specifically:

[0130] exist Figure 5 In this process, the application corresponding to the routing forwarding method first starts. Upon receiving an instance transaction request, it obtains the address of an available instance through the microservice center and queries the local cache for the health status of the available instance, i.e., the health information of the first available instance. The health information of the first available instance typically includes health score assessment information for multiple service instances, i.e., the service instance and its corresponding health score.

[0131] Then, the routing and forwarding device re-evaluates the traffic weight of service instances based on the health score assessment information of multiple service instances using the dynamic routing algorithm, and allocates traffic according to the calculated traffic weight. That is, it allocates the instance transaction requests to be forwarded according to the traffic weight, and distributes the allocated instance transaction requests to the corresponding service instances, thereby realizing the forwarding processing of instance transaction requests.

[0132] When the health score of all service instances is 0, the instance transaction requests need to be processed according to the random balanced traffic strategy, i.e., balanced routing and forwarding, and the relevant person in charge needs to be notified of the current health status of the instances.

[0133] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the routing and forwarding method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0134] This application also provides a routing and forwarding device; please refer to... Figure 6 The routing and forwarding device includes:

[0135] Receiver module 10 is used to receive instance transaction requests;

[0136] The acquisition module 20 is used to obtain the first available instance through the microservice management center based on the instance transaction request;

[0137] The request forwarding module 30 is used to distribute the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance.

[0138] The routing and forwarding apparatus provided in this application, employing the routing and forwarding method in the above embodiments, can solve the technical problem of how to perform routing and forwarding based on the instance health status of the microservice management center. Compared with the prior art, the beneficial effects of the routing and forwarding apparatus provided in this application are the same as those of the routing and forwarding method provided in the above embodiments, and other technical features in the routing and forwarding apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0139] This application provides a routing and forwarding device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the routing and forwarding method in the above embodiment.

[0140] The following is for reference. Figure 7The diagram illustrates a structural schematic of a routing and forwarding device suitable for implementing embodiments of this application. The routing and forwarding device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The routing and forwarding device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0141] like Figure 7 As shown, the routing and forwarding device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the routing and forwarding device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the routing and forwarding device to communicate wirelessly or wiredly with other devices to exchange data. Although routing and forwarding devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0142] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0143] The routing and forwarding device provided in this application, employing the routing and forwarding method in the above embodiments, can solve the technical problem of how to perform routing and forwarding based on the instance health status of the microservice management center. Compared with the prior art, the beneficial effects of the routing and forwarding device provided in this application are the same as those of the routing and forwarding method provided in the above embodiments, and other technical features of the routing and forwarding device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0144] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0145] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0146] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the routing and forwarding method in the above embodiments.

[0147] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0148] The aforementioned computer-readable storage medium may be included in the routing and forwarding device; or it may exist independently and not be assembled into the routing and forwarding device.

[0149] The aforementioned computer-readable storage medium carries one or more programs. When the aforementioned one or more programs are executed by the routing and forwarding device, the routing and forwarding device: receives an instance transaction request; obtains a first available instance through the microservice management center according to the instance transaction request; and distributes the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance.

[0150] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0151] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0152] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0153] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described routing and forwarding method, which can solve the technical problem of how to perform routing and forwarding based on the instance health status of the microservice management center. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the routing and forwarding method provided in the above embodiments, and will not be repeated here.

[0154] This application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the routing and forwarding method described above.

[0155] The computer program product provided in this application can solve the technical problem of how to perform routing and forwarding based on the instance health status of the microservice management center. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the routing and forwarding methods provided in the above embodiments, and will not be repeated here.

[0156] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent scope of this application.

Claims

1. A routing and forwarding method, characterized in that, The method includes: Receive instance transaction requests; Based on the instance transaction request, obtain the first available instance through the microservice management center; Based on a preset dynamic routing algorithm, the instance transaction request is distributed to the first available instance according to the health information of the first available instance; The health information includes a first health score assessment information, which is obtained by calculating the health assessment of the first available instance based on a preset first health assessment algorithm and the instance transaction information within a preset period. The step of performing a health assessment on the first available instance based on a preset first health assessment algorithm and instance transaction information within a preset period, and calculating the first health score assessment information, specifically includes: Based on the preset first health assessment algorithm, the first available instance is assessed for health according to the instance transaction information within the preset period, and the transaction success rate factor and the transaction time factor of the first available instance are calculated. The transaction success rate factor = number of successful transactions / total number of transactions, and the transaction time factor = number of transactions that do not time out / total number of transactions. Based on the transaction success rate factor and the time consumption factor, the first health score assessment information is calculated. The first available instance includes several second available instances, and the first health score assessment information includes the health score values ​​of several second available instances. The calculation rule for the health score is: Health Score = ((Transaction Success Rate Factor + Transaction Time Consumption Factor) / 2) × 100; The step of distributing the instance transaction request to the first available instance based on the health information of the first available instance using a preset dynamic routing algorithm includes: Based on the first health score assessment information, and according to the preset traffic weight rules, the traffic weight information of several second available instances is calculated. The preset traffic weight rules are: Traffic weight = 100% × (Second available instance health score / sum of health scores of all second available instances). Based on the traffic weight information of the second available instance, the instance transaction request is distributed to the second available instance.

2. The method as described in claim 1, characterized in that, Before the step of distributing the instance transaction request to the first available instance based on the health information of the first available instance using a preset dynamic routing algorithm, the following steps are included: Confirm whether the health information contains the first health score assessment information; When the first health score assessment information is not available, the instance transaction request is distributed to the first available instance according to the preset random balanced traffic strategy, and the instance transaction information within the preset period is obtained. Based on a preset first health assessment algorithm, the first available instance is assessed for health according to the instance transaction information, the first health score assessment information is calculated and saved locally; When the health score assessment information exists, the following steps are performed: Based on a preset dynamic routing algorithm, the instance transaction request is distributed to the first available instance according to the health information of the first available instance.

3. The method as described in claim 1, characterized in that, The step of distributing the instance transaction request to the first available instance based on the health information of the first available instance using a preset dynamic routing algorithm further includes: When all of the first health score assessment information are preset values, the instance transaction request is distributed to the first available instance according to the preset random balanced traffic strategy, and an instance alarm notification is sent to relevant personnel.

4. The method as described in claim 1, characterized in that, The method further includes: According to the preset liveness detection strategy, liveness detection is performed on faulty instances in the first available instance, and liveness detection information is recorded. Based on the health recovery mechanism, the second health score assessment information of the faulty instance is calculated according to the detection information.

5. The method as described in claim 4, characterized in that, The step of calculating the second health score assessment information of the faulty instance based on the health recovery mechanism and the detection information includes: Based on the preset second health assessment algorithm, the health assessment of the faulty instance is performed according to the detection information, and the detection success rate factor and time consumption factor of the faulty instance are calculated. The second health score assessment information is calculated based on the success rate factor and the time consumption factor of the detection.

6. A routing and forwarding device, characterized in that, The routing and forwarding device includes: The receiving module is used to receive instance transaction requests; The acquisition module is used to obtain the first available instance through the microservice management center based on the instance transaction request; The request forwarding module is used to distribute the instance transaction request to the first available instance based on a preset dynamic routing algorithm and the health information of the first available instance. The health information includes first health score assessment information, which is obtained by calculating the health of the first available instance based on the instance transaction information within a preset period using a preset first health assessment algorithm. The step of performing a health assessment on the first available instance based on the instance transaction information according to a preset first health assessment algorithm, and calculating the first health score assessment information, includes: Based on a preset first health assessment algorithm, a health assessment is performed on the first available instance according to the instance transaction information, and the transaction success rate factor and transaction time factor of the first available instance are calculated, wherein the transaction success rate factor = number of successful transactions / total number of transactions, and the transaction time factor = number of transactions that did not time out / total number of transactions; based on the transaction success rate factor and transaction time factor, the first health score assessment information is calculated, the first available instance includes several second available instances, and the first health score assessment information includes the health score values ​​of several second available instances; wherein the calculation rule for the health score is: health score = ((transaction success rate factor + transaction time factor) / 2) × 100; The request forwarding module is further configured to calculate the traffic weight information of several second available instances based on the first health score assessment information and according to a preset traffic weight rule, wherein the preset traffic weight rule is: traffic weight = 100% × (health score of second available instance / sum of health scores of all second available instances); and distribute the instance transaction request to the second available instance according to the traffic weight information of the second available instance.

7. A routing and forwarding device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the routing and forwarding method as described in any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the routing and forwarding method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Service instance scheduling method and device, electronic equipment and storage medium

    CN117914948A