A server-side balancing method and related components
By dynamically updating the weight P and average utilization rate W of the server side in the server-side combination selection, the problem of unbalanced resource utilization in the existing technology is solved, and balanced utilization of all servers and efficient utilization of resources is achieved.
Patent Information
- Application Number
- CN202111169563.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2041-09-30
AI Technical Summary
The prior art is difficult to achieve balanced utilization of all servers when selecting the server combination, resulting in waste of resources.
By selecting N servers from M servers to form a server-side combination, and dynamically updates based on the weight P and average utilization rate W of the server, ensuring balanced utilization of all server-side combinations.
The balanced utilization of all servers is achieved, and the waste of server resources is avoided to the greatest extent.
Smart Images

Figure CN114020449B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of balancing technology, and in particular to a server-side balancing method and related components. Background Art
[0002] In a server-client architecture system, there are M servers with different IP addresses, and the K clients to be served need to select a combination of K servers to provide services for them to meet the needs of users. For each client, N servers need to be selected from the M servers to form a server combination to provide services for it, where N≤M, and finally a server combination solution serving K clients is obtained.
[0003] In the prior art, the following two methods are usually used to select a server combination:
[0004] One is to select a fixed server combination including N servers from M servers, and then use the fixed server combination to provide services to K clients. However, when N < M, this method will result in the remaining servers not being fully utilized, resulting in a waste of resources.
[0005] The other is to select N servers from a certain server among M servers for each client, starting from the first client, to provide services for it. There is no requirement for which server to start from, and so on, until all K clients have completed the selection, a server combination solution serving K clients can be obtained. However, because there is no requirement for which server to start from, it is very likely that N servers will be selected from a fixed server, so this method is still likely to have an unbalanced utilization of the M servers, resulting in a waste of resources. Summary of the invention
[0006] The purpose of the present invention is to provide a server balancing method and related components, which, compared with the server combination selection method in the prior art, achieves balanced utilization of all servers and avoids waste of server resources to the greatest extent.
[0007] In order to solve the above technical problems, the present invention provides a server-side balancing method, comprising:
[0008] S11: Select N server ends from the M server ends to form a server end combination, the number of the server end combination is , the initial value of the weight P corresponding to each server is 0, the initial value of the average utilization rate W of all servers when each server combination is selected is 0, M and N are both integers not less than 2, and N≤M;
[0009] S12: Selecting one server combination from all the server combinations and providing it to a target client;
[0010] S13: Determine whether a server combination has been provided for all target clients, if so, proceed to S16, otherwise, proceed to S14;
[0011] S14: updating P=P+1 corresponding to each server in the selected server combination, and determining W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers, where W is negatively correlated with the average utilization of all servers;
[0012] S15: Select a server combination corresponding to the smallest W from the W of all the remaining server combinations when the server combinations are selected, and provide it to a target client that is not provided with the server combination, and return to S13;
[0013] S16: End the allocation of the server combination.
[0014] Preferably, before determining whether a server combination has been provided for all target clients, the method further includes:
[0015] Add 1 to the combined weight O corresponding to the selected server combination; wherein the initial value of the combined weight O corresponding to each server combination = 0;
[0016] After updating P=P+1 corresponding to each server in the selected server combination, the method further includes:
[0017] When O corresponding to all the server combinations are the same, determine all the server combinations as all the remaining server combinations;
[0018] When O corresponding to all the server combinations are not the same, the server combination corresponding to the smallest O among all the server combinations is determined as all the remaining server combinations.
[0019] Preferably, determining W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers includes:
[0020] When the i-th remaining server combination is selected, 1≤i≤the number of all remaining server combinations, perform the following steps:
[0021] Based on the preset average utilization relationship, the W of all servers when the i-th remaining server combination is selected is obtained;
[0022] The preset average utilization relationship W=A+(BM*A) / C;
[0023] Where A is the minimum value of P corresponding to M servers after P+1 corresponding to each server in the i-th remaining server combination;
[0024] B is the sum of P corresponding to M servers after P+1 corresponding to each server in the i-th remaining server combination;
[0025] C is the larger of the number of servers greater than A in P corresponding to the M servers and 1 after P+1 corresponding to each server in the i-th remaining server combination.
[0026] Preferably, after selecting N server ends from the M server ends to form a server end combination, the method further includes:
[0027] for The server combination number;
[0028] Selecting a server combination corresponding to the smallest W from the W of all servers when all remaining server combinations are selected and providing it to a target client that is not provided with the server combination, comprising:
[0029] When it is determined that the number of server combinations corresponding to the smallest W among the W of all the remaining server combinations is 1, providing the server combination corresponding to the smallest W to a target client that is not provided with a server combination;
[0030] When it is determined that there are multiple server combinations corresponding to the minimum W in the W of all server combinations when all remaining server combinations are selected, the server combination corresponding to the minimum W and with the smallest number is provided to a target client that is not provided with a server combination.
[0031] Preferably, after providing the server combination for all target clients, the method further includes:
[0032] Determine the average usage times of all servers = number of clients * N / M.
[0033] Preferably, after determining the average usage times of all servers, the method further includes:
[0034] The control display module displays the average usage times.
[0035] In order to solve the above technical problems, the present invention also provides a server-side balancing system, comprising:
[0036] A server combination determination unit is used to select N servers from M servers to form a server combination, and the number of the server combination is , the initial value of the weight P corresponding to each server is 0, the initial value of the average utilization rate W of all servers when each server combination is selected is 0, M and N are both integers not less than 2, and N≤M;
[0037] A first selection unit, configured to select one server combination from all the server combinations and provide it to a target client;
[0038] A judging unit, used to judge whether a server combination has been provided for all target clients;
[0039] A processing unit, configured to update P=P+1 corresponding to each server in the selected server combination when it is determined that no server combination is provided for all target clients, and determine W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers, where W is negatively correlated with the average utilization of all servers;
[0040] A second selection unit is used to select a server combination corresponding to the smallest W from the W of all the remaining server combinations when the server combinations are selected, and provide it to a target client that is not provided with the server combination, and trigger the judgment unit;
[0041] The ending unit is used to end the allocation of the server combination when it is determined that the server combination has been provided to all target clients.
[0042] In order to solve the above technical problems, the present invention further provides a computer-readable storage medium, comprising:
[0043] The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the server-side balancing method described above are implemented.
[0044] In order to solve the above technical problems, the present invention further provides a server-side balancing device, comprising:
[0045] Memory for storing computer programs;
[0046] The processor is used to execute the steps of the server-side balancing method as described above.
[0047] In order to solve the above technical problem, the present invention also provides a server, including the server-side balancing device as described above.
[0048] The present invention provides a server balancing method and related components. For all target clients to be served, N server ends are first selected from M server ends to form a server balancing method. server combinations, and then select one server combination from all server combinations to provide to a target client. If there is only one target client to be served, the allocation of server combinations is terminated; otherwise, the P corresponding to each server in the selected server combination is updated to P+1, and the W of all the remaining server combinations when they are selected is determined based on the updated P corresponding to all the servers, and a server combination corresponding to the smallest W is selected from the W of all the remaining server combinations when they are selected and provided to a target client that has not been provided with a server combination, and this scheme is followed until server combinations are provided for all target clients, and then the allocation of server combinations is terminated. Compared with the method for selecting server combinations in the prior art, this scheme achieves balanced utilization of all servers and avoids waste of server resources to the greatest extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the prior art and the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0050] Figure 1 A flow chart of a server-side balancing method provided by the present invention;
[0051] Figure 2 A schematic diagram of the structure of a server-side balancing system provided by the present invention;
[0052] Figure 3 A schematic diagram of the structure of a server-side balancing device provided by the present invention. DETAILED DESCRIPTION
[0053] The core of the present invention is to provide a server balancing method and related components, which, compared with the server combination selection method in the prior art, realizes balanced utilization of all servers and avoids waste of server resources to the greatest extent.
[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] Please refer to Figure 1 , Figure 1A flow chart of a server-side balancing method provided by the present invention.
[0056] The server-side balancing method includes:
[0057] S11: Select N servers from M servers to form a server combination. The number of server combinations is , the initial value of the weight P corresponding to each server is 0, the initial value of the average utilization W of all servers when each server combination is selected is 0, M and N are both integers not less than 2, and N≤M;
[0058] S12: Selecting a server combination from all server combinations and providing it to a target client;
[0059] S13: Determine whether a server combination has been provided for all target clients, if so, proceed to S16, otherwise, proceed to S14;
[0060] S14: updating P=P+1 corresponding to each server in the selected server combination, and determining W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers, where W is negatively correlated with the average utilization of all servers;
[0061] S15: Select a server combination corresponding to the smallest W from the W of all the remaining server combinations when the server combinations are selected, and provide it to a target client that is not provided with the server combination, and return to S13;
[0062] S16: End the allocation of the server combination.
[0063] In this embodiment, considering that K target clients to be served need to select K server combinations to provide services for them, for each target client, N server combinations need to be selected from M server combinations to form a server combination for use. The method for selecting a server combination in the prior art cannot achieve balanced utilization of the M server combinations, resulting in a waste of resources.
[0064] To solve the above technical problems, the present application proposes a server balancing method, firstly, N servers are selected from M servers to form a server combination, where the number of server combinations is Then, one server combination is selected from all server combinations and provided to a target client. The server combination selected here can be any group of server combinations among all server combinations, or the server combination with the smallest number after all server combinations are numbered in advance. This application does not make any special limitation here. Subsequently, it is determined whether a server combination has been provided for all target clients. If so, it means that the number of all target clients to be served is 1, that is, K=1, and server combinations have been provided for all target clients, then the allocation of server combinations is terminated; otherwise, the P corresponding to each server in the selected server combination is updated to P=P+1, where the initial value of the weight P corresponding to each server=0; based on the updated P corresponding to all servers, the W of all servers when all remaining server combinations are selected can be determined. Here, W is negatively correlated with the average utilization of all servers, that is, the smaller W is, the better the average utilization of all servers is. Subsequently, a server combination corresponding to the smallest W is selected from the W of all servers when all remaining server combinations are selected, and provided to a target client that has not been provided with the server combination. The present application does not specifically limit to which server that has not been provided with the server combination the selected server combination is provided. Thereafter, the process returns to the step of determining whether the server combination has been provided for all target clients, until the provision of the server combination for all target clients is completed in accordance with the steps in the method, and the allocation of the server combination is terminated.
[0065] Specifically, take M=5, N=3, K=3 as an example to illustrate the server balancing method provided by the present application. Each server has a different IP address. For the sake of distinction, the IP addresses of the five servers are 1, 2, 3, 4, and 5, respectively. The initial value of the weight P corresponding to the five servers can be expressed as (0, 0, 0, 0, 0). The number of server combinations consisting of three servers selected from the five servers is All server combinations include (1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5), (2, 3, 4), (2, 3, 5), (2, 4, 5), (3, 4, 5). Therefore, (1, 2, 3) is selected from all server combinations and provided to a target client. Of course, other server combinations can also be selected from all server combinations, and this application does not make any special limitation here. Then determine whether server combinations have been provided for all target clients. Obviously, at this time, a server combination is only provided for one target client. Therefore, P=P+1 corresponding to each server in the selected server combination is updated. At this time, the updated P corresponding to all servers can be expressed as (1, 1, 1, 0, 0). Based on the updated P corresponding to all servers, the W of all servers when all remaining server combinations are selected are determined, and a server combination corresponding to the smallest W is selected from these Ws and provided to a target client that has not been provided with the server combination. Return to the step of determining whether server combinations have been provided for all target clients until the service combinations for all target clients are completed according to the steps in the method, and the allocation of server combinations is ended.
[0066] It should be noted that the server balancing method provided in this application is not affected by the number of clients. Moreover, based on the K server combinations previously provided for the K target clients, when the number of subsequent target clients increases or decreases, executing the steps in this method can still ensure balanced utilization of the M servers.
[0067] The present application provides a server balancing method, which achieves balanced utilization of all servers compared to the server combination selection method in the prior art, and avoids waste of server resources to the greatest extent.
[0068] Based on the above embodiments:
[0069] As a preferred embodiment, before determining whether the server combination has been provided for all target clients, the method further includes:
[0070] Add 1 to the combined weight O corresponding to the selected server combination; wherein the initial value of the combined weight O corresponding to each server combination = 0;
[0071] After updating P=P+1 corresponding to each server in the selected server combination, it also includes:
[0072] When O corresponding to all server combinations are the same, all server combinations are determined as all remaining server combinations;
[0073] When O corresponding to all server combinations are not the same, a server combination corresponding to the smallest O among all server combinations is determined as all remaining server combinations.
[0074] In this embodiment, in order to determine all remaining server combinations, the application introduces a combination weight O corresponding to all server combinations, and all remaining server combinations are determined based on O corresponding to all server combinations.
[0075] Specifically, the initial value of the combination weight O corresponding to each server combination = 0. Before determining whether a server combination has been provided for all target clients, the combination weight O corresponding to the server combination selected to be provided to a target client is increased by 1 to indicate that the server combination has been selected once. Therefore, after the step of updating P = P + 1 corresponding to each server in the selected server combination, when the O corresponding to all server combinations are the same, it means that all server combinations have been selected the same number of times at this time, and all server combinations are determined as all remaining server combinations; when the O corresponding to all server combinations are not the same, it means that the number of times all server combinations are selected is not balanced at this time, and the server combination corresponding to the smallest O among all server combinations is determined as all remaining server combinations.
[0076] With reference to the example in the above embodiment, the process of determining all the remaining server combinations is described: at this time, only one target client is provided with a server combination (1, 2, 3). Therefore, before determining whether the server combination has been provided for all target clients, the combination weight O corresponding to the server combination (1, 2, 3) is increased by 1, that is, O=0+1=1. At this time, the combination weights O corresponding to other server combinations are all 0, and the minimum value of O is 0. Therefore, all the remaining server combinations are determined to be (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5), (2, 3, 4), (2, 3, 5), (2, 4, 5), (3, 4, 5).
[0077] It can be seen that in this way, all remaining server combinations can be simply and effectively determined, so that corresponding calculations can be performed for all remaining server combinations later.
[0078] As a preferred embodiment, determining W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers includes:
[0079] When the i-th remaining server combination is selected, 1≤i≤the number of all remaining server combinations, perform the following steps:
[0080] Based on the preset average utilization relationship, the W of all servers when the i-th remaining server combination is selected is obtained;
[0081] The preset average utilization relationship W=A+(BM*A) / C;
[0082] Where A is the minimum value of P corresponding to M servers after P+1 corresponding to each server in the i-th remaining server combination;
[0083] B is the sum of P corresponding to M servers after P+1 corresponding to each server in the i-th remaining server combination;
[0084] C is the larger of the number of servers greater than A in P corresponding to the M servers and 1 after P+1 corresponding to each server in the i-th remaining server combination.
[0085] In this embodiment, in order to determine the W of all servers when all remaining server combinations are selected, a preset average utilization relationship is proposed in the present application. When the i-th remaining server combination is selected, the W of all servers when the i-th remaining server combination is selected can be obtained based on the preset average utilization relationship, and then the W of all servers when all remaining server combinations are selected can be obtained.
[0086] Specifically, for the example in the above embodiment, the process of determining W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers is described: after (1, 2, 3) has been selected from all server combinations and provided to a target client, the updated P corresponding to all servers is represented as (1, 1, 1, 0, 0), and the remaining server combinations include (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5), (2, 3, 4), (2, 3, 5), (2, 4, 5), (3, 4, 5). Taking the remaining server combination (1, 2, 4) as an example, the process of determining W of all servers when (1, 2, 4) is selected is described:
[0087] First, we need to determine A, B, and C in the preset average utilization relationship. After P+1 corresponding to each server in (1, 2, 4), the P corresponding to the M servers can be expressed as (2, 2, 1, 1, 0). Therefore, A=0, B=6, and C=4 in the preset average utilization relationship, and we can get W=0+(6-5*0) / 4=1.5. According to this determination process, we can get the W of all servers when all the remaining server combinations are selected, that is:
[0088] When (1, 2, 5) is selected, the corresponding W of all servers is 1.5;
[0089] When (1, 3, 4) is selected, the corresponding W of all servers is 1.5;
[0090] When (1, 3, 5) is selected, the corresponding W of all servers is 1.5;
[0091] When (1, 4, 5) is selected, W = 2 for all servers;
[0092] When (2, 3, 4) is selected, the corresponding W of all servers is 1.5;
[0093] When (2, 3, 5) is selected, the corresponding W of all servers is 1.5;
[0094] When (2, 4, 5) is selected, W = 2 for all servers;
[0095] When (3, 4, 5) is selected, W=2 for all servers.
[0096] It can be seen that this method can simply and effectively determine the W of all servers when all remaining server combinations are selected, so as to facilitate the subsequent selection of server combinations.
[0097] As a preferred embodiment, after selecting N server ends from M server ends to form a server end combination, the method further includes:
[0098] for A server combination number;
[0099] Selecting a server combination corresponding to the smallest W from the W of all servers when all remaining server combinations are selected and providing it to a target client that is not provided with the server combination, including:
[0100] When it is determined that the number of server combinations corresponding to the smallest W among all the server combinations when all the remaining server combinations are selected is 1, the server combination corresponding to the smallest W is provided to a target client that is not provided with the server combination;
[0101] When the number of server combinations corresponding to the minimum W is determined to be multiple among the W of all server combinations when all remaining server combinations are selected, the server combination corresponding to the minimum W and with the smallest number is provided to a target client that is not provided with a server combination.
[0102] In this application, after selecting N servers from M servers to form a server combination, server combination numbers, so when the number of server combinations corresponding to the smallest W is determined to be 1 among the W of all the servers when all the remaining server combinations are selected, the server combination corresponding to the smallest W is provided to a target client that has not been provided with the server combination; when the number of server combinations corresponding to the smallest W is determined to be multiple among the W of all the servers when all the remaining server combinations are selected, the server combination corresponding to the smallest W and with the smallest number is provided to a target client that has not been provided with the server combination.
[0103] Specifically, for the example in the above embodiment, it is explained that a server combination corresponding to the smallest W is selected from the W of all the remaining server combinations when all the server combinations are selected and provided to a target client that has not been provided with the server combination. All server combinations are numbered (1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5), (2, 3, 4), (2, 3, 5), (2, 4, 5), (3, 4, 5), that is, numbered from 10 to 10 in sequence. According to the previously calculated W of all the servers when all the remaining server combinations are selected, the minimum value of W is 1.5, which is the same as the minimum value. There are multiple server combinations corresponding to small W, namely (1, 2, 4) numbered 11, (1, 2, 5) numbered 12, (1, 2, 5) numbered 13, (1, 3, 4) numbered 14, (1, 3, 5) numbered 16, (2, 3, 4) numbered 17, so the smallest number (1, 2, 4) corresponding to the smallest W is provided to a target client that is not provided with a server combination.
[0104] It should be noted that here, the server combination corresponding to the minimum W and with the smallest number can be provided to a target client that has not been provided with a server combination, or the server combination corresponding to the minimum W and with the largest number can be provided to a target client that has not been provided with a server combination. This application does not make any special limitations here.
[0105] It can be seen that this method can simply and reliably implement the selection of a server combination corresponding to the smallest W based on the W of all servers when all remaining server combinations are selected and provide it to a target client that is not provided with a server combination, thereby achieving balanced utilization of all servers.
[0106] To facilitate understanding of the solution, let's take M=8, N=4, K=6, where K is the number of target clients, as an example:
[0107] The IP addresses of the 8 servers are 1, 2, 3, 4, 5, 6, 7, and 8 respectively. The available combinations are: kind.
[0108] For the first time, the combination of (1, 2, 3, 4) is provided to the first target client. The combined weight O of this server combination is 1, and the corresponding weights P of all servers are (1, 1, 1, 1, 0, 0, 0, 0), W = 0 + (4-0) / 4 = 1.
[0109] For the second time, assuming (1,2,3,5) is provided, the corresponding weight P of all servers is (2,2,2,1,1,0,0,0), W=0+(8-0) / 5=1.6, which is not the minimum W. Until the server combination (5,6,7,8) is (1,1,1,1,1,1,1,1,1), the corresponding weight P of all servers is (1,1,1,1,1,1,1,1), W=1, which can be provided to the second target client.
[0110] For the third time, assuming (1, 2, 4, 5) is provided, the corresponding weights P of all servers are (2, 2, 1, 2, 2, 1, 1, 1), W = 1 + (12-8*1) / 4 = 2, which is the minimum W and can be provided to the third target client.
[0111] For the fourth time, assuming (2, 3, 4, 5) is provided, the corresponding weight P of all servers is (2, 3, 2, 3, 3, 1, 1, 1), W = 1 + (16-8*1) / 5 = 2.6, which is not the minimum value of W. Until (3, 6, 7, 8) is provided, the corresponding weight P of all servers is (2, 2, 2, 2, 2, 2, 2), W = 2 + (16-8*2) / 1 = 2, which can be provided to the fourth target client.
[0112] And so on, until K combinations are obtained, the average number of times each server is used is T = 6*4 / 8 = 3.
[0113] As a preferred embodiment, after providing the server combination for all target clients, the method further includes:
[0114] Determine the average usage times of all servers = number of clients * N / M.
[0115] In this embodiment, in order to determine the usage balance of all servers by the server balancing method, after providing server combinations for all target clients, the average usage times of all servers is determined = the number of clients * N / M, so as to better display the usage balance of all servers in the form of data.
[0116] As a preferred embodiment, after determining the average usage times of all the servers, the method further includes:
[0117] The control display module displays the average usage times.
[0118] In this embodiment, in order to more intuitively show the usage balance of all servers, after determining the average usage times of all servers in this application, the processor will also control the display module to display the average usage times.
[0119] In addition, the processing module may also control the display module to display W of all the servers corresponding to the selected server combinations, which is not particularly limited in the present application.
[0120] It can be seen that this method shows the usage of all servers by displaying the average number of times all servers are used, which more intuitively shows the balance of usage of all servers.
[0121] Please refer to Figure 2 , Figure 2 A schematic diagram of the structure of a server-side balancing system provided by the present invention.
[0122] The server-side balancing system includes:
[0123] The server combination determination unit 21 is used to select N servers from M servers to form a server combination. The number of server combinations is , the initial value of the weight P corresponding to each server is 0, the initial value of the average utilization W of all servers when each server combination is selected is 0, M and N are both integers not less than 2, and N≤M;
[0124] A first selection unit 22, configured to select a server combination from all server combinations and provide it to a target client;
[0125] A judging unit 23, used to judge whether a server combination has been provided for all target clients;
[0126] The processing unit 24 is used to update P=P+1 corresponding to each server in the selected server combination when it is determined that no server combination is provided for all target clients, and determine W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers, where W is negatively correlated with the average utilization of all servers;
[0127] The second selection unit 25 is used to select a server combination corresponding to the smallest W from the W of all the remaining server combinations when the server combinations are selected, and provide it to a target client that is not provided with the server combination, and trigger the judgment unit;
[0128] The ending unit 26 is used to end the allocation of the server combination when it is determined that the server combination has been provided for all target clients.
[0129] For an introduction to the server-side balancing system provided by the present invention, please refer to the above-mentioned server-side balancing method embodiment, and the present invention will not be repeated here.
[0130] The present invention also provides a computer-readable storage medium, comprising:
[0131] A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the server-side balancing method described above are implemented.
[0132] For an introduction to the computer-readable storage medium provided by the present invention, please refer to the above-mentioned server-side balancing method embodiment, and the present invention will not be repeated here.
[0133] Please refer to Figure 3 , Figure 3 A schematic diagram of the structure of a server-side balancing device provided by the present invention.
[0134] The server-side balancing device comprises:
[0135] A memory 31, used for storing computer programs;
[0136] The processor 32 is used to execute the steps of the server-side balancing method as described above.
[0137] For an introduction to the server-side balancing device provided by the present invention, please refer to the above-mentioned server-side balancing method embodiment, and the present invention will not be repeated here.
[0138] The present invention also provides a server, comprising the server-side balancing device as described above.
[0139] The server can be a personal computer, a server computer, a handheld or portable device, a large, medium or small computer.
[0140] For an introduction to the server provided by the present invention, please refer to the above-mentioned server-side balancing method embodiment, and the present invention will not be repeated here.
[0141] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0142] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0143] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0144] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A server-side balancing method, characterized in that: include: S11: Select N servers from the M servers to form a server combination, the number of which is C. M N , the initial value of the weight P corresponding to each server is 0, the initial value of the average utilization rate W of all servers when each server combination is selected is 0, M and N are both integers not less than 2, and N≤M; S12: Selecting one server combination from all the server combinations and providing it to a target client; S13: Determine whether a server combination has been provided for all target clients, if so, proceed to S16, otherwise, proceed to S14; S14: updating P=P+1 corresponding to each server in the selected server combination, and determining W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers, where W is negatively correlated with the average utilization of all servers; S15: Select a server combination corresponding to the smallest W from the W of all the remaining server combinations when the server combinations are selected, and provide it to a target client that is not provided with the server combination, and return to S13; S16: End the allocation of the server combination; The step of determining W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers includes: When the i-th remaining server combination is selected, 1≤i≤the number of all remaining server combinations, perform the following steps: Based on the preset average utilization relationship, the W of all servers when the i-th remaining server combination is selected is obtained; The preset average utilization relationship W=A+(BM*A) / C; Where A is the minimum value of P corresponding to M servers after P+1 corresponding to each server in the i-th remaining server combination; B is the sum of P corresponding to M servers after P+1 corresponding to each server in the i-th remaining server combination; C is the larger of the number of servers greater than A in P corresponding to the M servers and 1 after P+1 corresponding to each server in the i-th remaining server combination.
2. The server-side balancing method according to claim 1, characterized in that: Before determining whether the server combination has been provided for all target clients, it also includes: Add 1 to the combined weight O corresponding to the selected server combination; wherein the initial value of the combined weight O corresponding to each server combination = 0; After updating P=P+1 corresponding to each server in the selected server combination, the method further includes: When O corresponding to all the server combinations are the same, determine all the server combinations as all the remaining server combinations; When O corresponding to all the server combinations are not the same, the server combination corresponding to the smallest O among all the server combinations is determined as all the remaining server combinations.
3. The server-side balancing method according to claim 1, characterized in that: After N servers are selected from M servers to form a server combination, it also includes: for The server combination number; Selecting a server combination corresponding to the smallest W from the W of all servers when all remaining server combinations are selected and providing it to a target client that is not provided with the server combination, comprising: When it is determined that the number of server combinations corresponding to the smallest W among the W of all the remaining server combinations is 1, providing the server combination corresponding to the smallest W to a target client that is not provided with a server combination; When it is determined that there are multiple server combinations corresponding to the minimum W in the W of all server combinations when all remaining server combinations are selected, the server combination corresponding to the minimum W and with the smallest number is provided to a target client that is not provided with a server combination.
4. The server-side balancing method according to any one of claims 1 to 3, characterized in that: After the server has been assembled for all target clients, it also includes: Determine the average usage times of all servers = number of clients * N / M.
5. The server-side balancing method according to claim 4, characterized in that: After determining the average usage of all servers, it also includes: The control display module displays the average usage times.
6. A server-side balancing system, characterized in that: include: A server combination determination unit is used to select N servers from M servers to form a server combination, and the number of the server combination is The initial value of the weight P corresponding to each server is 0, the initial value of the average utilization rate W of all servers when each server combination is selected is 0, M and N are both integers not less than 2, and N≤M; A first selection unit, configured to select one server combination from all the server combinations and provide it to a target client; A judging unit, used to judge whether a server combination has been provided for all target clients; A processing unit, configured to update P=P+1 corresponding to each server in the selected server combination when it is determined that no server combination is provided for all target clients, and determine W of all servers when all remaining server combinations are selected based on the updated P corresponding to all servers, where W is negatively correlated with the average utilization of all servers; A second selection unit is used to select a server combination corresponding to the smallest W from the W of all the remaining server combinations when the server combinations are selected, and provide it to a target client that is not provided with the server combination, and trigger the judgment unit; A termination unit, used for terminating the allocation of the server combination when it is determined that the server combination has been provided for all target clients; The processing unit is specifically configured to execute the following steps when the i-th remaining server combination is selected, 1≤i≤the number of all remaining server combinations: Based on the preset average utilization relationship, the W of all servers when the i-th remaining server combination is selected is obtained; The preset average utilization relationship W=A+(BM*A) / C; Where A is the minimum value of P corresponding to M servers after P+1 corresponding to each server in the i-th remaining server combination; B is the sum of P corresponding to M servers after P+1 corresponding to each server in the i-th remaining server combination; C is the larger of the number of servers greater than A in P corresponding to the M servers and 1 after P+1 corresponding to each server in the i-th remaining server combination.
7. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the server-side balancing method according to any one of claims 1 to 5 are implemented.
8. A server-side balancing device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the steps of the server-side balancing method as described in any one of claims 1 to 5.
9. A server, characterized in that: It includes the server-side balancing device as described in claim 8.
Citation Information
Patent Citations
Server load balancing method and device, storage medium and equipment
CN111679912A
Load balancing method and system for service cluster
CN111930523A