Service balancing method, device and equipment

By calculating the processing capacity index and response priority of the server, and selecting the appropriate target server, the problem of prolonged response time and resource waste caused by differences in server load in the cluster is solved, and more efficient load balancing and response speed are achieved.

CN119363752APending Publication Date: 2025-01-24国投融合科技股份有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411276773.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In the prior art, the load differences between different servers in the cluster are large, and the load balancer makes unsatisfactory decisions when allocating requests, resulting in problems such as extended task response time and waste of resources.

Method used

By obtaining the current performance data of multiple available servers, calculating the processing capacity index, and calculating the priority of response according to the processing capacity index and adaptive response time after the server preheats, select the server with the highest priority as the target server for the task execution Essence

Benefits of technology

It shortens the system response time, improves the overall load balance of the system, reduces resource waste, and improves user satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119363752A_ABST
    Figure CN119363752A_ABST
Patent Text Reader

Abstract

The invention provides a service balancing method, device and equipment, and the method comprises the steps: calculating the processing capability index of each available server according to the current performance data under the condition that a plurality of available servers for executing a to-be-requested service task are determined; under the condition that the running duration of the available server exceeds a preheating window period, the response priority of the available server is calculated according to the processing capacity index and the self-adaptive response time of the available server, and the preheating window period is the preheating duration of the available server; and determining the available server with the highest corresponding response priority in the plurality of available servers as a target server to be executed by the service task to be requested. A preheating window period is introduced, a processing capability index is dynamically generated according to a performance state after server preheating is completed, and the server with the highest priority is comprehensively measured and selected in combination with multiple factors such as adaptive response time, so that the response time of the system is shortened, the overall load balance of the system is improved, and the user satisfaction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a service balancing method, device and equipment. Background Art

[0002] With the development of the Internet, business logic is becoming more and more complex, and business data traffic is increasing. The traditional single server solution has the disadvantages of long response time, slow task execution, high risk of single point failure, and poor scalability when executing tasks. Therefore, multiple servers are needed to balance the load of business requests, expand server performance horizontally, improve response time, reduce the risk of single point failure, and increase scalability. Therefore, the microservice architecture came into being and was widely used. The microservice architecture can deploy different business modules of the system separately, split a single system program into a set of fine-grained microservice modules according to business logic, and coordinate calls between each microservice to realize the complex functions of the system. However, as time accumulates, the load of different servers in the cluster varies greatly, and the load of some servers is too high. When the client task needs to respond, if the server node to which the task is assigned has a high load, the response time of the task will be longer, which cannot meet business needs; some servers are idle for too long, resulting in resource waste. Summary of the invention

[0003] The purpose of the present invention is to provide a service balancing method, device and equipment for solving the problem in the prior art that the load differences between different servers in a cluster are large and the load balancer makes undesirable decisions when allocating requests.

[0004] To achieve the above object, an embodiment of the present invention provides a service balancing method, which includes:

[0005] When it is determined that there are multiple available servers for executing the service task to be requested, obtaining current performance data of the multiple available servers;

[0006] Calculating a processing capacity indicator of each of the available servers according to the current performance data;

[0007] When the running time of the available server exceeds the warm-up window period, the response priority of the available server is calculated according to the processing capacity index of the available server and the adaptive response time of the corresponding available server to execute the service task to be requested; wherein the warm-up window period is the warm-up time of the available server;

[0008] The available server with the highest corresponding response priority among the multiple available servers is determined as the target server for executing the service task to be requested.

[0009] Optionally, the method further comprises:

[0010] When the operating time of the available servers does not exceed the preheating window period, obtaining a preheating weight value corresponding to each of the available servers according to the processing capacity indicator, the operating time of the available servers and the preheating window period;

[0011] According to the preheating weight value corresponding to each of the available servers, a target server for executing the service task to be requested is determined; wherein, the available server with a larger preheating weight value has a greater probability of being determined as the target server.

[0012] Optionally, the method, wherein the acquiring the preheating weight value corresponding to each of the available servers according to the processing capacity indicator, the running time of the available servers and the preheating window period, comprises:

[0013] according to Get the preheating weight value Wh i , where runsize is the running time of the available server, warmsize is the warm-up window period, and W i is the processing capability indicator.

[0014] Optionally, the method, wherein determining the target server for executing the service task to be requested according to the preheating weight value corresponding to each of the available servers, comprises:

[0015] According to the preheating weight value, obtaining a probability value of the available server being determined as a target server for executing the service task to be requested;

[0016] A target server for executing the service task to be requested is randomly determined according to the probability value.

[0017] Optionally, the method further comprises:

[0018] After receiving the service task to be requested, obtaining request information according to the service task to be requested;

[0019] Acquire server information of the available server according to the request information;

[0020] The number of available servers is obtained according to the server information.

[0021] Optionally, the method further comprises:

[0022] When it is determined that the number of available servers that execute the service task to be requested is one, the available server is determined to be the target server.

[0023] Optionally, in the method, the step of calculating the processing capacity index of each of the available servers according to the current performance data comprises:

[0024] Determining a corresponding resource utilization rate according to the current performance data of each of the available servers;

[0025] The processing capacity index of each of the available servers is determined based on the resource utilization of each of the available servers and the preset weight values ​​corresponding to different resource utilizations; wherein, when the task types of the requested service tasks are different, the preset weight values ​​corresponding to different resource utilizations are different.

[0026] Optionally, the method, wherein the determining the processing capacity indicator of each of the available servers according to the resource utilization of each of the available servers and preset weight values ​​corresponding to different resource utilizations, comprises:

[0027] Adding the product of different preset weight values ​​of each of the available servers and the current performance data corresponding to the preset weight values ​​to obtain the performance index of each of the available servers;

[0028] Adding the product of different preset weight values ​​of each of the available servers and the resource utilization rate corresponding to the preset weight value to obtain a load index of each of the available servers;

[0029] The ratio of the performance index to the load index of each of the available servers is determined as the processing capacity index.

[0030] Optionally, the method, wherein the calculating the response priority of the available server according to the processing capacity index of the available server and the adaptive response time of the corresponding available server to execute the requested service task, comprises:

[0031] Acquire a performance load indicator according to the processing capability indicator and the current performance data;

[0032] The adaptive response time is obtained according to the average response time and the performance load indicator; wherein the average response time is obtained according to the total execution time of the requested service executed by the available server and the number of requests for the requested service executed by the available server;

[0033] The response priority is obtained according to the adaptive response time and the task activity amount of the task currently executed by the available server.

[0034] Optionally, the method further comprises:

[0035] Sending the requested service task to the target server;

[0036] After the target server completes the requested service task, receiving feedback information sent by the target server;

[0037] The feedback information is sent to the server.

[0038] In order to achieve the above object, an embodiment of the present invention further provides a service balancing device, which includes:

[0039] A first acquisition module is used to acquire current performance data of multiple available servers when it is determined that there are multiple available servers that can execute the service task to be requested;

[0040] A first calculation module, used to calculate the processing capacity index of each of the available servers according to the current performance data;

[0041] A second calculation module is used to calculate the response priority of the available server according to the processing capacity index of the available server and the adaptive response time of the corresponding available server to execute the requested service task when the operating time of the available server exceeds the preheating window period; wherein the preheating window period is the preheating time of the available server;

[0042] The first determining module is used to determine, among the multiple available servers, the available server with the highest corresponding response priority as the target server for executing the service task to be requested.

[0043] In order to achieve the above-mentioned purpose, an embodiment of the present invention also provides a network device, including: a processor, a memory, and a program or instruction stored in the memory and executable on the processor; wherein, when the processor executes the program or instruction, the service balancing method as described above is implemented.

[0044] In order to achieve the above-mentioned purpose, an embodiment of the present invention further provides a readable storage medium on which a program or instruction is stored, wherein the program or instruction, when executed by a processor, implements the steps in the service balancing method as described above.

[0045] In order to achieve the above objective, an embodiment of the present invention further provides a computer program product, which includes computer instructions, and when the computer instructions are executed by a processor, the steps of the service balancing method described above are implemented.

[0046] The beneficial effects of the above technical solution of the present invention are as follows:

[0047] In the case of multiple available servers, the embodiment of the present invention collects their current performance data, calculates the processing capacity index, and when the preheating is completed and the running time exceeds the preheating window period, calculates the response priorities corresponding to the multiple available servers according to the processing capacity index and the adaptive response time, and selects the available server with the highest response priority as the target server for executing the requested service task. By introducing the preheating window period, the processing capacity index is dynamically generated according to the performance status after the server preheating is completed, and the server with the highest priority is selected by combining multiple factors such as the adaptive response time, thereby shortening the system response time, improving the overall load balance of the system, and improving user satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A schematic diagram of a service balancing method according to an embodiment of the present invention;

[0049] Figure 2 One of the flow charts of the service balancing method according to an embodiment of the present invention;

[0050] Figure 3 This is the second flowchart of the service balancing method according to the embodiment of the present invention;

[0051] Figure 4 A schematic diagram of an example of a service balancing method according to an embodiment of the present invention;

[0052] Figure 5 A schematic diagram of a service balancing device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0053] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0054] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present invention. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0055] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the following processes does not 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 embodiments of the present invention.

[0056] Additionally, the terms "system" and "network" are often used interchangeably herein.

[0057] In the embodiments provided by the present invention, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0058] For ease of understanding, some contents involved in the embodiments of the present invention are described below:

[0059] like Figure 1 As shown, a service balancing method according to an embodiment of the present invention includes:

[0060] S10, when it is determined that there are multiple available servers for executing the service task to be requested, obtaining current performance data of the multiple available servers;

[0061] It should be noted that Figure 2 A microservice architecture of the present invention is shown in the figure. In a single system application, a large number of small services that are divided according to business logic and loosely coupled and can be deployed separately are included. These small services can be deployed independently, have limited scope, and support interconnection through lightweight message communication. The load balancing component is a core component in the microservice architecture, which is used to ensure the high availability of the overall architecture. The steps of the present invention are implemented by the load balancing component. Figure 2 As shown, step S10 is to obtain the current performance data of multiple available servers returned by the microservice cluster when it is determined that there are multiple available servers to execute the service task to be requested.

[0062] S20, calculating the processing capacity index of each of the available servers according to the current performance data;

[0063] It should be noted that if Figure 2 As shown, the processing capacity index is obtained through an improved shortest response first algorithm, and then the target server is selected. Figure 3 As shown, step S20 includes "A10, calculating utilization according to performance data; A20, calculating weight according to utilization." The "weight" in this step is the processing capacity indicator.

[0064] S30, when the operating time of the available server exceeds the warm-up window period, calculating the response priority of the available server according to the processing capacity index of the available server and the adaptive response time of the corresponding available server to execute the requested service task; wherein the warm-up window period is the warm-up time of the available server;

[0065] It should be noted that step S30 is Figure 2 The improved shortest response first algorithm is as follows except step S20: Figure 3 "A40, obtain task load information, i.e., task activity; A50, calculate average response time based on historical response data; A60, calculate adaptive response time based on average response time and server performance status; A70, calculate corresponding priority based on task load information and adaptive response time" obtains the response priority of multiple available servers.

[0066] S40, determining, among the multiple available servers, the available server with the highest corresponding response priority as the target server for executing the service task to be requested;

[0067] It should be noted that step S40 is Figure 2 Selected target servers, and Figure 3 In “A100, output selected target server information”, the available server with the highest response priority is used as the target server for executing the service task to be requested.

[0068] Optionally, the method further comprises:

[0069] When the operating time of the available servers does not exceed the preheating window period, obtaining a preheating weight value corresponding to each of the available servers according to the processing capacity indicator, the operating time of the available servers and the preheating window period;

[0070] According to the preheating weight value corresponding to each of the available servers, a target server for executing the service task to be requested is determined; wherein, the available server with a larger preheating weight value has a greater probability of being determined as the target server.

[0071] It should be noted that when it is determined that the current server running time is within the warm-up window period, a weighted random algorithm is executed to randomly obtain the target server according to the weight, that is, Figure 3 The weight in this step is the preheating weight value. As the running time of the available server increases, the calculated preheating weight value becomes closer and closer to W. i From the perspective of actual application scenarios, as the server startup time increases, the traffic it bears will slowly increase, avoiding traffic surges.

[0072] Optionally, the method, wherein the acquiring the preheating weight value corresponding to each of the available servers according to the processing capacity indicator, the running time of the available servers and the preheating window period, comprises:

[0073] according to Get the preheating weight value Wh i, where runsize is the running time of the available server, warmsize is the warm-up window period, and W i is the processing capability indicator.

[0074] It should be noted that, in the above-mentioned formula of the preheating weight value, the longer the running time of a certain available server is, the larger the preheating weight value is, so that in the random selection algorithm, the possibility of determining it as the target server is greater.

[0075] Optionally, the method, wherein determining the target server for executing the service task to be requested according to the preheating weight value corresponding to each of the available servers, comprises:

[0076] According to the preheating weight value, obtaining a probability value of the available server being determined as a target server for executing the service task to be requested;

[0077] A target server for executing the service task to be requested is randomly determined according to the probability value.

[0078] It should be noted that the sum of the preheating weight values ​​corresponding to the multiple available servers is set to 1, the ratio of each preheating weight value to the sum is set to the probability value, and the target server of the requested service task is determined according to the probability value. In addition, in the case of restarting a server due to a failure, the running time of multiple servers is different, and some may be within the preheating window period and some may be outside the preheating window period. In such a case, all of them adopt the selection method outside the preheating window period.

[0079] Optionally, the method further comprises:

[0080] After receiving the service task to be requested, obtaining request information according to the service task to be requested;

[0081] It should be noted that, assuming that service A sends a request task T to the load balancing component, the load balancing component analyzes the request data to obtain the request information that needs to be called, and concludes that the service type for executing task T is microservice s. Figure 2 As shown, after service A sends a task request, that is, sends the service task to be requested, the load balancing component executes "B10, analyze the request data, and obtain the interface information to be called", that is, the service task to be requested obtains the request information, and then sends a query request to the service registration center. After the service registration center queries the available services according to the interface information, it returns the service result set to the load balancing component.

[0082] Acquire server information of the available server according to the request information;

[0083] It should be noted that Figure 2In "B20, return service result set" is to obtain the server information of the available server. Assume that the microservices s are deployed in {S 1 ,S 2 ,…S n}, where S i Represents a server in the cluster. The load balancing component sends a request to the service registration center to query whether there is an available server based on the service type. The set of available servers is represented by TS.

[0084] The number of available servers is obtained according to the server information.

[0085] It should be noted that Figure 2 “B30, determine whether there are multiple services” is to obtain the number of available servers according to the server information.

[0086] Optionally, the method further comprises:

[0087] In a case where it is determined that the number of available servers that execute the service task to be requested is one, determining the available server as the target server;

[0088] It should be noted that Figure 2 In the "B40, equal to 1 to obtain server information", when it is determined that there is only one available server, the only available server is directly determined as the target server. When there is no available service, that is, TS is empty, a reply message is returned; when there is an available service, a server set TS={S 1 ,S 2 ,…S n}. When the number of available services is equal to 1, that is, length(TS)=1, directly select S 1 Execute task T.

[0089] Optionally, in the method, the step of calculating the processing capacity index of each of the available servers according to the current performance data comprises:

[0090] Determining a corresponding resource utilization rate according to the current performance data of each of the available servers;

[0091] It should be noted that when the number of available services is greater than 1, that is, length (TS)>1, the load balancing algorithm is used to select the target server. First, the resource usage of each server is collected in real time according to the cluster monitoring. Then the load balancing component obtains the current resource usage information from the cluster monitoring component for the calculation of different dynamic load balancing algorithms. Query the server S from the microservice cluster monitoring service according to the service result set i Performance indicators and current resource usage status. Obtaining performance indicators includes: memory usage Umi 、Memory remaining amount Fm i , Disk usage Ud i 、Disk remaining capacity Fd i 、CPU idle time Fc i 、CPU usage time Uc i Calculate resource utilization based on performance indicators. Assume that CPU utilization C i 、Memory utilization M i , Disk Utilization D i , which can reflect the execution capability of the server. The calculation formula is as follows:

[0092]

[0093] That is Figure 3 In step A10, the utilization rate is calculated according to the performance data.

[0094] Determine the processing capacity index of each of the available servers according to the resource utilization rate of each of the available servers and the preset weight values ​​corresponding to different resource utilization rates; wherein when the task types of the to-be-requested service tasks are different, the preset weight values ​​corresponding to different resource utilization rates are different;

[0095] It should be noted that the preset weight value is initialized according to the task type. Assume that the CPU weight is Wc i , memory weight Wm i , disk Wd i If the task type is computationally intensive, then Wc i >Wm i >Wd i ; If the task type is I / O intensive, then Wd i >Wm i >Wc i ; If the task type is data-intensive, then Wm i >Wc i >Wd i After setting the preset weight value, execute the following Figure 3 In step A20 shown, a weight is calculated according to the utilization rate, and the weight in this step is the processing capacity index.

[0096] Optionally, the method, wherein the determining the processing capacity indicator of each of the available servers according to the resource utilization of each of the available servers and preset weight values ​​corresponding to different resource utilizations, comprises:

[0097] Adding the product of different preset weight values ​​of each of the available servers and the current performance data corresponding to the preset weight values ​​to obtain the performance index of each of the available servers;

[0098] It should be noted that the formula of the performance indicator is as follows:

[0099] P i =Wc i (Fc i +Uc i )+Wm i (Fm i +Um i )+Wd i (Fd i +Ud i ).

[0100] Adding the product of different preset weight values ​​of each of the available servers and the resource utilization rate corresponding to the preset weight value to obtain a load index of each of the available servers;

[0101] It should be noted that the formula of the load index is as follows:

[0102] L i =Wc i C i +Wm i M i +Wd i D i .

[0103] Determine the ratio of the performance index to the load index of each of the available servers as the processing capacity index;

[0104] It should be noted that the formula of the processing capability index is as follows:

[0105] W i =P i / L i .

[0106] Optionally, the method, wherein the calculating the response priority of the available server according to the processing capacity index of the available server and the adaptive response time of the corresponding available server to execute the requested service task, comprises:

[0107] Acquire a performance load indicator according to the processing capability indicator and the current performance data;

[0108] It should be noted that the current performance data includes the number of requests that the available server has executed for the requested service. Assume that R represents the total number of system requests, R i It represents the number of requests assigned to the i-th server, that is, the number of requests for which the requested service has been executed. The calculation formula of the performance load indicator is as follows:

[0109]

[0110] The adaptive response time is obtained according to the average response time and the performance load indicator; wherein the average response time is obtained according to the total execution time of the requested service executed by the available server and the number of requests for the requested service executed by the available server;

[0111] It should be noted that, assuming that the total execution time of the executed request service of the i-th server is T i , the average response time is TA i Among them, TA i =T i / R i .

[0112] That is, the average response time of the available servers that meet the conditions is {TA 1 ,TA 2 …TA n},According to the historical average response time and the current server performance and load status, obtain the adaptive response time RT i To evaluate the responsiveness of the service, the formula is as follows:

[0113] RT i =TA i Wp i .

[0114] That is, execute Figure 3 Step A50 shown calculates the average response time based on historical response data, and step A60 calculates the adaptive response time based on the average response time and the server performance status.

[0115] Acquire the response priority according to the adaptive response time and the task activity of the currently executed task of the available server;

[0116] It should be noted that when a task arrives at the server, the new task needs to wait for the task being executed. Therefore, considering the task waiting time, the task activity of the current server is used as one of the factors for calculating the response priority. It not only reflects the load of the current server, but also determines the task queue time. The task activity Ai of the current server is obtained through the consumer-side filter ActiveLimitFilterr (client-side current limiting) to reduce the task waiting time. Figure 3 In step A40, task load information, i.e., task activity, is obtained. Assume that the response priority of the service is RS i The calculation formula is as follows:

[0117] RS i =RT i Ai .

[0118] Execute as Figure 3 Step A70 shown in FIG. 1 calculates the corresponding priority according to the task load information and the adaptive response time. The server with the highest response priority is selected as the target server, that is, Smax=max(RS 1 ,RS 2 ,…,RS n ). In addition, if Figure 3 Step A80 shown is to determine whether the number of servers with the highest priority is 1. If it is greater than 1, step A90 is adopted, and a weight-based random selection algorithm is used; if it is equal to 1, step A100 is adopted to output the selected target server information.

[0119] Optionally, the method further comprises:

[0120] Sending the requested service task to the target server;

[0121] After the target server completes the requested service task, receiving feedback information sent by the target server;

[0122] The feedback information is sent to the server.

[0123] In this embodiment, after determining the target server, the following is performed: Figure 2 In step C10 shown, a task request is sent to the microservice cluster. According to the server Smax with the highest priority calculated, the load balancing component sends the task T to the selected designated server Smax, and uses the designated server Smax to execute the task, that is, sending the requested service task to the target server. After the target server completes the execution of the requested service task, feedback information sent by the target server is received, that is, after the target server completes the execution, the feedback information is sent to the load balancing component. The feedback information is sent to the server, that is, the load balancing component returns it to the requesting service A.

[0124] It should be noted that an embodiment of the service balancing method described in the present invention is now provided and implemented in a radio and television channel management system. The radio and television channel management system involves multiple functional modules with complex services. The single service deployment results in slow response speed. Once a server fails, all functions cannot be used, and there is a risk of single point failure. The number of servers is fixed. When the data traffic surges, the server has no expansion and cannot undertake a large number of interface tasks; when the traffic decreases, the server is idle, wasting server performance. The shortest response time algorithm used by the current gateway service ignores the service performance status and only uses the single indicator of response time as the evaluation criterion. When selecting the target server to execute the task, there are problems of load imbalance and insufficient utilization of server hardware.

[0125] Therefore, it is necessary to adopt Figure 4 The channel management system software architecture shown:

[0126] 1. Client request.

[0127] Users can access the system through the web-based channel management system page.

[0128] 2. Entry gateway.

[0129] The request first arrives at the entry gateway cluster. The cluster is responsible for performing authentication authorization, load balancing, caching and other services. The service registry helps the API gateway or other microservices find the location of the target microservice instance. The entry gateway uses a load balancing algorithm to route the request to a specific microservice based on the content of the request (such as URL path, request method, etc.). Each microservice focuses on a specific business function or field. The channel management system microservice modules are divided into: gateway service module, process service module, system function module, authority authentication module, file service module, channel management module, business management module, data report module, large screen display module, and development tool module.

[0130] 3. Process the request.

[0131] After receiving the request, the target microservice executes the business logic related to the request. This may involve operations such as calculation, data processing, and external API calls. For example, the file service module involves a large number of I / O intensive operations. Microservices usually need to access databases or other storage systems to obtain or store data. Each microservice may have its own independent data storage space (such as MYSQL database, REDIS database, etc.). After the target microservice processes the request, it generates response data. The response may include request results, status information, error messages, etc. The response data is returned to the client through the gateway.

[0132] 4. Recording and monitoring.

[0133] The system records request and response logs for monitoring, debugging, auditing, and subsequent response time calculation. The logs may include request details, processing time, error information, etc. The system monitors the health and performance indicators of microservices and triggers alerts to respond to potential problems or performance bottlenecks.

[0134] The above embodiments can produce the following beneficial effects:

[0135] 1) Availability. Using a microservice architecture improves system availability by distributing traffic to multiple service instances and prevents a single instance from being overloaded.

[0136] 2) Reliability. If an instance fails, the load balancer can forward requests to other instances that are working properly, thereby reducing the risk of single point failure in the system.

[0137] 3) Scalability. When the load increases, more instances are automatically added; when the load decreases, instances are automatically reduced. This dynamic adjustment helps the system use resources efficiently.

[0138] 4) Interactivity: Reduce interface response time, quickly respond to user operations, and improve user experience and satisfaction.

[0139] 5) Resource utilization. Reduce excessive load inclination, ensure that effective resources can be fully utilized, avoid service overload or idleness, and improve resource utilization.

[0140] like Figure 5 As shown, in order to achieve the above purpose, an embodiment of the present invention further provides a service balancing device, which includes:

[0141] The first acquisition module 501 is used to acquire current performance data of multiple available servers when it is determined that there are multiple available servers that can execute the service task to be requested;

[0142] A first calculation module 502, configured to calculate a processing capability index of each of the available servers according to the current performance data;

[0143] The second calculation module 503 is used to calculate the response priority of the available server according to the processing capacity index of the available server and the adaptive response time of the corresponding available server to execute the requested service task when the operating time of the available server exceeds the preheating window period; wherein the preheating window period is the preheating time of the available server;

[0144] The first determining module 504 is configured to determine, among the plurality of available servers, the available server with the highest corresponding response priority as the target server for executing the service task to be requested.

[0145] Optionally, the device further comprises:

[0146] A second acquisition module is used to acquire a preheating weight value corresponding to each of the available servers according to the processing capacity indicator, the running time of the available servers and the preheating window period when the running time of the available servers does not exceed the preheating window period;

[0147] The second determination module is used to determine the target server that executes the requested service task according to the preheating weight value corresponding to each of the available servers; wherein, the larger the preheating weight value of the available server is, the greater the probability that it is determined as the target server.

[0148] Optionally, in the device, the second acquisition module includes:

[0149] The first acquisition unit is used to Get the preheating weight value Wh i , where runsize is the running time of the available server, warmsize is the warm-up window period, and W i is the processing capability indicator.

[0150] Optionally, in the device, the second determining module includes:

[0151] A second acquisition unit is used to acquire, according to the preheating weight value, a probability value of the available server being determined as a target server for executing the service task to be requested;

[0152] The first determining unit is used to randomly determine a target server that executes the service task to be requested according to the probability value.

[0153] Optionally, the device further comprises:

[0154] A third acquisition module is used to acquire request information according to the service task to be requested after receiving the service task to be requested;

[0155] A fourth acquisition module, configured to acquire server information of the available server according to the request information;

[0156] A fifth acquisition module is used to acquire the number of available servers according to the server information.

[0157] Optionally, the device further comprises:

[0158] The third determination module is used to determine that the available server is the target server when it is determined that the number of available servers that execute the service task to be requested is one.

[0159] Optionally, in the device, the first calculation module 502 includes:

[0160] A second determining unit, configured to determine a corresponding resource utilization rate according to the current performance data of each of the available servers;

[0161] The third determination unit is used to determine the processing capacity indicator of each of the available servers based on the resource utilization of each of the available servers and the preset weight values ​​corresponding to different resource utilizations; wherein, when the task type of the requested service task is different, the preset weight values ​​corresponding to different resource utilizations are different.

[0162] Optionally, in the device, the third determining unit includes:

[0163] A first acquisition component is used to add the product of different preset weight values ​​of each of the available servers and the current performance data corresponding to the preset weight value to obtain the performance index of each of the available servers;

[0164] A second acquisition component is used to add the product of different preset weight values ​​of each of the available servers and the resource utilization rate corresponding to the preset weight value to obtain the load index of each of the available servers;

[0165] The first determining component is used to determine the ratio of the performance index and the load index of each of the available servers as the processing capacity index.

[0166] Optionally, in the method, the second calculation module 503 includes:

[0167] A third acquisition unit, configured to acquire a performance load indicator according to the processing capability indicator and the current performance data;

[0168] A fourth acquisition unit is used to acquire the adaptive response time according to the average response time and the performance load indicator; wherein the average response time is acquired according to the total execution time of the executed request service of the available server and the number of requests for the executed request service of the available server;

[0169] A fifth acquisition unit is used to acquire the response priority according to the adaptive response time and the task activity of the task currently executed by the available server.

[0170] Optionally, the device further comprises:

[0171] A first sending module, used for sending the service task to be requested to the target server;

[0172] A first receiving module, configured to receive feedback information sent by the target server after the target server completes the service task to be requested;

[0173] The second sending module is used to send the feedback information to the server.

[0174] In order to achieve the above-mentioned purpose, an embodiment of the present invention also provides a network device, including: a processor, a memory, and a program or instruction stored in the memory and executable on the processor; wherein, when the processor executes the program or instruction, the service balancing method as described above is implemented.

[0175] In order to achieve the above-mentioned purpose, an embodiment of the present invention further provides a readable storage medium on which a program or instruction is stored, wherein the program or instruction, when executed by a processor, implements the steps in the service balancing method as described above.

[0176] The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0177] It should be further explained that the terminals described in this specification include but are not limited to smart phones, tablet computers, etc., and many of the functional components described are called modules in order to more particularly emphasize the independence of their implementation methods.

[0178] In the embodiment of the present invention, module can be implemented with software so that it can be executed by various types of processors. For example, an executable code module of an identification can include one or more physical or logical blocks of computer instructions, for example, it can be constructed as an object, process or function. Nevertheless, the executable code of the identified module does not need to be physically located together, but can include different instructions stored in different positions, and when these instructions are logically combined together, it constitutes a module and realizes the specified purpose of the module.

[0179] In fact, executable code module can be a single instruction or many instructions, and can even be distributed on a plurality of different code segments, distributed among different programs, and distributed across a plurality of memory devices. Similarly, operating data can be identified in the module, and can be implemented and organized in the data structure of any appropriate type according to any appropriate form. The operating data can be collected as a single data set, or can be distributed in different locations (including on different storage devices), and can only be present on a system or network as an electronic signal at least in part.

[0180] When a module can be implemented by software, considering the level of existing hardware technology, a person skilled in the art can build a corresponding hardware circuit to implement the corresponding function of the module that can be implemented by software without considering the cost. The hardware circuit includes a conventional very large scale integration (VLSI) circuit or gate array and existing semiconductors such as logic chips, transistors, or other discrete components. The module can also be implemented by a programmable hardware device, such as a field programmable gate array, a programmable array logic, a programmable logic device, etc.

[0181] In order to achieve the above-mentioned purpose, an embodiment of the present invention further provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, the various processes of the embodiment of the service balancing method as described above are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0182] The above exemplary embodiments are described with reference to the accompanying drawings, and many different forms and embodiments are feasible without departing from the spirit and teachings of the present invention. Therefore, the present invention should not be constructed as a limitation of the exemplary embodiments proposed herein. More specifically, these exemplary embodiments are provided so that the present invention will be perfect and complete, and the scope of the present invention will be conveyed to those who are familiar with the technology. In these figures, the component sizes and relative sizes may be exaggerated for clarity. The terms used here are only based on the purpose of describing specific exemplary embodiments and are not intended to be limiting. As used herein, unless the text clearly indicates otherwise, the singular forms "one", "an" and "the" are intended to include these multiple forms. It will be further understood that the terms "including" and / or "comprising" when used in this specification indicate the presence of the features, integers, steps, operations, components and / or components, but do not exclude the presence or increase of one or more other features, integers, steps, operations, components, components and / or their groups. Unless otherwise indicated, when stated, a range of values ​​includes the upper and lower limits of that range and any subranges therebetween.

[0183] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A service balancing method, characterized in that: include: When it is determined that there are multiple available servers for executing the service task to be requested, obtaining current performance data of the multiple available servers; Calculating a processing capacity indicator of each of the available servers according to the current performance data; When the running time of the available server exceeds the warm-up window period, the response priority of the available server is calculated according to the processing capacity index of the available server and the adaptive response time of the corresponding available server to execute the service task to be requested; wherein the warm-up window period is the warm-up time of the available server; The available server with the highest corresponding response priority among the multiple available servers is determined as the target server for executing the service task to be requested.

2. The method according to claim 1, characterized in that The method further comprises: When the operating time of the available servers does not exceed the preheating window period, obtaining a preheating weight value corresponding to each of the available servers according to the processing capacity indicator, the operating time of the available servers and the preheating window period; According to the preheating weight value corresponding to each of the available servers, a target server for executing the service task to be requested is determined; wherein, the available server with a larger preheating weight value has a greater probability of being determined as the target server.

3. The method according to claim 2, characterized in that The step of obtaining a preheating weight value corresponding to each of the available servers according to the processing capability indicator, the running time of the available servers and the preheating window period includes: according to Get the preheating weight value Wh i , where runsize is the running time of the available server, warmsize is the warm-up window period, and W i is the processing capability indicator.

4. The method according to claim 2, characterized in that: The step of determining a target server for executing the service task to be requested according to the preheating weight value corresponding to each of the available servers includes: According to the preheating weight value, obtaining a probability value of the available server being determined as a target server for executing the service task to be requested; A target server for executing the service task to be requested is randomly determined according to the probability value.

5. The method according to claim 1, characterized in that The method further comprises: After receiving the service task to be requested, obtaining request information according to the service task to be requested; Acquire server information of the available server according to the request information; The number of available servers is obtained according to the server information.

6. The method according to claim 1 or 5, characterized in that: The method further comprises: When it is determined that the number of available servers that execute the service task to be requested is one, the available server is determined to be the target server.

7. The method according to claim 1, characterized in that The step of calculating the processing capability index of each of the available servers according to the current performance data includes: Determining a corresponding resource utilization rate according to the current performance data of each of the available servers; The processing capacity index of each of the available servers is determined based on the resource utilization of each of the available servers and the preset weight values ​​corresponding to different resource utilizations; wherein, when the task types of the requested service tasks are different, the preset weight values ​​corresponding to different resource utilizations are different.

8. The method according to claim 7, characterized in that Determining the processing capacity index of each of the available servers according to the resource utilization of each of the available servers and preset weight values ​​corresponding to different resource utilizations includes: Adding the product of different preset weight values ​​of each of the available servers and the current performance data corresponding to the preset weight values ​​to obtain a performance indicator of each of the available servers; Adding the product of different preset weight values ​​of each of the available servers and the resource utilization rate corresponding to the preset weight value to obtain a load index of each of the available servers; The ratio of the performance index to the load index of each of the available servers is determined as the processing capacity index.

9. The method according to claim 1, characterized in that: The calculating the response priority of the available server according to the processing capability index of the available server and the adaptive response time of the corresponding available server to execute the service task to be requested includes: Acquire a performance load indicator according to the processing capability indicator and the current performance data; The adaptive response time is obtained according to the average response time and the performance load indicator; wherein the average response time is obtained according to the total execution time of the requested service executed by the available server and the number of requests for the requested service executed by the available server; The response priority is obtained according to the adaptive response time and the task activity amount of the task currently executed by the available server.

10. The method according to claim 1, characterized in that The method further comprises: Sending the requested service task to the target server; After the target server completes the requested service task, receiving feedback information sent by the target server; The feedback information is sent to the server.

11. A service balancing device, characterized in that: include: A first acquisition module is used to acquire current performance data of multiple available servers when it is determined that there are multiple available servers that can execute the service task to be requested; A first calculation module, used to calculate the processing capacity index of each of the available servers according to the current performance data; A second calculation module is used to calculate the response priority of the available server according to the processing capacity index of the available server and the adaptive response time of the corresponding available server to execute the requested service task when the operating time of the available server exceeds the preheating window period; wherein the preheating window period is the preheating time of the available server; The first determining module is used to determine, among the multiple available servers, the available server with the highest corresponding response priority as the target server for executing the service task to be requested.

12. A network device comprising: A processor, a memory, and a program or instruction stored in the memory and executable on the processor; characterized in that when the processor executes the program or instruction, the service balancing method as described in any one of claims 1-10 is implemented.

13. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the steps in the service balancing method according to any one of claims 1 to 10 are implemented.

14. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the service balancing method according to any one of claims 1 to 10.

Citation Information

Cited By

  • Method for realizing hotel distribution intelligent order following based on enterprise private domain knowledge

    CN120088095A