Load balancing method and device and computing device cluster
By analyzing the real load of the service instance and calculating the load score, adjusting the load of the service instance, the problem of load imbalance in the microservice architecture is solved and the stability of the system in high concurrency scenarios is improved.
Patent Information
- Application Number
- CN202411552152.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-14
AI Technical Summary
In microservice architecture, load imbalance of service instances may lead to server access accumulation and downtime in high concurrency scenarios, and the existing technology is difficult to effectively solve this problem.
By obtaining the link tracking data corresponding to the call chain, analyzing the real load of the service instance, calculating the load score, and flexibly adjusting the load of the service instance based on the load score to achieve load balancing.
It reduces the probability of load imbalance between service instances, improves the stability and reliability of the system in high concurrency scenarios, and avoids server access accumulation and downtime.
Smart Images

Figure CN119621301A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of distributed service technology, and in particular to a load balancing method, device and computing device cluster. Background Art
[0002] With the continuous development of Internet technology, the amount of data access on the network is increasing day by day. In the current microservice architecture scenario, services are deployed in a distributed manner, and each service is deployed in multiple instances. If the client's access cannot be evenly distributed to multiple instances, in high-concurrency scenarios, the server access will accumulate and cause downtime.
[0003] Currently, developers specify load balancing strategies in advance and distribute access to multiple instances according to load balancing.
[0004] However, client access is uncertain and changeable. When the access situation changes, it may cause load imbalance among various services and may cause business interruption. Summary of the invention
[0005] The embodiments of the present invention provide a load balancing method, apparatus and computing device cluster, which analyze the actual load of the service instance according to the actual operation status and call path of the service instance, obtain the load score, and flexibly change the load of the service instance according to the load score, thereby reducing the probability of imbalance between service instances and achieving load balancing.
[0006] In a first aspect, an embodiment of the present invention provides a load balancing method, the method comprising:
[0007] Obtain the first link tracking data corresponding to the call chain; each service in the call chain is deployed as a service instance cluster, and the first link tracking data is used to indicate the operation status and service instance path of each service instance in the service instance cluster, and the service instance path is used to indicate the service instance call path adapted to the call chain;
[0008] Based on the first link tracking data, a load score of each service instance in the service instance cluster for the call chain is determined; the load score is used to load balance the service instance cluster when the service instance cluster is called according to the call chain.
[0009] In this solution, the actual load of the service instance is analyzed according to the actual operation status and call path of the service instance to obtain the load score, and the load of the service instance is flexibly changed according to the load score, thereby reducing the probability of imbalance between service instances and achieving load balancing.
[0010] In a possible implementation, determining a load score of each service instance in the service instance cluster for the call chain based on the first link tracking data includes:
[0011] Determine a weight coefficient of the service instance cluster for the load indicator; based on the first link tracking data, determine a first indicator value for the load indicator for each service instance in the service instance cluster; based on the weight coefficient of the service instance cluster for the load indicator and the first indicator value for the load indicator for each service instance in the service instance cluster, determine a load score for each service instance in the service instance cluster for the call chain.
[0012] In this solution, the actual load of the service instance is evaluated based on the load indicator to obtain a load score with a high reference value.
[0013] In a possible implementation, determining a load score of each service instance in the service instance cluster for the call chain based on a weight coefficient of the service instance cluster for the load indicator and a first indicator value of each service instance in the service instance cluster for the load indicator includes:
[0014] Based on the first indicator value of the load indicator of each service instance in the service instance cluster, determine the maximum indicator value of the load indicator of the service instance cluster; based on the maximum indicator value of the load indicator and the first indicator value of the load indicator of each service instance in the service instance cluster, determine the proportion of the load indicator of each service instance in the service instance cluster; based on the weight coefficient of the service instance cluster for the load indicator and the proportion of each service instance in the service instance cluster for the load indicator, determine the load score of each service instance in the service instance cluster for the call chain.
[0015] In a possible implementation, determining a weight coefficient of a service instance cluster for a load indicator includes:
[0016] Based on the second link tracing data corresponding to the call chain, multiple samples corresponding to the target service are determined, and each sample in the multiple samples is used to indicate the second indicator value of each service instance in the service instance cluster for the load indicator; based on the multiple samples, the target indicator in the load indicator that affects the service quality provided by the service instance cluster is analyzed, and the weight coefficient of the service instance cluster for the load indicator is determined.
[0017] In this solution, the weight coefficient of the service for the load indicator is modified according to the actual situation to more accurately evaluate the load score of the service instance.
[0018] In a possible implementation, the first link tracking data includes at least one of the following:
[0019] The service performance index of the service instance for the call chain, the performance index of the service instance, the load score of the service instance for the upstream service instance of the call chain, and the load score of the service instance for the downstream service instance of the call chain.
[0020] In a possible implementation, the service performance indicator includes at least one of the following:
[0021] The number of requests received for the call chain, the response time of calling the service according to the call chain, and the error rate of requests for the call chain;
[0022] The performance indicators of a service instance include at least one of the following:
[0023] CPU usage, memory usage, number of exceptions.
[0024] In a possible implementation, the load indicator includes at least one of the following:
[0025] Memory usage, CPU usage, response time, error rate, number of exceptions, number of requests, load score of upstream service instances, and load score of downstream service instances. The error rate indicates the ratio of the number of requests with errors for the call chain to the total number of requests for the call chain; the response time is the time from when the service instance starts calling the service according to the call chain to when it receives the response result returned by the called service.
[0026] In a possible implementation, the method further includes:
[0027] Based on the load score of each service instance in the service instance cluster for the call chain, available service instances in the service instance cluster are determined.
[0028] In the second aspect, an embodiment of the present invention provides a load balancing device, which includes several modules, each of which is used to execute each step in the load balancing method provided in the first aspect of the embodiment of the present invention, and the division of modules is not limited here. For the specific functions performed by each module of the load balancing device and the beneficial effects achieved, please refer to the functions of each step of the load balancing method provided in the first aspect of the embodiment of the present invention, which will not be repeated here.
[0029] By way of example, the load balancing device includes:
[0030] An acquisition module is used to acquire the first link tracking data corresponding to the call chain; each service in the call chain is deployed as a service instance cluster, and the first link tracking data is used to indicate the operation status and service instance path of each service instance in the service instance cluster, and the service instance path is used to indicate the service instance call path adapted to the call chain;
[0031] The score calculation module is used to determine the load score of each service instance in the service instance cluster for the call chain based on the first link tracking data; the load score is used to load balance the service instance cluster when the service instance cluster is called according to the call chain.
[0032] In one possible implementation, a score calculation module is used to determine a weight coefficient of a service instance cluster for a load indicator; based on first link tracking data, determine a first indicator value of each service instance in the service instance cluster for the load indicator; based on the weight coefficient of the service instance cluster for the load indicator and the first indicator value of each service instance in the service instance cluster for the load indicator, determine the load score of each service instance in the service instance cluster for the call chain.
[0033] In one possible implementation, the score calculation module is used to determine the maximum indicator value of the service instance cluster for the load indicator based on the first indicator value of each service instance in the service instance cluster for the load indicator; determine the proportion of each service instance in the service instance cluster for the load indicator based on the maximum indicator value of the load indicator and the first indicator value of each service instance in the service instance cluster for the load indicator; determine the load score of each service instance in the service instance cluster for the call chain based on the weight coefficient of the service instance cluster for the load indicator and the proportion of each service instance in the service instance cluster for the load indicator.
[0034] In one possible implementation, the score calculation module is used to determine multiple samples corresponding to the target service based on the second link tracking data corresponding to the call chain, and each sample in the multiple samples is used to indicate the second indicator value of each service instance in the service instance cluster for the load indicator; based on the multiple samples, the target indicator in the load indicator that affects the service quality provided by the service instance cluster is analyzed, and the weight coefficient of the service instance cluster for the load indicator is determined.
[0035] In a possible implementation, the score calculation module is used to determine available service instances in the service instance cluster based on a load score of each service instance in the service instance cluster for a call chain.
[0036] In a possible implementation, the first link tracking data includes at least one of the following:
[0037] The operating indicators of each service instance, the anomaly detection results of each service instance, the upstream service instance of each service instance, the downstream service instance of each service instance, and the request tracking identifier corresponding to each service instance.
[0038] In a possible implementation, the first link tracking data includes at least one of the following:
[0039] The service performance index of the service instance for the call chain, the performance index of the service instance, the load score of the service instance for the upstream service instance of the call chain, and the load score of the service instance for the downstream service instance of the call chain.
[0040] In a possible implementation, the service performance indicator includes at least one of the following:
[0041] The number of requests received for the call chain, the response time of calling the service according to the call chain, and the error rate of requests for the call chain;
[0042] The performance indicators of a service instance include at least one of the following:
[0043] CPU usage, memory usage, number of exceptions.
[0044] In a possible implementation, the load indicator includes at least one of the following:
[0045] Memory usage, CPU usage, response time, error rate, number of exceptions, number of requests, load score of upstream service instances, and load score of downstream service instances. The error rate indicates the ratio of the number of requests with errors for the call chain to the total number of requests for the call chain; the response time is the time from when the service instance starts calling the service according to the call chain to when it receives the response result returned by the called service.
[0046] In a third aspect, an embodiment of the present invention provides a load balancing device, comprising: at least one memory for storing programs; and at least one processor for executing the programs stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method provided in the first aspect.
[0047] In a fourth aspect, an embodiment of the present invention provides a load balancing device, which runs computer program instructions to execute the method provided in the first aspect. Exemplarily, the device may be a chip or a processor.
[0048] In one example, the device may include a processor, which may be coupled to a memory, read instructions in the memory and execute the method provided in the first aspect according to the instructions. The memory may be integrated in a chip or a processor, or may be independent of the chip or the processor.
[0049] In a fifth aspect, an embodiment of the present invention provides a computer storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes the method provided in the first aspect.
[0050] In a sixth aspect, an embodiment of the present invention provides a computing device cluster, the computing device cluster comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the method provided in the first aspect.
[0051] In a seventh aspect, an embodiment of the present invention provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 is a system architecture diagram of a service system provided by an embodiment of the present invention;
[0053] Figure 2 is a schematic diagram of a call chain provided by an embodiment of the present invention;
[0054] Figure 3 It is a schematic diagram of calling between services provided by an embodiment of the present invention;
[0055] Figure 4 is a schematic diagram of a load balancing method provided by an embodiment of the present invention;
[0056] Figure 5 is a schematic diagram of a service instance path of a call chain provided by an embodiment of the present invention;
[0057] Figure 6 is a schematic diagram of determining a load score provided by an embodiment of the present invention;
[0058] Figure 7 is a schematic diagram of another method for determining a load score provided by an embodiment of the present invention;
[0059] Figure 8 is a schematic diagram of a load balancing scenario provided by an embodiment of the present invention;
[0060] Figure 9a is a schematic diagram of load balancing provided by an embodiment of the present invention;
[0061] Figure 9b is a schematic diagram of another load balancing provided by an embodiment of the present invention;
[0062] Fig.10 is a schematic diagram of a load balancing system provided by an embodiment of the present invention;
[0063] Fig.11 It is a flow chart of a load balancing device provided by an embodiment of the present invention;
[0064] Fig.12 is a schematic diagram of the structure of a computing device provided by an embodiment of the present invention;
[0065] Fig.13 is a schematic diagram of the structure of a computing device cluster provided by an embodiment of the present invention;
[0066] Fig.14A schematic diagram of computing devices in a computer cluster provided by an embodiment of the present invention being connected via a network. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the technical solution in the embodiments of the present invention will be described below with reference to the accompanying drawings.
[0068] In the description of the embodiments of the present invention, words such as "exemplary", "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a concrete way.
[0069] In the description of the embodiments of the present invention, the term "and / or" is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, B exists alone, and A and B exist at the same time. In addition, unless otherwise specified, the term "multiple" means two or more. For example, multiple systems refers to two or more systems, and multiple terminals refers to two or more terminals.
[0070] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprises", "has" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0071] Hereinafter, some terms used in this embodiment are explained. It should be noted that these explanations are for the convenience of understanding by those skilled in the art and do not constitute a limitation on the scope of protection claimed by the present invention.
[0072] Elastic Load Balance (ELB): is a traffic distribution control service that distributes access traffic to multiple backend servers according to the distribution strategy. Elastic Load Balance can expand the external service capabilities of the application system through traffic distribution, and improve the availability of the application system by eliminating single points of failure.
[0073] Application Performance Management (APM): is a relatively new network management direction, which mainly refers to monitoring and optimizing the key business applications of an enterprise, improving the reliability and quality of enterprise applications, ensuring that users receive good services, and reducing IT total cost of ownership (TCO).
[0074] Software Development Kit (SDK): A collection of relevant documents, examples, and tools to assist in the development of a certain type of software.
[0075] First, a service system to which the method provided in the embodiment of the present invention may be applied is described. Figure 1 The following is a schematic diagram of the architecture of a service system provided by an embodiment of the present invention. Figure 1As shown, the system includes a terminal 110 and a computing device cluster 120. The terminal 110 and the computing device cluster 120 are connected via a network. The network may be a wired network or a wireless network. For example, the wired network may be a cable network, an optical fiber network, a digital data network (DDN), etc., and the wireless network may be a telecommunication network, an internal network, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a public switched telephone network (PSTN), a Bluetooth network, a Zig Bee network, a mobile phone (Global System for Mobile Communications, GSM), a CDMA (Code Division Multiple Access) network, a CPRS (General Packet Radio Service) network, etc. or any combination thereof. It is understandable that the network can use any known network communication protocol to achieve communication between different client layers and gateways. The above-mentioned network communication protocol can be various wired or wireless communication protocols, such as Ethernet, universal serial bus (USB), Firewire, global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), new radio (NR), Bluetooth, wireless fidelity (Wi-Fi) and other communication protocols or any combination thereof.
[0076] Among them, the terminal 110 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. Exemplary embodiments of the terminal 110 involved in this solution include, but are not limited to, electronic devices equipped with iOS, Android, Windows, Harmony OS, or other operating systems. The embodiment of the present invention does not specifically limit the type of the terminal 110.
[0077] Among them, the computing device cluster 120 can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN) and big data and artificial intelligence platforms. The cloud server cluster is deployed in several cloud data centers.
[0078] The computing device cluster 120 can be used as a cloud (a software platform that uses application virtualization technology (Application Virtualization) and integrates multiple functions such as software search, download, use, management, and backup); in specific use, the computing device cluster 120 can be configured as a cloud management platform 121 and a data center 122, and the terminal 110 and the cloud interact through the cloud management platform 122.
[0079] The cloud management platform 121 can be independently deployed on a server or virtual machine in the data center 122, or distributedly deployed on multiple servers in the data center 122, or distributedly deployed on multiple virtual machines in the data center 122. A portion of the cloud management platform 121 can be independently or distributedly deployed in a device in an edge environment (also called an edge device), and another portion can be independently or distributedly deployed in the data center 122. The edge environment is an environment that is geographically close to the user's terminal computing device, and the edge environment includes edge devices, such as edge servers, edge stations with computing capabilities, etc.
[0080] In the embodiment of the present invention, the data center 122 can deploy a distributed system, and the distributed system can deploy multiple services 123 using a microservice architecture. Each service 123 is deployed in the form of a service instance cluster 130, and the service instance cluster 130 is composed of multiple service instances 131. In other words, the service 123 is distributed and deployed on each service instance 131 in the service instance cluster 130, and each service instance 131 is used to provide the same service. The service instance 131 can be a container, a virtual machine, or a physical server, which is not specifically limited in the embodiment of the present invention.
[0081] It should be noted that microservice architecture refers to dividing a program into multiple small services. Each service is built around a specific business. Each service runs independently, and the services coordinate and cooperate with each other to realize the functions of the entire program.
[0082] In the embodiment of the present invention, multiple services 123 are called according to a call chain (used to indicate the call relationship between services 123) to implement a business. For each service 123 in the distributed system, the service 123 can call other services 123, and can also be called by other services 123. In actual applications, the business can be provided by the client, the client processes the business to generate a business request, and the distributed system responds to the business request, and calls multiple services 123 according to the call chain call relationship to implement the business. Here, the client can be a terminal 110, such as a mobile phone, a tablet computer, a notebook, a desktop computer, etc., which is not specifically limited here. Among them, the business can be understood as a certain transaction that needs to be implemented; for example, a purchase business, a payment business, a recharge business, etc. The business can include multiple tasks. For example, for a purchase business, it can include tasks such as product management, user management, subscription relationship management, billing management, etc. For multiple services 123 that implement a certain business, each of these services 123 only focuses on one task in the business, and the tasks between multiple services 123 are independent of each other or loosely coupled (that is, not much coupling or a small amount of coupling).
[0083] The calling relationship reflects the calling sequence between multiple services 123 in the business. Figure 2 As shown, the calling relationship can be described as follows: the user sends a business request to service 123A, service 123A executes the business according to the business request and calls service 123B and service 123C to provide the corresponding service. After service 123B provides the corresponding service, it returns a response to service 123A; service 123C calls service 123D and service 123E to provide the corresponding service. After service 123D and service 123E provide the corresponding service, they return a response to service 123C, and service 123C returns a response to service 123A. Service 123A then continues to execute the business according to the responses returned by service 123C and service 123B. After the business is completed, service 123A returns a response to the user.
[0084] The call between any two services 123 is implemented by the service instance 131 in the service instance cluster 130. For example, Figure 3As shown, assuming that service 123A calls service 123B, any service instance 131 in service instance cluster 130A of service 123A sends a call request to any service instance 131 in service instance cluster 130B of service 123B, and service instance 131 in service instance cluster 130B returns a response result to service instance 131 in service instance cluster 130A.
[0085] In the embodiment of the present invention, the cloud management platform 121 can deploy a load balancing service (ELB) and an application performance management (APM); wherein the ELB is used to receive a service request sent by the terminal 110, and distribute the service request to the service instance cluster 130 of the first service 123 in the call chain according to the load balancing strategy, or receive a service call request sent by the service instance 131, and distribute the service call request to the service instance cluster 130 of the called service according to the load balancing strategy. The APM is used to monitor and optimize the service instance 131, and improve the quality and reliability of the service instance 131.
[0086] Next, in combination with the service system provided above, a load balancing method provided by an embodiment of the present invention is described in detail.
[0087] Figure 4 1 is a flow chart of a load balancing method provided by an embodiment of the present invention. This embodiment can be applied to a service system, and specifically to a cloud management platform 121. Figure 4 As shown, the load balancing method provided by the embodiment of the present invention includes at least the following steps:
[0088] Step 401, the cloud management platform 121 obtains the first link tracking data corresponding to the call chain; each service 123 in the call chain is deployed with a service instance cluster 130, and the first link tracking data is used to indicate the operation status and service instance path of each service instance 131 in the service instance cluster 130, and the service instance path is used to indicate the call path of the service instance 131 that adapts the call chain.
[0089] In specific implementation, for a service request from a client, in the process of responding to the service request, it is necessary to select any service instance 131 in the service instance cluster 130 of each service 123 in the call chain according to the call relationship between the services 123 in the call chain. The selected service instance 131 of each service 123 is connected according to the call chain to generate a service instance path; for example, Figure 5As shown, assuming that the call chain is service 1 calling service 2, service 2 calling service 3, assuming that service instance cluster 1 of service 1 is composed of service instances 10 to 19, service instance cluster 2 of service 2 is composed of service instances 20 to 29, and service instance cluster 3 of service 3 is composed of service instances 30 to 39, the business request is assigned to service instance 10 of service 1, the service call request issued by service instance 10 of service 1 is assigned to service instance 20 of service 2, and the service call request issued by service instance 20 of service 2 is assigned to service instance 30 of service 3, service instance 30 returns a response result to service instance 20, and service instance 20 returns a response result to service instance 10, then service instance 10, service instance 20, and service instance 30 are connected in sequence to form a service instance path corresponding to the call chain. In actual applications, a business request has a unique trace id. Specifically, in a business request, a globally unique trace id for identifying this request will be generated at the beginning of the distributed system. This trace id will remain unchanged no matter how many service instances 131 it passes through during this request call, and will be continuously passed with the call of each layer. Finally, each service instance 131 of this business request in the distributed system can be strung together through the trace id to obtain the service instance path. In addition, each calling process is called a span, which is generally identified by a span id, and the span id increases from 0. Different services 123 will be called during a business request, and a new span id will be generated for each call to record. In this way, the spanid can be used to locate the position of the current request in the entire call chain, as well as its upstream service instance 131 and downstream service instance 131. For example, during a business request, spanA calls spanB, and then spanB calls spanC. Each span call will generate its own span id, so the service instance path can be spanA id-spanB id-spanC id.
[0090] When there are many business requests in the call chain, the service instance cluster 130 of any service 123 in the call chain needs to be load balanced. In other words, a large number of business requests need to be evenly distributed to the service instance cluster 130 of the first service 123 in the call chain, and a large number of service call requests sent by each service 123 to the called service need to be evenly distributed to the service instance cluster 130 of the called service 123, so that the load is balanced among the service instances 131 of each service 123, and there will be no situation where the request set is in some service instances 131, affecting the business.
[0091] In an embodiment of the present invention, the link tracking function can be integrated into APM or ELB, so that APM or ELB can track the call link in real time without intrusion through bytecode enhancement. Exemplarily, the link tracking function is integrated into APM, and the service instance 131 deploys the APM SDK. When the service instance 131 is started, the APM SDK is started, and the link tracking data corresponding to each service instance 131 can be collected and reported to APM according to a preset time interval, such as 1 second; Exemplarily, the link tracking data can include at least one of the following:
[0092] The operating indicators of service instance 131, the anomaly detection results of service instance 131, the previous service instance 131 of service instance 131 (including span id), the next service instance 131 of service instance 131 (including span id), and the request tracking identifier corresponding to service instance 131 (such as trace id).
[0093] Among them, abnormal detection results may include timeouts, crashes, etc.
[0094] Among them, the operation indicators may include response time, error rate (ErrorRate), resource utilization rate, etc. The response time (ResponseTime) is the time from the service instance 131 calling the service according to the call chain to receiving the response result returned by the called service; the error rate (ErrorRate) is used to indicate the ratio of the number of requests with errors to the total number of requests processed for a certain same request; the resource utilization rate is used to show the overall operation of the service instance 131, and may include CPU utilization rate (CPUUsage) and memory utilization rate (MemoeryUsage). The CPU utilization rate (CPUUsage) can be understood as the CPU usage of the service instance 131 when processing all the received requests, and the memory utilization rate (MemoeryUsage) can be understood as the memory usage of the service instance 131 when processing all the received requests.
[0095] It should be noted that the operating indicators and anomaly detection results can be used to describe the operating status of the service instance 131.
[0096] Subsequently, APM obtains the link tracking data corresponding to each service instance 131, integrates it according to the trace id and span id, and determines several service instance paths corresponding to the call chain. In actual applications, for each business request for the same call chain, the trace id is different, but the span id is the same; therefore, APM can obtain the service instance path by connecting the service instances 131 belonging to different span ids of the same trace id; if the span ids of multiple service instance paths are the same, it can be considered that the multiple service instance paths belong to the same call chain.
[0097] Step 402 : The cloud management platform 121 determines a load score of each service instance 131 in the service instance cluster 130 for the call chain based on the first link tracking data.
[0098] In a specific implementation, the cloud management platform 121 can determine the load score of each service instance 131 in the service instance cluster 130 for the call chain based on the first link tracking data. The load score is used to evaluate the load of the corresponding service instance 131 in the call chain. If the service instance cluster 130 participates in multiple call chains, then for each call chain in which the service instance cluster 130 participates, it is necessary to determine the load score of each service instance 131 in the service instance cluster 130 for each call chain. It is worth noting that in the embodiment of the present invention, each call chain needs to be processed in the same way, and a call chain is used as an example for description below.
[0099] The cloud management platform 121 can determine the weight coefficient of the service instance cluster 130 for the load indicator for each service in the call chain; determine the first indicator value of the load indicator for each service instance 131 in the service instance cluster 130 based on the weight coefficient of the load indicator for the service instance cluster 130 and the first link tracking data; determine the load score of each service instance 131 in the service instance cluster 130 for the call chain based on the weight coefficient of the load indicator for the service instance cluster 1130 and the first indicator value of the load indicator for each service instance 131 in the service instance cluster 130.
[0100] Among them, the load indicators may include the service performance indicators of service instance 131 for the call chain, the performance indicators of service instance 131, the load score of service instance 131 for the upstream service instance of the call chain, and the load score of service instance 131 for the downstream service instance of the call chain.
[0101] Exemplarily, the service performance indicators may be response time (ResponseTime), error rate (ErrorRate), and number of requests (RequestCount); the response time (ResponseTime is the time from when the service instance 131 starts calling the service according to the call chain to when it receives the response result returned by the called service; the error rate (ErrorRate) is used to indicate the ratio of the number of requests with errors to the total number of requests processed for the call chain; the number of requests (RequestCount) is used to indicate the total number of requests for the call chain. In actual applications, the cloud management platform 131 may obtain the trace id corresponding to the call chain based on the first link tracking data; for each service instance 131, determine the error rate (ErrorRate) and number of requests (RequestCount) of each trace id corresponding to the call chain, and obtain the error rate (ErrorRate) and number of requests (RequestCount) of the service instance 131 for the call chain after summarizing and superimposing.
[0102] For example, the performance indicators of the service instance 131 may be CPU usage (CPUUsage), memory usage (MemoeryUsage), and anomaly count (AnomalyCount). The anomaly count (AnomalyCount) is the number of anomalies of the system of the service instance 131 during operation.
[0103] Exemplarily, load indicators may include but are not limited to the following eight types: response time (ResponseTime), error rate (ErrorRate), number of requests (RequestCount), CPU usage (CPUUsage), memory usage (MemoeryUsage), number of anomalies (AnomalyCount), upstream performance (UpstreamPerformance), and downstream performance (DownstreamPerformance). The upstream performance (UpstreamPerformance) is the load score of the upstream service instance 131 in the call chain for the call chain, and the downstream performance (DownstreamPerformance) is the load score of the downstream service instance 131 in the call chain for the call chain.
[0104] It should be noted that different services 123 in the call chain have different tasks. For example, for product query, the call chain is: service 1 calls service 2 and service 3, service 3 calls service 4, service 1 is used to respond to business requests, service 2 is used for authentication, service 3 is used to query preferences, and service 4 is used to query products. Therefore, the resource consumption of each service 123 will be different, which will result in different weight coefficients of different services 123 for load indicators.
[0105] In actual applications, the cloud management platform 121 can determine multiple service instance paths corresponding to the call chain based on the trace id and span id in the link tracking data reported by each service instance 131; for each service instance path corresponding to the call chain, the service instance 131 is processed in sequence according to the order of the service instance path, and based on the link tracking data reported by the service instance 131, the service performance indicators of the service instance 131 for the call chain and the performance indicators of the service instance 131 can be determined, and the load score of the determined service instance 131 for the upstream service instance of the call chain and the load score of the service instance 131 for the downstream service instance of the call chain can be obtained, so as to determine the load score of the service instance 131 for the service instance path; thereafter, for each service instance 131 in the several service instance paths corresponding to the call chain, the load scores of the service instance 131 for each service instance path corresponding to the call chain are averaged to obtain the load score of the service instance 131 for the call chain.
[0106] Among them, based on the weight coefficient of the service instance cluster 1130 for the load index and the first index value of each service instance 131 in the service instance cluster 130 for the load index, determining the load score of each service instance 131 in the service instance cluster 130 for the call chain can be achieved in multiple ways:
[0107] Implementation method 1: the cloud management platform 121 performs a task on any service instance 131 (referred to as a target service instance for ease of description and distinction) in the service instance cluster 130, such as Figure 6 As shown, based on the first link tracking data, the index value of the target service instance 131 for the load index (for the convenience of description and distinction, it can be called the first index value) is determined; based on the weight coefficient of the service instance cluster 130 for the load index and the first index value of the target service instance 131 for the load index, the load score of the target service instance 131 for the call chain is determined. For example, the weight coefficient of the service instance cluster 130 for the load index and the first index value of the target service instance 131 for the load index are weighted or weighted averaged to determine the load score of the target service instance 131 for the call chain. For example, Figure 6As shown, there can be multiple load indicators, for example 8, and the weight coefficients can include weight coefficients of load indicators 1 to 8: weight coefficient 1 to weight coefficient 8, and the first indicator value includes indicator values of load indicators 1 to 8: indicator value 1 to indicator value 8.
[0108] Implementation method 2: Figure 7 As shown, the cloud management platform 121 determines the maximum index value of the load index of the service instance cluster 130 based on the first index value of each service instance 131 in the service instance cluster 130 for the load index. For example, the maximum index value is the maximum value of the first index value of each service instance 131 in the service instance cluster 130 for the load index; then, the proportion of the first index value of the load index of the target service instance 131 to the maximum index value of the load index is determined; based on the weight coefficient of the service instance cluster 130 for the load index and the proportion of the load index of the target service instance 131, the load score of the target service instance 131 for the call chain is determined. For example, Figure 7 As shown, there can be multiple load indicators, for example 8, and the weight coefficients can include weight coefficients of load indicators 1 to 8: weight coefficient 1 to weight coefficient 8, and load indicators 1 to 8 each have a maximum indicator value: maximum indicator value 1 to maximum indicator value 8.
[0109] In implementation method 2, for a service instance ij in a service instance cluster i, the load score GlobalScore of the service instance ij can be calculated by the following formula (1): ij :
[0110]
[0111] Among them, w i1 , w i2 , w i3 , w i4 , w i5 , w i6 , w i7 , w i8 It represents the weight coefficient of each load indicator for service instance cluster i, reflecting the relative importance of each load indicator in the decision-making. Indicates the maximum value of ResponseTime among all service instances in service instance cluster i; I won't repeat the similarities. Indicates the maximum value of UpstreamPerformance of all service instances 131 in the previous service cluster i-1 of service instance cluster i. Indicates the maximum value of ownstreamPerformance of all service instances 131 in the next service instance cluster i+1 of service instance cluster i.
[0112] Among them, for the weight coefficient of the load index, the cloud management platform 121 analyzes the target index affecting the quality of the service provided by the service instance cluster 130 in the load index based on the second link tracking data corresponding to the call chain (the link tracking data of the call chain within a period of time, such as 10 minutes, and can also be the first link tracking data), thereby determining the weight coefficient of the service instance cluster 130 for the load index. In specific implementation, the solution for determining the weight coefficient of the service instance cluster 130 for the load index can be specifically:
[0113] Based on the second link tracing data corresponding to the call chain, multiple samples corresponding to the service instance cluster 130 are determined, and each sample in the multiple samples is used to indicate the indicator value of each service instance 131 in the service instance cluster 130 for the load indicator (for the convenience of description and distinction, it can be called the second indicator value); based on the multiple samples, the target indicators in the load indicator that affect the quality of the service instance cluster 130 are analyzed, and the weight coefficient of the service instance cluster 130 for the load indicator is determined.
[0114] In a specific implementation, a performance analysis model corresponding to the service instance cluster 130 may be constructed. The performance analysis model is constructed based on the load index and the weight coefficient of the load index. For example, the performance analysis model may be a linear regression model. The linear regression model may be the above formula (1). The corresponding formula (1) includes the default weight coefficient of the load index: w i1 , w i2 , w i3 , w i4 , w i5 , w i6 , w i7 , w i8 The cloud management platform 121 constructs multiple samples of the service instance cluster 130 through the second link tracking data collected by the APM, trains a linear regression model based on the multiple samples, and modifies the weight coefficient of the load index. For example, based on the multiple samples, the output of the performance analysis model is fixed, and the performance analysis model is trained to analyze the target index in the load index that affects the quality of the service provided by the service instance cluster 130, and the weight coefficient of the target index is adjusted to determine the weight coefficient of the service instance cluster 130 for the load index. Subsequently, the linear regression model can be retrained regularly to dynamically adjust the weight coefficient of the service instance cluster 130 for the load index.
[0115] The specific process of training a linear regression model based on multiple samples can be: the cloud management platform 121 iteratively trains the linear regression model based on multiple samples until the training completion condition is reached. The training completion condition refers to the condition for stopping model training, including but not limited to the number of training iterations reaching the maximum number of iterations, the loss value reaching the preset threshold, and the model parameters no longer changing. It should be noted that the preset threshold is set according to the actual situation and is not limited here. In a specific embodiment, the preset threshold is 0.05. Specifically, the cloud management platform 121 inputs each sample of the multiple samples into the linear regression model to obtain the output of the linear regression model, and determines the loss value corresponding to the sample based on the output of the linear regression model and the preset output value, for example, based on the mean square error algorithm (MSE), obtains the loss of the output of the linear regression model and the preset output value, and the mean square error algorithm (MSE) is a measurement algorithm that reflects the degree of difference between the estimator and the estimated quantity; based on the loss value corresponding to each sample, the weight coefficient of the linear regression model is updated, for example, by using the gradient descent method, to obtain an updated linear regression model; then the updated linear regression model replaces the previous linear regression model, and the next iteration is performed until the training completion condition is met. It should be noted that in the process of training the linear regression model, the cloud management platform 121 substitutes the second indicator value of the performance characteristic of each sample into the linear regression model for load score calculation, and can obtain the loss value of each load score calculation by the gradient descent method. When the loss value reaches the preset threshold, the load score calculation is stopped, thereby obtaining a trained linear regression model.
[0116] Step 403 : When the cloud management platform 121 calls the service instance cluster 130 according to the call chain, the cloud management platform 121 performs load balancing on the service instance cluster 130 based on the load score of each service instance 131 in the service instance cluster 130 for the call chain.
[0117] In some possible implementations, the APM executes steps 401 and 402, and subsequently the APM may send the load score of each service instance 131 in the service instance cluster 130 for the call chain to the ELB. When the ELB calls the service instance cluster 130 according to the call chain, the ELB performs load balancing of the service instance cluster 130 according to the load score of each service instance 131 in the service instance cluster 130 for the call chain. In actual applications, the APM may record the load score of each service instance 131 in the service instance cluster 130 for the call chain through the service instance list of the service instance cluster 130, and the APM sends the service instance list of the service instance cluster 130 to the ELB, and the ELB performs load balancing based on the service instance list of the service instance cluster 130. Figure 8As shown, ELB receives a business request (a call chain is required to implement the business, and the call chain is service 123A calling service 123B). The business request is used to call service 123A. Then ELB performs load balancing of the business request based on the load score of the call chain for each service instance 131 in the service instance cluster 130A of service 123A: the business request is sent to at least one service instance 131 of service 123A; service 123A generates a service call request (for calling service 123B) in response to the business request, and sends the service call request to ELB. ELB performs load balancing of the service call request based on the load score of the call chain for each service instance 131 in the service instance cluster 130B of service 123B: the service call request is sent to at least one service instance 131 of service 123B. It is worth noting that the services requested by business requests for the same call chain should be the same; in actual applications, ELB can store the correspondence between services and call chains, determine the call chain to which the business request belongs based on the business request, and implement load balancing at the call chain granularity; specifically, ELB determines the trace id of the business request and the call chain to which the business request belongs, and the trace id of the business request corresponds to the call chain to which the business request belongs; subsequently, according to the load score of each service instance 131 of the first service 123 in the call chain corresponding to the trace id for the call chain corresponding to the trace id, the business request is allocated to the service instance cluster 130 of the first service 123 in the call chain corresponding to the trace id; for a large number of identical service call requests (including trace id and span id) from the call chain corresponding to the trace id, based on the trace id, the span id (the position of the service 123 in the call chain can be determined), and the call chain corresponding to the trace id, the service instance cluster 130 (span in the call chain) that needs to be called can be determined. A service instance cluster 130 of the next service 123 at the location indicated by the trace id) is used to distribute a large number of identical service call requests to the service instance cluster 130 for load balancing based on the load score of the call chain corresponding to the trace id for each service instance 131 in the service instance cluster 130.
[0118] It should be noted that the higher the load score of the service instance 131 for the call chain, the higher the load. In the subsequent load balancing process, the load of the service instance 131 needs to be reduced to avoid downtime caused by excessive load of the service instance 131. In the embodiment of the present invention, the load can be a business request from a client or a service call request from other services 123.
[0119] In a specific implementation, if the service instance cluster 130 is called concurrently, the ELB determines the load weight of each service instance 131 in the service instance cluster 130 based on the load score of each service instance 131 in the service instance cluster 130 for the call chain, and performs load balancing according to the load weight. A higher load score means a higher load weight and a smaller load is allocated. For example, Figure 9a As shown, the service instance cluster 130 of service i includes service instance i1, service instance i2, service instance i3, service instance i4, and service instance i5, and the corresponding load weights are 10%, 30%, 10%, 30%, and 20%. Assuming that the upstream service of service i initiates 1,000 service call requests, the 1,000 service call requests initiated by the upstream service of service i are distributed to the called service instances i1, i2, i3, i4, and i5, which are 300, 100, 300, 100, and 200, respectively.
[0120] In specific implementation, if a service instance cluster 130 is called once, the ELB determines the target service instance with the lowest load score based on the load score of each service instance 131 in the service instance cluster 130 for the call chain, and distributes the business request from the client or the service call request initiated by the upstream service to the target service instance; it should be noted that if there are multiple service instances with the lowest load scores, one can be randomly selected as the target service instance. For example, Figure 9b As shown, the load scores of service instances i1 and i3 are the same and the highest, so service instance i3 is randomly selected to allocate the service call request.
[0121] In actual applications, APM can determine the available service instances 131 in the service instance cluster 131 based on the load score of each service instance 131 in the service instance cluster 130 for the call chain; in specific implementation, APM can set a load threshold, determine that the service instances with load scores greater than or equal to the load threshold are available, and send the load scores of the available service instances 131 in the service instance cluster 130 for the call chain to the ELB, and when the ELB calls the service instance cluster 130 according to the call chain, the ELB selects the available service instances 131 in the service instance cluster 130 for load balancing. In some other possible implementations, the ELB can determine the available service instances 131 in the service instance cluster 131 based on the load score of each service instance 131 in the service instance cluster 130 for the call chain, and subsequently, when the service instance cluster 130 is called according to the call chain, the available service instances 131 in the service instance cluster 130 are selected for load balancing.
[0122] In this solution, the service instances are load scored according to the performance of the service instances in the call chain, and load balancing is adjusted based on the load scores of the service instances, thereby improving the probability of resource balancing and the stability of service processing.
[0123] Based on the load balancing method provided above, the specific application of the load balancing method is described. Fig.10 A flow chart of a specific application of a load balancing method provided for the implementation of the present invention. Fig.10 The specific contents include:
[0124] Each service instance 131 in the distributed system reports link tracking data to the APM.
[0125] The APM processes the link tracking data according to step 402 to determine the load score of each service instance 131 for the call chain; and sends the load score of each service instance 131 for the call chain to the ELB.
[0126] Based on the load score of each service instance 131 for the call chain, ELB performs load balancing on the business requests from the client and the service call requests sent by the service instance 131 according to the call chain granularity, and distributes the business requests and service call requests to the service instance 131. For details, see Figure 8 , Figure 9a and Figure 9b .
[0127] The present invention also provides a load balancing device, such as Fig.11 As shown, including:
[0128] An acquisition module is used to acquire the first link tracking data corresponding to the call chain; each service in the call chain is deployed as a service instance cluster, and the first link tracking data is used to indicate the operation status and service instance path of each service instance in the service instance cluster, and the service instance path is used to indicate the service instance call path adapted to the call chain;
[0129] The score calculation module is used to determine the load score of each service instance in the service instance cluster for the call chain based on the first link tracking data; the load score is used to load balance the service instance cluster when the service instance cluster is called according to the call chain.
[0130] Among them, the acquisition module and the score calculation module can be implemented by software or by hardware. Exemplarily, the implementation of the acquisition module is introduced below by taking the acquisition module as an example. Similarly, the implementation of the score calculation module can refer to the implementation of the acquisition module.
[0131] As an example of a software functional unit, the acquisition module may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the above-mentioned computing instance may be one or more. For example, the acquisition module may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple data centers with close geographical locations. Among them, usually a region may include multiple AZs.
[0132] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0133] As an example of a hardware functional unit, the acquisition module may include at least one computing device, such as a server, etc. Alternatively, the acquisition module may also be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0134] The multiple computing devices included in the acquisition module can be distributed in the same region or in different regions. The multiple computing devices included in the acquisition module can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the acquisition module can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0135] It should be noted that, in other embodiments, the acquisition module can be used to execute any step in the load balancing method, and the score calculation module can be used to execute any step in the load balancing method. The steps that the acquisition module and the score calculation module are responsible for implementing can be specified as needed. The full functions of the YY device can be realized by respectively implementing different steps in the load balancing method through the acquisition module and the score calculation module.
[0136] The present invention also provides a computing device 1200. Fig.12 As shown, the computing device 1200 includes: a bus 1202, a processor 1204, a memory 1206, and a communication interface 1208. The processor 1204, the memory 1206, and the communication interface 1208 communicate with each other through the bus 1202. The computing device 1200 can be a server or a terminal device. It should be understood that the present invention does not limit the number of processors and memories in the computing device 1200.
[0137] The bus 1202 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.12 The bus 1202 may include a path for transmitting information between various components of the computing device 1200 (eg, the memory 1206, the processor 1204, and the communication interface 1208).
[0138] The processor 1204 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0139] The memory 1206 may include a volatile memory, such as a random access memory (RAM). The processor 1204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0140] The memory 1206 stores executable program codes, and the processor 1204 executes the executable program codes to respectively implement the functions of the aforementioned acquisition module and score calculation module, thereby implementing the load balancing method. That is, the memory 1206 stores instructions for executing the load balancing method.
[0141] The communication interface 1208 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1200 and other devices or communication networks.
[0142] An embodiment of the present invention further provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0143] like Fig.13 As shown, the computing device cluster includes at least one computing device 1200. The memory 1206 in one or more computing devices 1200 in the computing device cluster may store the same instructions for executing the load balancing method.
[0144] In some possible implementations, the memory 1206 of one or more computing devices 1200 in the computing device cluster may also store some instructions for executing the load balancing method. In other words, the combination of one or more computing devices 1200 may jointly execute the instructions for executing the load balancing method.
[0145] It should be noted that the memory 1206 in different computing devices 1200 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the load balancing device. That is, the instructions stored in the memory 1206 in different computing devices 1200 can implement the functions of one or more modules in the acquisition module and the score calculation module.
[0146] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.14 A possible implementation is shown. Fig.14 As shown, two computing devices 1200A and 1200B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 1206 in the computing device 1200A stores instructions for executing the functions of the acquisition module. At the same time, the memory 1206 in the computing device 1200B stores instructions for executing the functions of the score calculation module.
[0147] Fig.14 The connection method between the computing device clusters shown may be that considering that the load balancing method provided by the present invention needs to store a large amount of link tracking data, it is considered to hand over the functions implemented by the score calculation module to the computing device 1200B for execution.
[0148] It should be understood that Fig.14 The functions of the computing device 1200A shown in FIG. 1200A may also be completed by multiple computing devices 1200. Similarly, the functions of the computing device 1200B may also be completed by multiple computing devices 1200.
[0149] The embodiment of the present invention also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes a load balancing method.
[0150] The embodiment of the present invention also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the load balancing method.
[0151] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0152] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0153] The basic principles of the present invention are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present invention are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, rather than limitation, and the above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0154] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0155] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0156] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
[0157] It should be understood that the various numerical numbers involved in the embodiments of the present invention are only used for the convenience of description and are not used to limit the scope of the embodiments of the present invention.
Claims
1. A load balancing method, characterized in that: The method comprises: Obtain first link tracking data corresponding to the call chain; each service in the call chain is deployed as a service instance cluster, the first link tracking data is used to indicate the operation status and service instance path of each service instance in the service instance cluster, and the service instance path is used to indicate the service instance call path adapted to the call chain; Based on the first link tracking data, a load score of each service instance in the service instance cluster for the call chain is determined; the load score is used to load balance the service instance cluster when the service instance cluster is called according to the call chain.
2. The method according to claim 1, characterized in that The determining, based on the first link tracking data, a load score of each service instance in the service instance cluster for the call chain includes: Determining a weight coefficient of the service instance cluster for a load indicator; Determine, based on the first link tracking data, a first indicator value for the load indicator for each service instance in the service instance cluster; Based on the weight coefficient of the service instance cluster for the load indicator and the first indicator value of each service instance in the service instance cluster for the load indicator, a load score of each service instance in the service instance cluster for the call chain is determined.
3. The method according to claim 2, characterized in that The determining, based on the weight coefficient of the service instance cluster for the load indicator and the first indicator value of each service instance in the service instance cluster for the load indicator, a load score of each service instance in the service instance cluster for the call chain includes: Determining a maximum index value of the service instance cluster for the load index based on a first index value of each service instance in the service instance cluster for the load index; Determine a proportion of the load indicator for each service instance in the service instance cluster based on the maximum indicator value of the load indicator and the first indicator value of each service instance in the service instance cluster for the load indicator; Based on the weight coefficient of the service instance cluster for the load indicator and the proportion of each service instance in the service instance cluster for the load indicator, a load score of each service instance in the service instance cluster for the call chain is determined.
4. The method according to claim 2 or 3, characterized in that: Determining the weight coefficient of the service instance cluster for the load indicator includes: Based on the second link tracing data corresponding to the call chain, determine a plurality of samples corresponding to the target service, each sample in the plurality of samples being used to indicate a second indicator value of each service instance in the service instance cluster for the load indicator; Based on the multiple samples, target indicators in the load indicators that affect the service quality provided by the service instance cluster are analyzed, and a weight coefficient of the service instance cluster for the load indicator is determined.
5. The method according to any one of claims 2 to 4, characterized in that: The load indicator includes at least one of the following: The service performance index of the service instance for the call chain, the performance index of the service instance, the load score of the service instance for the upstream service instance of the call chain, and the load score of the service instance for the downstream service instance of the call chain.
6. The method according to claim 5, characterized in that The service performance indicator includes at least one of the following: The number of requests received for the call chain, the response time of calling services according to the call chain, and the error rate of requests for the call chain; The performance indicator of the service instance includes at least one of the following: CPU usage, memory usage, number of exceptions.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Based on the load score of each service instance in the service instance cluster for the call chain, available service instances in the service instance cluster are determined.
8. A load balancing device, characterized in that: The device comprises: An acquisition module is used to acquire first link tracking data corresponding to a call chain; each service in the call chain is deployed as a service instance cluster, the first link tracking data is used to indicate the operation status and service instance path of each service instance in the service instance cluster, and the service instance path is used to indicate a service instance call path adapted to the call chain; A score calculation module is used to determine the load score of each service instance in the service instance cluster for the call chain based on the first link tracking data; the load score is used to load balance the service instance cluster when the service instance cluster is called according to the call chain.
9. The device according to claim 8, characterized in that The score calculation module is used to determine the weight coefficient of the service instance cluster for the load indicator; based on the first link tracking data, determine the first indicator value of each service instance in the service instance cluster for the load indicator; Based on the weight coefficient of the service instance cluster for the load indicator and the first indicator value of each service instance in the service instance cluster for the load indicator, a load score of each service instance in the service instance cluster for the call chain is determined.
10. The device according to claim 9, characterized in that The score calculation module is used to determine the maximum index value of the service instance cluster for the load index based on the first index value of each service instance in the service instance cluster for the load index; Determine a proportion of the load indicator for each service instance in the service instance cluster based on the maximum indicator value of the load indicator and the first indicator value of each service instance in the service instance cluster for the load indicator; Based on the weight coefficient of the service instance cluster for the load indicator and the proportion of each service instance in the service instance cluster for the load indicator, a load score of each service instance in the service instance cluster for the call chain is determined.
11. The device according to claim 9 or 10, characterized in that The score calculation module is used to determine a plurality of samples corresponding to the target service based on the second link tracking data corresponding to the call chain, each sample in the plurality of samples is used to indicate a second indicator value of each service instance in the service instance cluster for the load indicator; Based on the multiple samples, target indicators in the load indicators that affect the service quality provided by the service instance cluster are analyzed, and a weight coefficient of the service instance cluster for the load indicator is determined.
12. The device according to any one of claims 9 to 11, characterized in that: The load indicator includes at least one of the following: The service performance index of the service instance for the call chain, the performance index of the service instance, the load score of the service instance for the upstream service instance of the call chain, and the load score of the service instance for the downstream service instance of the call chain.
13. The device according to any one of claims 8 to 12, characterized in that: The score calculation module is used to determine the available service instances in the service instance cluster based on the load score of each service instance in the service instance cluster for the call chain.
14. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 7.
15. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 7.