Flow management method and device
By calculating the resource contribution degree of each function of the microservice node and performing current limit processing, the resource waste or insufficient caused by inaccurate current limit in the prior art is solved, and more efficient resource utilization is achieved.
Patent Information
- Application Number
- CN202311059243.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-02-28
AI Technical Summary
When the prior art restricts the current flow of microservice nodes, it lacks accuracy and is prone to waste or insufficient resources.
By obtaining the operating parameters of the microservice node, the resource contribution of each function is calculated, and the objective function to be restricted is determined based on this to be restricted for current processing.
Improve the accuracy of limiting the flow of microservice nodes, ensure effective utilization of resources, and avoid waste or insufficient resources.
Smart Images

Figure CN119544617A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for flow management. Background Art
[0002] Microservice architecture is an architectural style that splits a complex application into multiple independent and autonomous services, which interact with each other in a loosely coupled manner.
[0003] When a microservice is accessed by a large number of users, in order to ensure the stability of the operation of the microservice node, fuse, downgrade and current limiting are used to prevent the microservice node from increasing a large amount of access traffic in a short period of time, resulting in service quality degradation, delays, service restarts, and even downtime. Among them, the commonly used method is to limit or control the service interface of the microservice node, that is, only allow a certain number of requests to pass, and reject requests if the number exceeds.
[0004] At present, the traffic threshold of each microservice node is usually found through stress testing. Since each microservice node integrates one or more service interfaces for other applications to call, the stress testing method can only set the same traffic threshold for all service interfaces. The traffic threshold set in this way is often not accurate enough, which is prone to resource waste or insufficient resources.
[0005] Therefore, how to improve the accuracy of current limiting for microservice nodes is an urgent problem to be solved. Summary of the invention
[0006] The present specification provides a method, device, electronic device, and machine-readable storage medium for traffic management to improve the accuracy of current limiting for microservice nodes.
[0007] This manual adopts the following technical solutions:
[0008] The present specification provides a method for traffic management, which is applied to a traffic management device using a microservice architecture, wherein a microservice node includes multiple functions for providing services; the microservice architecture includes several microservice nodes, including:
[0009] Get the operating parameters of each microservice node;
[0010] In response to the acquired operating parameters of any target microservice node, determining whether the target microservice node meets the current limiting condition corresponding to the operating parameters based on the operating parameters;
[0011] If yes, calculate the resource contribution corresponding to the multiple functions respectively, where the resource contribution is used to represent the contribution of the resources consumed by the function to the service provided by the target microservice node;
[0012] Based on the resource contribution, a target function to be limited is determined from the multiple functions, and a current limiting process is performed on the target function.
[0013] Optionally, the traffic management device is a gateway device used to connect the client and the background server.
[0014] Optionally, the operating parameters include: server parameters of the server to which the microservice node belongs;
[0015] In response to the acquired operating parameters of any target microservice node, determining whether the target microservice node meets the current limiting condition corresponding to the operating parameters based on the operating parameters includes:
[0016] In response to the acquired server parameters of the server to which any target microservice node belongs, based on the server parameters, it is determined whether the target microservice node meets the current limiting condition corresponding to the server parameters.
[0017] Optionally, the current limiting conditions corresponding to the operating parameters include:
[0018] The parameter value of the operating parameter is greater than a preset threshold; and the calculated performance scores of multiple functions related to the services provided by the target microservice node are greater than the calculated resource scores of multiple functions related to the services provided by the target microservice node; wherein the performance score is used to represent the size of the performance indicator of the function; and the resource score is used to represent the size of the resources consumed by the function.
[0019] Optionally, the traffic management device maintains a mapping relationship between the preset operating parameters and performance indicators of functions related to the operating parameters;
[0020] The calculated performance scores of multiple functions related to the services provided by the microservice node include:
[0021] Determine the performance indicator of the function related to the acquired operating parameter according to the mapping relationship between the operating parameter and the performance indicator of the function related to the operating parameter, and predict the parameter value of the operating parameter after current limiting is performed on the function according to the performance indicator of the function related to the operating parameter;
[0022] The performance score of the function is calculated according to the parameter values of the operating parameters after the function is current limited.
[0023] The calculated resource scores of multiple functions related to the services provided by the target microservice node include:
[0024] A resource score of the function is calculated according to the resources consumed by limiting the flow of the function.
[0025] Optionally, the traffic management device maintains a call relationship between multiple functions related to the service provided by the microservice node; the multiple functions include: a service function, an intermediate function and an interface function, the service function is a function for providing a service call related to the service provided by the microservice node, the interface function is a function for providing a service call for the microservice node externally, and the intermediate function is a function for providing a function call for the service function to the interface function;
[0026] Calculating resource contributions corresponding to the multiple functions respectively, including:
[0027] Calculating the number of receivable call requests of the target interface function related to the operating parameter based on the operating parameter;
[0028] Based on the calling relationship, the target intermediate function and the target service function called by the target interface function are determined, and based on the number of receivable calling requests, the resource contributions corresponding to the target intermediate function and the target service function are respectively calculated.
[0029] Optionally, respectively calculating resource contributions corresponding to the target intermediate function and the target service function based on the number of the receivable call requests includes:
[0030] Resource contribution is calculated based on the following formula:
[0031]
[0032] In the formula, I k It is used to indicate the resource contribution corresponding to the kth function in the calling relationship, R(Y k ) is used to represent the service revenue obtained based on the number of response results corresponding to the call request received by the target interface function, E(C k ) is used to represent the resource cost obtained based on the resources consumed by the target service function, and k is used to represent the kth function in the calling relationship.
[0033] Optionally, before calculating the number of receivable call requests of the target interface function related to the operating parameter, the method further includes:
[0034] Determine the function properties and performance indicators of each interface function;
[0035] Calculate the weight value of each interface function according to the function attributes and performance indicators of each interface function, wherein the weight value is used to indicate the importance of the service provided by the interface function to the target microservice node;
[0036] Sorting the weight values of the interface functions, and determining the interface functions whose weight values are greater than a set threshold as core interface functions;
[0037] Calculating the number of receivable call requests of the target interface function related to the operating parameter based on the operating parameter includes:
[0038] The number of receivable call requests of the core interface function in the target interface function related to the operating parameter is calculated based on the operating parameter.
[0039] Optionally, the traffic management device maintains a preset mapping relationship between the performance indicator of the service function and the performance indicator of the interface function;
[0040] Calculating the number of receivable call requests of a core interface function in a target interface function related to the operating parameter based on the operating parameter includes:
[0041] Predicting the number of call requests of the core interface function as a first prediction value;
[0042] According to the mapping relationship between the performance index of the service function and the performance index of the interface function, converting the first prediction value into the number of call requests of the target service function having a call relationship with the core interface function for the core interface function as the second prediction value;
[0043] Determine whether the sum of the second prediction values of the core interface functions that have a calling relationship with the target service function is less than a preset number of receivable calling requests of the target service function;
[0044] If so, according to the weight value of the core interface function, the number of call requests that can be received by the target service function is allocated to the core interface function that has a call relationship with the target service function, and the number of call requests that can be received by the core interface function that has a call relationship with the target service function is calculated.
[0045] Optionally, calculating the number of receivable call requests of the core interface function that has a call relationship with the target service function includes:
[0046] The number of call requests that can be received by the core interface function that has a call relationship with the target service function is calculated based on the following formula:
[0047]
[0048] In the formula, I i Used to indicate the number of receivable call requests corresponding to the i-th core interface function, QPS max It is used to indicate the maximum number of call requests that can be received by the target service function, W i Used to represent the weight value corresponding to the i-th core interface function. It is used to represent the sum of weight values corresponding to k core interface functions, and U() is used to represent a conversion function that converts the number of receivable call requests of the target service function into the number of receivable call requests of the core interface function.
[0049] The present specification provides a traffic management device, which is applied to a traffic management device using a microservice architecture, wherein a microservice node includes multiple functions for providing services; the microservice architecture includes several microservice nodes, including:
[0050] The acquisition module is used to obtain the operating parameters of each microservice node;
[0051] A response module, configured to respond to the acquired operating parameters of any target microservice node and determine, based on the operating parameters, whether the target microservice node satisfies a current limiting condition corresponding to the operating parameters;
[0052] a calculation module, configured to, if yes, calculate resource contributions respectively corresponding to the multiple functions, wherein the resource contributions are used to represent contributions of the resources consumed by the functions to the services provided by the target microservice node;
[0053] The current limiting module is used to determine the target function to be current limited from the multiple functions based on the resource contribution, and perform current limiting processing on the target function.
[0054] This specification provides an electronic device, including a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus;
[0055] The memory stores machine-readable instructions, and the processor executes the above-mentioned traffic management method by calling the machine-readable instructions.
[0056] This specification provides a machine-readable storage medium, which stores machine-readable instructions. When the machine-readable instructions are called and executed by a processor, the above-mentioned traffic management method is implemented.
[0057] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:
[0058] In the traffic management method provided in this specification, if it is determined that the operating parameters of the target microservice node meet the current limiting conditions corresponding to the operating parameters, the traffic management device of the microservice architecture can calculate the resource contribution of multiple functions related to the services provided by the target microservice node, and the resource contribution is used to represent the contribution of the resources consumed by the function to the services provided by the target microservice node. Based on the resource contribution, the target function to be limited is determined from the multiple functions, and the target function is subjected to current limiting. This method can determine the target function to be limited from the multiple functions based on the resource contribution, thereby improving the accuracy of current limiting for the microservice node. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:
[0060] Figure 1 is a flow chart of a method for traffic management shown in an exemplary embodiment;
[0061] Figure 2 is a schematic diagram of a calling relationship between multiple functions shown in an exemplary embodiment;
[0062] Figure 3 is a schematic diagram of a current limiting process shown in an exemplary embodiment;
[0063] Figure 4 It is a structural diagram of an electronic device in which a flow management device is located, showing an exemplary embodiment;
[0064] Figure 5 It is a block diagram of a traffic management device shown in an exemplary embodiment. DETAILED DESCRIPTION
[0065] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0066] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0067] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of this specification, the relevant technologies involved in the embodiments of this specification are briefly described below.
[0068] Microservice architecture is an architectural style that splits a complex application into multiple independent and autonomous services, which interact with each other in a loosely coupled manner. One service can correspond to one microservice node.
[0069] The microservice node maintains the calling relationship between multiple functions related to the service provided by the microservice node.
[0070] In actual applications, the traffic threshold of each microservice node is usually found through stress testing. Since each microservice node integrates one or more service interfaces for other applications to call, the stress testing method can only set the same traffic threshold for all service interfaces. The traffic threshold set in this way is often not accurate enough, which is prone to resource waste or insufficient resources.
[0071] Based on this, this specification proposes a technical solution that calculates the resource contribution of multiple functions related to the services provided by the target microservice node when the operating parameters of the target microservice node meet the current limiting conditions corresponding to the operating parameters, determines the target function to be limited from multiple functions based on the resource contribution, and performs current limiting on the target function, thereby improving the accuracy of current limiting on the microservice node.
[0072] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0073] Figure 1 This is a flow chart of a method for traffic management shown in an exemplary embodiment, which specifically includes the following steps:
[0074] S100: Obtain the operating parameters of each microservice node.
[0075] In the embodiments of this specification, the execution subject of the traffic management method may be a traffic management device using a microservice architecture. The physical carrier of the traffic management device may be a server or a server cluster. The traffic management device may be a gateway device for connecting a client and a backend server. For ease of description, the traffic management method provided in this specification is described below with the traffic management device as the execution subject.
[0076] In an embodiment of the present specification, the traffic management device can obtain the operating parameters of each microservice node. The operating parameters mentioned here include: server parameters of the server to which the microservice node belongs. Server parameters may include: CPU, memory, etc. The operating parameters also include: performance indicators of the function. The performance indicators of the function may refer to service level objectives (Service Level Objectives, SLO), which provide a formal way to describe, measure and monitor the performance, quality and reliability of microservice nodes. For example, the average query rate per second (QPS, Queries per second) per minute is >100k / s. For another example, the response time (response time, RT) of 99% of the call requests is <500ms. For another example, 99% of the bandwidth per minute is >200MB / s, etc.
[0077] It should be noted that the traffic management device also needs to obtain the number of other microservice nodes or middleware called by the function, which is included in the performance indicator of the function. For example, the call request data in QPS includes the number of other microservice nodes or middleware called by the function.
[0078] S102: In response to the acquired operating parameters of any target microservice node, determine whether the target microservice node meets the current limiting condition corresponding to the operating parameters based on the operating parameters.
[0079] In the embodiment of the present specification, in response to the acquired operating parameters of any target microservice node, it is determined based on the operating parameters whether the target microservice node meets the current limiting condition corresponding to the operating parameters.
[0080] Specifically, if the operating parameter is determined to be a server parameter of a server to which the microservice node belongs, in response to the acquired server parameter of a server to which any target microservice node belongs, based on the server parameter, it is determined whether the target microservice node satisfies the current limiting condition corresponding to the server parameter. When it is determined that the target microservice node satisfies the current limiting condition corresponding to the server parameter, a function related to the server parameter is determined from the functions to be used for subsequently determining the target function to be current limited.
[0081] If the operating parameter is determined to be a function's performance indicator, in response to the obtained performance indicator of the function in any target microservice node, based on the function's performance indicator, determine whether the target microservice node meets the current limiting condition corresponding to the function's performance indicator. When it is determined that the target microservice node meets the current limiting condition corresponding to the function's performance indicator, determine the type of resources consumed by the function, and determine whether resource contention occurs based on other functions that consume the same type of resources as the function. The resource contention mentioned here may refer to multiple functions consuming the same resource at the same time, resulting in a decrease in the performance indicators of these multiple functions, which is used to subsequently determine which functions are subject to current limiting.
[0082] In actual applications, after determining that the parameter value of the operating parameter is greater than the set threshold corresponding to the operating parameter, it is also necessary to determine whether the benefits brought by the improved performance indicators of the function are greater than the resources consumed by limiting the flow of the function, so as to determine whether to limit the flow of the function.
[0083] Based on this, the traffic management device can predict the performance indicators after the function is limited, calculate the performance score, and predict the resources required to limit the function, calculate the resource score, and determine whether to limit the function based on the performance score and resource score.
[0084] In the embodiment of the present specification, the current limiting condition corresponding to the operating parameter includes: the parameter value of the operating parameter is greater than a preset threshold. And the calculated performance scores of multiple functions related to the services provided by the target microservice node are greater than the calculated resource scores of multiple functions related to the services provided by the target microservice node. Among them, the performance score mentioned here is used to indicate the size of the performance index of the function. The resource score mentioned here is used to indicate the size of the resources consumed by the function.
[0085] Furthermore, the traffic management device maintains a mapping relationship between the preset operating parameters and the performance indicators of the functions related to the operating parameters. The traffic management device can determine the performance indicators of the functions related to the acquired operating parameters based on the mapping relationship between the operating parameters and the performance indicators of the functions related to the operating parameters, and predict the parameter values of the performance indicators after the function is limited based on the performance indicators of the functions related to the operating parameters.
[0086] Among them, the mapping relationship between the preset operating parameters and the performance indicators of the functions related to the operating parameters can be used to indicate which functions' performance indicators will be affected by the operating parameters when the parameter value of the operating parameters is greater than the preset threshold, and which operating parameters will affect the function when the performance indicators of the functions decrease.
[0087] Then, the traffic management device can calculate the performance score of the function based on the parameter value of the performance indicator after the function is limited. For example, the performance indicator of the function after the function is limited is the response time of 99% of the call requests. The smaller the parameter value of the performance indicator, the greater the performance score of the function. This specification does not limit the calculation formula for calculating the performance score of the function.
[0088] Next, the traffic management device can calculate the resource score of the function based on the resources consumed by limiting the flow of the function. The resources mentioned here can refer to CPU, memory, etc. For example, the resource type consumed by limiting the flow of the function is CPU. When the CPU usage rate is higher, the resource score of the function is lower.
[0089] The traffic management device may also calculate the resource score of the function based on the number of response results after the call request is processed without limiting the flow of the function. For example, if the function is not limited, the greater the number of response results after the call request is processed, the greater the resource score of the function.
[0090] Furthermore, the traffic management device can determine the resource score of the function based on the resources consumed by limiting the flow of the function and the number of response results after the call request is processed without limiting the flow of the function. This specification does not limit the calculation formula for calculating the resource score of the function.
[0091] S104: If yes, calculate the resource contribution corresponding to the multiple functions respectively, where the resource contribution is used to represent the contribution of the resources consumed by the function to the service provided by the target microservice node.
[0092] S106: Determine a target function to be limited from the multiple functions based on the resource contribution, and perform a current limiting process on the target function.
[0093] In an embodiment of the present specification, if it is determined that the target microservice node meets the flow limiting conditions corresponding to the operating parameters, the traffic management device can calculate the resource contribution corresponding to multiple functions respectively. The resource contribution mentioned here is used to indicate the contribution of the resources consumed by the function to the services provided by the target microservice node.
[0094] Then, the traffic management device may determine the target function to be limited from the multiple functions based on the resource contribution, and perform a flow limiting process on the target function.
[0095] Among them, the traffic management device maintains the calling relationship between multiple functions related to the service provided by the microservice node. The multiple functions mentioned here include: service functions, intermediate functions and interface functions. The service function is a function used to provide service calls related to the services provided by the microservice node. The interface function is a function that provides service calls to the microservice node to the outside. The intermediate function is a function that provides function calls to the service function for the interface function. Specifically, Figure 2 shown.
[0096] Figure 2 It is a schematic diagram of a calling relationship between multiple functions shown in an exemplary embodiment.
[0097] exist Figure 2 In the example, an interface function can call multiple intermediate functions, and an intermediate function can call multiple service functions. The service function can consume the resources of the server to which the microservice node belongs to provide service calls related to the services provided by the microservice node. Of course, the service function can also call other microservice nodes or call middleware through the RPC call method. In addition, a tree-like call graph can be constructed based on the call relationship between multiple functions, and the function level of each function can be determined based on the call sequence from the service function to the interface function. The service function can be the 0th layer.
[0098] It should be noted that there may be no intermediate function in the calling relationship between multiple functions related to the services provided by a microservice node, and the interface function can directly call the service function. Of course, there may also be multiple intermediate functions in the calling relationship between multiple functions. In addition, there may be only one function related to the service provided by a microservice node, so the function can be regarded as both a service function and an interface function.
[0099] In actual applications, there is no direct mapping relationship between interface functions and operating parameters. When the operating parameters are greater than the set threshold, the traffic management system cannot determine which interface functions' performance indicators will decline. Based on this, the traffic management device maintains the mapping relationship between the operating parameters and the response time of the service function, the mapping relationship between the degree of change of the performance indicators of the service function and the degree of change of the performance indicators of the interface function, and the calling relationship between the service function and the interface function, and determines the mapping relationship between the operating parameters and the performance indicators of the interface functions related to the operating parameters based on the mapping relationship between the operating parameters and the response time of the service function, the mapping relationship between the degree of change of the performance indicators of the service function and the degree of change of the performance indicators of the interface function, and the calling relationship between the service function and the interface function.
[0100] In the embodiment of the present specification, the traffic management device may calculate the number of receivable call requests of the target interface function related to the operating parameters based on the operating parameters.
[0101] Specifically, the traffic management device may determine the performance indicator of the interface function related to the acquired operating parameters according to the mapping relationship between the operating parameters and the performance indicator of the interface function related to the operating parameters.
[0102] Then, the traffic management device can further calculate the number of receivable call requests of the target interface function related to the operating parameters according to the performance index of the interface function related to the operating parameters. Taking the performance index of the interface function as response time as an example, the specific formula is as follows:
[0103] I rt =Q*M*A rt
[0104] In the above formula, I rt It can be used to indicate the number of call requests that an interface function can receive. rt It can be used to represent the mapping relationship between operating parameters and the response time of a service function. M can be used to represent the calling relationship between a service function and an interface function. The representation can be a matrix, and an element in the M matrix can be the number of times the interface function calls the service function in a call request. Q can be used to represent the influence of the degree of change of the performance index of a service function on the degree of change of the performance index of an interface function. The representation can be a matrix, and an element in the Q matrix can be the ratio between the degree of change of the performance index of a service function and the degree of change of the performance index of an interface function. It can be seen that the above formula can be used to represent the mapping relationship between operating parameters and the response time of an interface function related to the operating parameters.
[0105] Furthermore, the mapping relationship between the operating parameters and the response time of the service function is as follows:
[0106] A rt (i) = H(R1, R2, ..., R n )
[0107] In the above formula, A rt (i) can be used to represent the i-th service function. n It can be used to represent the resources of the nth resource type. It can be seen that when the response time of the i-th service function increases, it is affected by the resources of which resource types.
[0108] In actual applications, a service function may correspond to multiple interface functions, and different interface functions have different importance to the service. However, the number of call requests that a service function can receive is limited. The traffic management device needs to determine the interface functions with higher importance from each interface function and allocate the number of acceptable call requests of the service function to the interface functions with higher importance to ensure the service quality.
[0109] In the embodiments of this specification, the function attributes and performance indicators of each interface function are determined. The function attributes mentioned here include: cyclomatic complexity, in-degree, out-degree, etc. The cyclomatic complexity mentioned here can be used to represent the number of call paths related to the interface function. The in-degree mentioned here can be used to represent the number of calls to the interface function. The out-degree mentioned here can be used to represent the number of other functions called by the interface function. The performance indicators mentioned here include: call frequency, interface success rate, etc.
[0110] Secondly, the traffic management device can calculate the weight value of each interface function based on the function attributes and performance indicators of each interface function. The weight value mentioned here is used to indicate the importance of the interface function to the service provided by the target microservice node. The specific formula is as follows:
[0111] W i =G(I i )
[0112] In the above formula, W i Used to represent the weight value of the i-th interface function. i Used to represent the function properties and performance indicators of the i-th interface function. G() can be used to represent the calculation formula for calculating the weight value. This specification does not limit the calculation formula for calculating the weight value.
[0113] Then, the traffic management device can sort the weight values of each interface function, determine the interface function with a weight value greater than a set threshold as the core interface function, and determine the interface function with a weight value not greater than the set threshold as the non-core interface function. Of course, the core interface function and the non-core interface function can also be classified by machine learning methods such as SVM or manually specified methods.
[0114] Finally, the traffic management device may calculate the number of receivable call requests of the core interface function in the target interface function related to the operating parameter based on the operating parameter.
[0115] In actual applications, since the number of call requests that a service function can receive is limited, in order to ensure the quality of service, the traffic management device can allocate the number of acceptable call requests of the service function to each interface function according to the weight value of each interface function.
[0116] In an embodiment of the present specification, the traffic management device maintains a mapping relationship between a performance indicator of a preset service function and a performance indicator of an interface function. The traffic management device can predict the number of call requests of a core interface function as a first prediction value. For example, the traffic management device can predict the number of call requests of a core interface function based on the number of call requests of the core interface function in history.
[0117] Secondly, the traffic management device can convert the first prediction value into the number of call requests for the core interface function from the target service function that has a calling relationship with the core interface function based on the mapping relationship between the performance indicators of the service function and the performance indicators of the interface function, as the second prediction value.
[0118] Then, the traffic management device may determine whether the sum of the second predicted values of the core interface functions that have a calling relationship with the target service function is less than the number of call requests that can be received by the preset target service function.
[0119] If yes, the traffic management device sets the number of receivable call requests of the non-core interface function to 0. And according to the weight value of the core interface function, the number of receivable call requests of the target service function is allocated to the core interface function that has a call relationship with the target service function, and the number of receivable call requests of the core interface function that has a call relationship with the target service function is calculated.
[0120] If not, the traffic management device sets the number of receivable call requests of the non-core interface function to 0. The specific formula is as follows:
[0121]
[0122] In the above formula, I i It is used to indicate the number of receivable call requests corresponding to the ith core interface function. It is converted into the number of call requests of the target service function that has a call relationship with the ith core interface function for the ith core interface function according to the mapping relationship between the performance indicators of the service function and the performance indicators of the interface function. max Indicates the maximum number of call requests that can be received by the target service function.
[0123] Furthermore, the number of receivable call requests of the core interface function that has a call relationship with the target service function is calculated based on the following formula:
[0124]
[0125] In the formula, I i It is used to indicate the number of receivable call requests corresponding to the i-th core interface function. maxIt is used to indicate the maximum number of call requests that can be received by the target service function. i Used to represent the weight value corresponding to the i-th core interface function. It is used to represent the sum of weight values corresponding to k core interface functions. U() is used to represent a conversion function that converts the number of receivable call requests of the target service function into the number of receivable call requests of the core interface function.
[0126] In actual applications, when limiting the flow of microservice nodes, the number of call requests that the interface function can receive is usually limited to avoid the degradation of the service quality of the microservice node. However, the service provided by the interface function to the microservice node is actually provided by the service function consuming the resources of the microservice node. Therefore, when the number of call requests that the service function can receive meets the flow limiting requirements of the microservice node, the interface function that has a call relationship with the service function will also meet the flow limiting requirements of the microservice node.
[0127] Furthermore, after determining the number of call requests that the service function can receive, current limiting can be performed on any function that has a call relationship with the service function to meet the current limiting requirements of the microservice node. However, the resources consumed by current limiting on different functions and the contribution to the services provided by the target microservice node are different.
[0128] Based on this, the traffic management device can determine the function to be limited based on calculating the resource contribution corresponding to different functions.
[0129] In an embodiment of the present specification, the traffic management device can determine the target intermediate function and target service function called by the target interface function based on the calling relationship, and calculate the resource contribution corresponding to the target intermediate function and target service function respectively based on the number of receivable calling requests.
[0130] Specifically, the traffic management device can calculate the resource contribution based on the following formula:
[0131]
[0132] In the formula, I k It can be used to indicate the resource contribution corresponding to the kth function in the call relationship. k It can be used to indicate the number of response results corresponding to the call request received by the target interface function. k It can be used to represent the resources consumed by the target service function. R() can be used to represent the calculation formula for calculating service revenue. E() can be used to represent the calculation formula for calculating resource cost. k can be used to represent the kth function in the call relationship.
[0133] Furthermore, k can be used to represent the function level in the tree call graph constructed according to the calling relationship between multiple functions. Among them, the higher the function level of the current limiting, the fewer resources the target service function consumes. The higher the function level of the current limiting, the fewer response results corresponding to the call request received by the target interface function, and accordingly, the lower the contribution to the service provided. For example, the business corresponding to the interface function is to provide a purchase interface. The higher the function level of the current limiting, the less content is displayed in the purchase interface, and the fewer resources are consumed.
[0134] It should be noted that the framework for determining the current limiting rules may be Hystrics current limiting configuration, Service Mesh current limiting configuration, etc. Based on the framework of the current limiting rules, the traffic management device may generate current limiting rules for the core interface functions determined above, the number of acceptable call requests for the core interface functions, and the target function to be current limited.
[0135] Then, the traffic management device can perform flow limiting processing on the target function to be limited according to the flow limiting rules.
[0136] In the embodiment of this specification, the flow management device limits the flow of the target function, specifically as follows Figure 3 shown.
[0137] Figure 3 It is a schematic diagram of a current limiting process shown in an exemplary embodiment.
[0138] exist Figure 3 In the process, the traffic management device can obtain the operating parameters of each microservice node.
[0139] In response to the acquired operating parameters of any target microservice node, it is determined based on the operating parameters whether the target microservice node meets the current limiting condition corresponding to the operating parameters.
[0140] If so, the traffic management device may calculate the weight value of each interface function according to the function attributes and performance indicators of each interface function, and determine the core interface function.
[0141] Then, the traffic management device may calculate the number of receivable call requests of the core interface function related to the operating parameters based on the operating parameters.
[0142] Then, the traffic management device can determine the target intermediate function and target service function called by the target interface function based on the calling relationship, and calculate the resource contribution corresponding to the target intermediate function and target service function respectively based on the number of receivable calling requests.
[0143] Next, the traffic management device may determine the target function to be limited from multiple functions based on the resource contribution, and generate a flow limiting rule according to the above process.
[0144] Finally, the traffic management device can perform flow limiting processing on the target function to be limited according to the flow limiting rules.
[0145] It can be seen from the above method that if it is determined that the operating parameters of the target microservice node meet the current limiting conditions corresponding to the operating parameters, the traffic management device of the microservice architecture can calculate the resource contribution of multiple functions related to the services provided by the target microservice node. The resource contribution is used to represent the contribution of the resources consumed by the function to the services provided by the target microservice node. Based on the resource contribution, the target function to be limited is determined from multiple functions, and the target function is subjected to current limiting. This method can determine the target function to be limited from multiple functions based on the resource contribution, thereby improving the accuracy of current limiting for microservice nodes.
[0146] Corresponding to the above-mentioned embodiment of the method for traffic management, this specification also provides an embodiment of a device for traffic management.
[0147] See also Figure 4 , Figure 4 It is a structural diagram of an electronic device in which a traffic management device is located, which is shown as an exemplary embodiment. At the hardware level, the device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410, and of course may also include other required hardware. One or more embodiments of this specification can be implemented based on software, such as the processor 402 reading the corresponding computer program from the non-volatile memory 410 into the memory 408 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logical unit, but can also be hardware or logic devices.
[0148] See also Figure 5 , Figure 5 FIG. 1 is a block diagram of a flow management device according to an exemplary embodiment. The flow management device can be applied to Figure 5 In the electronic device shown in the figure, the technical solution of this specification is implemented. Wherein, the flow management device may include:
[0149] The acquisition module 500 is used to obtain the operating parameters of each microservice node;
[0150] A response module 502 is used to respond to the acquired operating parameters of any target microservice node and determine whether the target microservice node meets the current limiting condition corresponding to the operating parameters based on the operating parameters;
[0151] A calculation module 504 is used to calculate resource contributions corresponding to the multiple functions respectively if yes, wherein the resource contributions are used to indicate contributions of the resources consumed by the functions to the services provided by the target microservice node;
[0152] The current limiting module 506 is used to determine the target function to be current limited from the multiple functions based on the resource contribution, and perform current limiting processing on the target function.
[0153] Optionally, the traffic management device is a gateway device used to connect the client and the background server.
[0154] Optionally, the operating parameters include: server parameters of the server to which the microservice node belongs, and the response module 502 is specifically used to respond to the acquired server parameters of the server to which any target microservice node belongs, and based on the server parameters, determine whether the target microservice node meets the current limiting conditions corresponding to the server parameters.
[0155] Optionally, the response module 502 is specifically used for the current limiting condition corresponding to the operating parameter including:
[0156] The parameter value of the operating parameter is greater than a preset threshold; and the calculated performance scores of multiple functions related to the services provided by the target microservice node are greater than the calculated resource scores of multiple functions related to the services provided by the target microservice node; wherein the performance score is used to represent the size of the performance indicator of the function; and the resource score is used to represent the size of the resources consumed by the function.
[0157] Optionally, the traffic management device maintains a mapping relationship between the preset operating parameters and the performance indicators of the functions related to the operating parameters. The response module 502 is specifically used to determine the performance indicators of the functions related to the acquired operating parameters according to the mapping relationship between the operating parameters and the performance indicators of the functions related to the operating parameters, and predict parameter values of the performance indicators after the function is limited according to the performance indicators of the functions related to the operating parameters, calculate the performance score of the function according to the parameter values of the performance indicators after the function is limited, and calculate the resource score of the function according to the resources consumed for limiting the function.
[0158] Optionally, the traffic management device maintains a calling relationship between multiple functions related to the service provided by the microservice node; the multiple functions include: a service function, an intermediate function and an interface function, the service function is a function for providing service calls related to the service provided by the microservice node, the interface function is a function for providing service calls for the microservice node to the outside, the intermediate function is a function for providing function calls for the service function to the interface function, and the calculation module 504 is specifically used to calculate the number of receivable call requests for the target interface function related to the operating parameters based on the operating parameters, determine the target intermediate function and target service function called by the target interface function based on the calling relationship, and calculate the resource contribution corresponding to the target intermediate function and target service function respectively based on the number of receivable call requests.
[0159] Optionally, the calculation module 504 is specifically configured to calculate resource contribution based on the following formula:
[0160]
[0161] In the formula, I k It is used to indicate the resource contribution corresponding to the kth function in the calling relationship, R(Y k ) is used to represent the service revenue obtained based on the number of response results corresponding to the call request received by the target interface function, E(C k ) is used to represent the resource cost obtained based on the resources consumed by the target service function, and k is used to represent the kth function in the calling relationship.
[0162] Optionally, the calculation module 504 is further specifically used to determine function properties and performance indicators of each interface function, calculate the weight value of each interface function according to the function properties and performance indicators of each interface function, the weight value is used to indicate the importance of the service provided by the interface function to the target microservice node, sort the weight values of the interface functions, determine the interface function with a weight value greater than a set threshold as the core interface function, and calculate the number of call requests that can be received by the core interface function in the target interface function related to the operating parameters based on the operating parameters.
[0163] Optionally, the traffic management device maintains a mapping relationship between a preset performance indicator of the service function and a performance indicator of the interface function. The calculation module 504 is specifically used to predict the number of call requests of the core interface function as a first prediction value. According to the mapping relationship between the performance indicator of the service function and the performance indicator of the interface function, the first prediction value is converted into the number of call requests of the target service function that has a call relationship with the core interface function for the core interface function as a second prediction value. It is determined whether the sum of the second prediction values of the core interface function that has a call relationship with the target service function is less than the preset number of receivable call requests of the target service function. If so, the number of receivable call requests of the target service function is allocated to the core interface function that has a call relationship with the target service function according to the weight value of the core interface function, and the number of receivable call requests of the core interface function that has a call relationship with the target service function is calculated.
[0164] Optionally, the calculation module 504 is specifically configured to calculate the number of receivable call requests of the core interface function that has a call relationship with the target service function based on the following formula:
[0165]
[0166] In the formula, I i Used to indicate the number of receivable call requests corresponding to the i-th core interface function, QPS max It is used to indicate the maximum number of call requests that can be received by the target service function, W i Used to represent the weight value corresponding to the i-th core interface function. It is used to represent the sum of weight values corresponding to k core interface functions, and U() is used to represent a conversion function that converts the number of receivable call requests of the target service function into the number of receivable call requests of the core interface function.
[0167] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0168] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Ordinary technicians in this field can understand and implement it without paying creative work.
[0169] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0170] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0171] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0172] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0173] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0174] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0175] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0176] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "one", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0177] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0178] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.
Claims
1. A method for traffic management, the method being applied to a traffic management device using a microservice architecture, wherein a microservice node includes a plurality of functions for providing services; The microservice architecture includes several microservice nodes, including: Get the operating parameters of each microservice node; In response to the acquired operating parameters of any target microservice node, determining whether the target microservice node meets the current limiting condition corresponding to the operating parameters based on the operating parameters; If yes, calculate the resource contribution corresponding to the multiple functions respectively, where the resource contribution is used to represent the contribution of the resources consumed by the function to the service provided by the target microservice node; Based on the resource contribution, a target function to be limited is determined from the multiple functions, and a current limiting process is performed on the target function.
2. According to the method as claimed in claim 1, the traffic management device is a gateway device used to connect the client and the background server.
3. The method of claim 1, wherein the operating parameters include: Server parameters of the server to which the microservice node belongs; In response to the acquired operating parameters of any target microservice node, determining whether the target microservice node meets the current limiting condition corresponding to the operating parameters based on the operating parameters includes: In response to the acquired server parameters of the server to which any target microservice node belongs, based on the server parameters, it is determined whether the target microservice node meets the current limiting condition corresponding to the server parameters.
4. The method according to claim 1, wherein the current limiting condition corresponding to the operating parameter comprises: The parameter value of the operating parameter is greater than a preset threshold; Furthermore, the calculated performance scores of the multiple functions related to the services provided by the target microservice node are greater than the calculated resource scores of the multiple functions related to the services provided by the target microservice node; wherein the performance score is used to indicate the size of the performance indicator of the function; and the resource score is used to indicate the size of the resources consumed by the function.
5. The method according to claim 4, wherein the traffic management device maintains a mapping relationship between the preset operating parameters and the performance indicators of the functions related to the operating parameters; The calculated performance scores of multiple functions related to the services provided by the microservice node include: Determine the performance indicator of the function related to the acquired operating parameter according to the mapping relationship between the operating parameter and the performance indicator of the function related to the operating parameter, and predict the parameter value of the performance indicator after current limiting is performed on the function according to the performance indicator of the function related to the operating parameter; Calculate the performance score of the function according to the parameter values of the performance indicators after the function is current limited; The calculated resource scores of multiple functions related to the services provided by the target microservice node include: A resource score of the function is calculated according to the resources consumed by limiting the flow of the function.
6. The method of claim 1, wherein the traffic management device maintains a call relationship between multiple functions related to the service provided by the microservice node; The multiple functions include: a service function, an intermediate function and an interface function, wherein the service function is a function for providing a service call related to the service provided by the microservice node, the interface function is a function for providing a service call for the microservice node externally, and the intermediate function is a function for providing a function call for the service function to the interface function; Calculating resource contributions corresponding to the multiple functions respectively, including: Calculating the number of receivable call requests of the target interface function related to the operating parameter based on the operating parameter; Based on the calling relationship, the target intermediate function and the target service function called by the target interface function are determined, and based on the number of receivable calling requests, the resource contributions corresponding to the target intermediate function and the target service function are respectively calculated.
7. The method according to claim 6, wherein the resource contribution corresponding to the target intermediate function and the target service function is calculated based on the number of the receivable call requests, comprising: Resource contribution is calculated based on the following formula: In the formula, I k It is used to indicate the resource contribution corresponding to the kth function in the calling relationship, R(Y k ) is used to represent the service revenue obtained based on the number of response results corresponding to the call request received by the target interface function, E(C k ) is used to represent the resource cost obtained based on the resources consumed by the target service function, and k is used to represent the kth function in the calling relationship.
8. The method according to claim 6, before calculating the number of receivable call requests of the target interface function related to the operating parameter, the method further comprises: Determine the function properties and performance indicators of each interface function; Calculate the weight value of each interface function according to the function attributes and performance indicators of each interface function, wherein the weight value is used to indicate the importance of the service provided by the interface function to the target microservice node; Sorting the weight values of the interface functions, and determining the interface functions whose weight values are greater than a set threshold as core interface functions; Calculating the number of receivable call requests of the target interface function related to the operating parameter based on the operating parameter includes: The number of receivable call requests of the core interface function in the target interface function related to the operating parameter is calculated based on the operating parameter.
9. The method according to claim 8, wherein the traffic management device maintains a preset mapping relationship between the performance index of the service function and the performance index of the interface function; Calculating the number of receivable call requests of a core interface function in a target interface function related to the operating parameter based on the operating parameter includes: Predicting the number of call requests of the core interface function as a first prediction value; According to the mapping relationship between the performance index of the service function and the performance index of the interface function, converting the first prediction value into the number of call requests of the target service function having a call relationship with the core interface function for the core interface function as the second prediction value; Determine whether the sum of the second prediction values of the core interface functions that have a calling relationship with the target service function is less than a preset number of receivable calling requests of the target service function; If so, according to the weight value of the core interface function, the number of call requests that can be received by the target service function is allocated to the core interface function that has a call relationship with the target service function, and the number of call requests that can be received by the core interface function that has a call relationship with the target service function is calculated.
10. The method according to claim 9, wherein the number of receivable call requests of the core interface function that has a call relationship with the target service function comprises: The number of call requests that can be received by the core interface function that has a call relationship with the target service function is calculated based on the following formula: In the formula, I i Used to indicate the number of receivable call requests corresponding to the i-th core interface function, QPS max It is used to indicate the maximum number of call requests that can be received by the target service function, W i Used to represent the weight value corresponding to the i-th core interface function. It is used to represent the sum of weight values corresponding to k core interface functions, and U() is used to represent a conversion function that converts the number of receivable call requests of the target service function into the number of receivable call requests of the core interface function.
11. A traffic management device, the device being applied to a traffic management device using a microservice architecture, wherein a microservice node includes a plurality of functions for providing services; The microservice architecture includes several microservice nodes, including: The acquisition module is used to obtain the operating parameters of each microservice node; A response module, configured to respond to the acquired operating parameters of any target microservice node and determine, based on the operating parameters, whether the target microservice node satisfies a current limiting condition corresponding to the operating parameters; a calculation module, configured to, if yes, calculate resource contributions respectively corresponding to the multiple functions, wherein the resource contributions are used to represent contributions of the resources consumed by the functions to the services provided by the target microservice node; The current limiting module is used to determine the target function to be current limited from the multiple functions based on the resource contribution, and perform current limiting processing on the target function.
12. An electronic device, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus; The memory stores machine-readable instructions, and the processor executes the method according to any one of claims 1 to 10 by calling the machine-readable instructions.
13. A machine-readable storage medium storing machine-readable instructions, wherein the machine-readable instructions, when called and executed by a processor, implement the method according to any one of claims 1 to 10.
Citation Information
Cited By
Self-adaptive dynamic flow management system, method and product
CN120639775A