Server determination method and apparatus, electronic device, medium, and server cluster

CN116760831BActive Publication Date: 2026-09-15SHAANXI LANGCHAO YINGXIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310538603.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-12
Publication Date
2026-09-15
Estimated Expiration
2043-05-12

AI Technical Summary

Benefits of technology

[0062] This application provides a method for determining a server, relating to the field of data processing. In this scheme, multiple performance index values ​​corresponding to each server in a server cluster are obtained; the overall pressure of each server is calculated based on these performance index values; and a target server is determined based on the overall pressure of each server, so that the target server can execute a preset task. As can be seen, this application calculates the overall pressure of each server in the server cluster using multiple index values, and then determines the target server based on the overall pressure. By taking the overall pressure of the servers into account, servers with lower overall pressure can be selected to complete the preset task, thereby ensuring the stability of the server cluster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116760831B_ABST
    Figure CN116760831B_ABST
Patent Text Reader

Abstract

The application discloses a kind of determination method, device, electronic equipment, medium and server cluster of server, involve data processing field.The scheme, the multiple performance index values corresponding to each server in server cluster are obtained;According to the comprehensive stress of each server, the target server is determined according to the performance index value corresponding to each server, to use target server to execute preset task.It can be seen that the comprehensive stress of each server in server cluster is calculated by the multiple index values of server in the application, and then the target server is determined according to the comprehensive stress, the comprehensive stress of server is considered, and the server with smaller comprehensive stress can be selected to complete preset task, so as to ensure the stability of server cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular to a method, apparatus, electronic device, medium, and server cluster for determining a server. Background Technology

[0002] A storage server cluster consists of multiple servers, and typically a master server is needed to synchronously distribute server management logic to the other servers in the cluster. Currently, the master server is selected either randomly or by choosing a fixed server. However, the selected master server may be under heavy load, which could lead to slower processing speeds and poorer stability. Summary of the Invention

[0003] The purpose of this application is to provide a method, apparatus, electronic device, medium, and server cluster for determining a server, selecting the main server with the lowest overall pressure to complete a preset task, thereby ensuring the processing speed and stability of the main server.

[0004] To address the aforementioned technical problems, this application provides a method for determining a server, comprising:

[0005] Obtain multiple performance metric values ​​corresponding to each of the servers in the server cluster;

[0006] Calculate the overall pressure on each server based on the performance index values ​​corresponding to each server;

[0007] The target server is determined based on the overall load of each of the servers, and the target server is used to perform a preset task.

[0008] In some embodiments, obtaining multiple performance metric values ​​corresponding to each server in the server cluster includes:

[0009] Obtain the current usage value and upper limit value of each performance metric in each of the aforementioned servers.

[0010] In some embodiments, after obtaining the current usage value and upper limit value of each performance metric in each of the servers, the method further includes:

[0011] Calculate the utilization rate of each performance indicator based on its current and upper limit values;

[0012] The overall stress on each server is calculated based on the performance metric values ​​corresponding to each server, including:

[0013] The overall pressure on each server is calculated based on the utilization rate corresponding to each performance indicator.

[0014] In some embodiments, calculating the utilization rate corresponding to each performance indicator based on its current usage value and upper limit value includes:

[0015] The ratio of the current usage value to the upper limit value of each performance indicator is taken as the usage rate corresponding to the performance indicator.

[0016] In some embodiments, obtaining multiple performance metric values ​​corresponding to each server in the server cluster further includes:

[0017] Obtain the upper limit value of each of the aforementioned performance metrics across all servers in the server cluster;

[0018] The weight of each performance metric is calculated based on its upper limit across all servers.

[0019] In some embodiments, the weight of each performance metric is calculated based on its upper limit across all servers, including:

[0020] The ratio of the sum of the upper limits of the performance metric across all servers to the upper limit on the current server is used as the weight of the performance metric on the current server.

[0021] In some embodiments, the overall stress of each server is calculated based on the performance metric values ​​corresponding to each server, including:

[0022] The overall pressure on each server is calculated based on the weight of each performance metric in the current server and the utilization rate corresponding to each performance metric.

[0023] In some embodiments, the performance metrics are one or more combinations of the following: the number of connections to the transmission control protocol of each server, the amount of CPU usage, the amount of memory usage, and the amount of bandwidth usage.

[0024] In some embodiments, when the performance metric is the number of connections using the Transmission Control Protocol (TCP), obtaining the current usage value and upper limit value of each performance metric in each of the servers includes:

[0025] Obtain the system memory and currently used memory of the server;

[0026] The upper limit of the number of connections for each transmission control protocol is determined based on the system memory of the server and the memory consumed by each transmission control protocol.

[0027] The current usage value of the number of connections for each Transmission Control Protocol is determined based on the current memory used by the server and the memory consumed by each Transmission Control Protocol.

[0028] In some embodiments, when the performance metric is the usage of the central processing unit, obtaining the current usage value and upper limit value of each performance metric in each of the servers includes:

[0029] Obtain the highest frequency and number of cores of the central processing unit, and calculate the upper limit of the usage of the central processing unit based on the highest frequency and the number of cores;

[0030] Obtain the utilization rate of the central processing unit (CPU) and calculate the current usage of the CPU based on the CPU utilization rate.

[0031] In some embodiments, the overall stress of each server is calculated based on the performance metric values ​​corresponding to each server, including:

[0032] The pressure value corresponding to each performance index value is calculated based on the performance index value;

[0033] The overall stress of the server is calculated based on the stress values ​​corresponding to each performance indicator.

[0034] In some embodiments, the calculation of the stress value corresponding to each performance index value includes:

[0035] The product of the utilization rate and the weight of each performance indicator is used as the pressure value corresponding to the performance indicator.

[0036] In some embodiments, the overall stress of the server is calculated based on the stress values ​​corresponding to each performance indicator, including:

[0037] The sum of the stress values ​​corresponding to each of the aforementioned performance indicators is taken as the overall stress of the server.

[0038] In some embodiments, the process of performing a preset task includes:

[0039] Receive server management logic and distribute the server management logic to each server in the server cluster.

[0040] In some embodiments, a target server is determined based on the overall load of each of the servers, and the target server is used to perform a preset task, including:

[0041] The server with the lowest overall pressure is determined as the target server based on the overall pressure of each of the servers, and the target server is used to execute the preset task.

[0042] In some embodiments, before obtaining the multiple performance metric values ​​corresponding to each server in the server cluster, the method further includes:

[0043] Determine whether the server cluster meets the preset triggering conditions;

[0044] If the conditions are met, proceed to the step of obtaining multiple performance metric values ​​corresponding to each of the servers in the server cluster.

[0045] In some embodiments, determining whether the server cluster meets a preset triggering condition includes:

[0046] Determine whether to add or remove servers from the server cluster;

[0047] If a server is added or removed, the preset triggering condition is determined to be met.

[0048] In some embodiments, determining whether the server cluster meets a preset triggering condition includes:

[0049] Determine whether the difference between the time when the last time the values ​​of multiple performance indicators corresponding to each server in the server cluster were obtained and the current time has reached a preset time interval.

[0050] If the condition is met, it is determined that the preset triggering condition is satisfied.

[0051] In some embodiments, determining whether the server cluster meets a preset triggering condition includes:

[0052] When the server cluster is initialized, it is determined that the preset triggering condition is met.

[0053] To address the aforementioned technical problems, this application also provides a server determining device, comprising:

[0054] A performance indicator value acquisition unit is used to acquire multiple performance indicator values ​​corresponding to each of the servers in the server cluster.

[0055] The comprehensive stress calculation unit is used to calculate the comprehensive stress of each server based on the performance index values ​​corresponding to each server.

[0056] The server determination unit is used to determine the target server based on the overall pressure of each of the servers, so as to use the target server to perform a preset task.

[0057] To address the aforementioned technical problems, this application also provides an electronic device, comprising:

[0058] Memory, used to store computer programs;

[0059] A processor for implementing the steps of the server determination method as described above when storing a computer program.

[0060] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the server determination method described above.

[0061] To address the aforementioned technical problems, this application also provides a server cluster, including the electronic devices and multiple servers as described above.

[0062] This application provides a method for determining a server, relating to the field of data processing. In this scheme, multiple performance index values ​​corresponding to each server in a server cluster are obtained; the overall pressure of each server is calculated based on these performance index values; and a target server is determined based on the overall pressure of each server, so that the target server can execute a preset task. As can be seen, this application calculates the overall pressure of each server in the server cluster using multiple index values, and then determines the target server based on the overall pressure. By taking the overall pressure of the servers into account, servers with lower overall pressure can be selected to complete the preset task, thereby ensuring the stability of the server cluster.

[0063] This application also provides a server determination device, electronic device, medium, and server cluster, which have the same beneficial effects as the server determination method described above. Attached Figure Description

[0064] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the prior art and embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0065] Figure 1 A flowchart illustrating a method for determining a server provided in this application;

[0066] Figure 2 A flowchart illustrating another method for determining a server provided in this application;

[0067] Figure 3 A structural block diagram of a server determination device provided in this application;

[0068] Figure 4 A structural block diagram of an electronic device provided in this application;

[0069] Figure 5 A structural block diagram of a computer-readable storage medium provided in this application. Detailed Implementation

[0070] The core of this application is to provide a method, apparatus, electronic device, medium, and server cluster for determining a server, selecting the main server with the lowest overall pressure to complete a preset task, thereby ensuring the processing speed and stability of the main server.

[0071] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0072] Please refer to Figure 1 , Figure 1 A flowchart illustrating a method for determining a server provided in this application, the method comprising:

[0073] S11: Obtain multiple performance metric values ​​for each server in the server cluster;

[0074] The design concept of this application is as follows: calculate the overall stress value of all servers in the server cluster, and select a target server to execute a preset task based on the overall stress value. Specifically, in this embodiment, the overall stress is calculated based on the values ​​of multiple performance indicators of the server under its current state. Therefore, in this step, it is necessary to first obtain the multiple performance indicator values ​​of each server.

[0075] As a preferred embodiment, multiple performance metric values ​​corresponding to each server in the server cluster are obtained, including:

[0076] Get the current usage value and upper limit value of each performance metric in each server.

[0077] Considering that different servers may have different upper limits for permissible performance metrics, for servers with large upper limits, if only the current usage value of a certain performance metric is considered without taking into account the corresponding upper limit value for that performance metric on that server, a large current usage value does not necessarily mean a large stress level for that server, and the overall stress of the server cannot be accurately calculated. Therefore, to accurately determine the overall stress of the server, this application obtains both the current usage value and the upper limit value for each performance metric when acquiring performance metric values, and determines the overall stress of the server based on the upper limit value and the current usage value.

[0078] The current usage value represents the amount of data the server requires / uses in its current operating state. The upper limit value is the maximum value allowed for this performance metric on the server. The upper limit value can be a fixed value preset based on the server's hardware, while the current value changes as the server's operating state changes.

[0079] For example, calculating the overall stress of a server involves n metrics, where the upper limits of these n performance metrics are m1, ..., m2, ..., m3. j ..., m n The current usage values ​​of the n performance metrics are: n1, ..., n j ... n n .

[0080] As a preferred embodiment, the performance indicators are one or more combinations of the following: the number of connections of the transmission control protocol of each server, the amount of CPU usage, the amount of memory usage, and the amount of bandwidth usage.

[0081] Specifically, the higher the current number of connections in the Transmission Control Protocol (TCP), the greater the stress level corresponding to that performance metric; the higher the current CPU usage, the greater the stress level corresponding to that performance metric; the higher the current memory usage, the greater the stress level corresponding to that performance metric; similarly, the higher the current bandwidth usage, the greater the stress level corresponding to that performance metric.

[0082] As a preferred embodiment, when the performance metric is the number of connections in the Transmission Control Protocol (TCP), the current usage value and upper limit value of each performance metric in each server are obtained, including:

[0083] Get the server's system memory and currently used memory;

[0084] The upper limit of the number of connections for each transmission control protocol is determined based on the server's system memory and the memory consumed by each transmission control protocol.

[0085] The current usage of the number of connections for each Transmission Control Protocol (TCP) is determined based on the server's current memory usage and the memory consumed by each TCP.

[0086] Specifically, when the aforementioned performance metric is the number of Transmission Control Protocol (TCP) connections on the server, the upper limit of the TCP connection count is obtained as follows: The server's system memory is obtained, the system memory required for each TCP connection is obtained, and the upper limit of the TCP connection count is calculated based on the server's system memory and the system memory required for each TCP connection. Specifically, the upper limit T of the TCP connection count... max= Server's system memory / System memory required for each Transmission Control Protocol (TCP) connection. The current usage value of the TCP is obtained by retrieving the server's current memory usage. In this case, the current usage value of the TCP = Server's current memory usage / System memory required for each TCP connection.

[0087] The current number of connections can also be queried using the server's system command "netstat".

[0088] The above is just one specific implementation method provided in this embodiment, and is not limited to the example above.

[0089] As a preferred embodiment, when the performance metric is the usage of the central processing unit, the current usage value and upper limit value of each performance metric in each server are obtained, including:

[0090] Obtain the highest frequency and number of cores of the central processing unit (CPU), and calculate the upper limit of CPU usage based on the highest frequency and number of cores;

[0091] Get the CPU utilization rate and calculate the current CPU usage based on the CPU utilization rate.

[0092] Specifically, when the performance metric is CPU usage, the upper limit of CPU usage is obtained as follows: The highest CPU frequency (H) and number of cores (C) are obtained, and then the upper limit of CPU usage is calculated based on these parameters. The upper limit of CPU usage is P. max =H*C. The highest CPU frequency H and number of cores C can be obtained by querying the CPU's highest frequency H and number of cores C using the server's system command "lscpu". The current CPU usage can be obtained by determining the CPU's utilization rate; specifically, by querying the maximum utilization rate Q using the system command "top", and then calculating the current CPU usage based on the utilization rate Q and the number of cores C.

[0093] The above is just one specific implementation method provided in this embodiment, and is not limited to the example above.

[0094] When the performance metric is bandwidth usage, the current bandwidth usage is obtained by querying the current bandwidth usage using the system command "iftop"; the upper limit of bandwidth usage is obtained by querying the upper limit of bandwidth usage using the system command "speedtest-cli".

[0095] Similarly, when the performance metric is memory usage, the current usage and the upper limit of usage are obtained through system commands. The specific system commands used will not be described in detail here.

[0096] Furthermore, the performance metrics that need to be obtained depend on the specific server cluster and / or the application scenario.

[0097] The above are just a few implementation methods provided in this embodiment. The selection of performance indicators is not limited to the above set, and can also be other performance indicators, which will not be listed here.

[0098] S12: Calculate the overall pressure on each server based on the corresponding performance index values;

[0099] Specifically, after obtaining the various performance index values, it is necessary to calculate the overall pressure of each server based on the obtained performance index values, so as to compare the overall pressure of multiple servers and then determine the target server to execute the preset task.

[0100] As a preferred embodiment, after obtaining the current usage value and upper limit value of each performance indicator in each server, the method further includes:

[0101] Calculate the utilization rate of each performance indicator based on its current and upper limit values;

[0102] The overall stress on each server is calculated based on its corresponding performance metrics, including:

[0103] The overall pressure on each server is calculated based on the utilization rate corresponding to each performance indicator.

[0104] This embodiment aims to provide a specific implementation method for calculating the utilization rate corresponding to performance indicators. Specifically, after obtaining the current utilization value and upper limit value of each performance indicator, the utilization rate corresponding to the performance indicator can be calculated based on the current utilization value and the upper limit value. The specific method for calculating the utilization rate is as follows: the ratio of the current utilization value to the upper limit value of each performance indicator is used as the utilization rate corresponding to the performance indicator. The higher the utilization rate of a performance indicator, the greater the pressure on that performance indicator; therefore, the overall pressure on the server can be calculated through the utilization rate.

[0105] The upper limits of the n performance metrics obtained above are m1, ..., m j ..., m n The current usage values ​​of the n performance metrics are: n1, ..., n j ... n n At this point, the utilization rates of the corresponding n performance indicators are: n1 / m1, ..., n j / m j ... n n / m n .

[0106] As a preferred embodiment, obtaining multiple performance metric values ​​corresponding to each server in the server cluster further includes:

[0107] Obtain the upper limit values ​​of each performance metric across all servers in the server cluster;

[0108] The weight of each performance metric is calculated based on its upper limit across all servers.

[0109] Specifically, after determining the utilization rate of each performance indicator, the indicator weight of each performance indicator is also calculated. The indicator weight represents the proportion of the current server's performance indicator in the entire server cluster. Therefore, it is also necessary to obtain the upper limit of the performance indicator in all servers in the server cluster, and then calculate the indicator weight of the performance indicator in the current server based on the upper limit of the performance indicator in the current server and the upper limit of the performance indicator in all servers.

[0110] As a preferred embodiment, the weight of each performance indicator is calculated based on its upper limit across all servers, including:

[0111] The ratio of the sum of the upper limits of the performance metric across all servers to the upper limit on the current server is used as the metric weight for the current server.

[0112] Specifically, the method for calculating the weight of the metrics is as follows: the ratio of the sum of the upper limits of each performance metric across all servers to the upper limit on the current server is used as the weight of that performance metric on the current server.

[0113] The upper limits of the n performance metrics obtained above are m1, ..., m j ..., m n The current usage values ​​of the n performance metrics are: n1, ..., n j ... n n At this point, the corresponding weights of the n performance metrics are as follows: In this application, the indicator weights are automatically generated by the processor, eliminating the need for manual pre-setting, and exhibiting high levels of intelligence and accuracy.

[0114] The larger the weight of an indicator, the greater the pressure associated with that performance indicator.

[0115] As a preferred embodiment, the overall stress on each server is calculated based on the performance index values ​​corresponding to each server, including:

[0116] The overall pressure on the current server is calculated based on the weight of each performance metric and the corresponding utilization rate of each performance metric.

[0117] Specifically, this application calculates the overall pressure by summing the weights and utilization rates of each performance indicator. This avoids selecting a server with a high weight but low utilization rate as the target server, as a high weight indicates a higher utilization rate. Therefore, in this embodiment, the overall pressure is calculated as follows: the overall pressure of the current server is calculated based on the weights of each performance indicator and the utilization rate corresponding to each indicator.

[0118] The performance metric usage rate is the ratio of the current server's performance metric value to its upper limit; a higher usage rate indicates greater stress. The metric weight is the ratio of the sum of the upper limits of that metric across all servers in the cluster to the current server's upper limit; a higher weight indicates greater stress.

[0119] It is evident that the overall pressure on the current server can be calculated by considering the weighting of current server metrics and the utilization rate of performance metrics, and the overall pressure value obtained in this way is relatively accurate.

[0120] As a preferred embodiment, the overall stress on each server is calculated based on the performance index values ​​corresponding to each server, including:

[0121] Based on the calculation of each performance index value and the corresponding pressure value;

[0122] The overall stress of the server is calculated based on the stress values ​​corresponding to each performance indicator.

[0123] Specifically, the overall stress value is related to the stress value corresponding to each performance indicator. Therefore, the method for calculating the overall stress of each server based on the performance indicator value is as follows: calculate the stress value corresponding to each performance indicator based on each performance indicator value. If the calculation of the overall stress of the server involves n performance indicators, then the corresponding n stress values ​​are calculated based on the n performance indicator values, and then the overall stress of the server is calculated based on the n stress values.

[0124] In summary, the overall stress value of the server is closely related to the stress values ​​corresponding to each performance indicator. It can be seen that the method of calculating the overall stress of the server by using the values ​​of multiple performance indicators in this embodiment takes into account multiple factors, and the calculation results are more meaningful.

[0125] As a preferred embodiment, the overall server stress is calculated based on the stress values ​​corresponding to each performance indicator, including:

[0126] The sum of the stress values ​​corresponding to each performance indicator is taken as the overall stress of the server.

[0127] Specifically, the stress value corresponding to each performance indicator represents a portion of the server's stress. Therefore, when calculating the overall stress of the server, the sum of the stress values ​​of each performance indicator is taken as the overall stress of the server.

[0128] As a preferred embodiment, the calculation of each performance index value and the corresponding pressure value includes:

[0129] The product of the usage rate and weight of each performance indicator is used as the stress value corresponding to the performance indicator.

[0130] This embodiment aims to provide a specific implementation method for calculating the stress value corresponding to each performance indicator, wherein the product of the utilization rate and the indicator weight corresponding to each performance indicator can be used as the stress value corresponding to that performance indicator, but is not limited to.

[0131] After calculating the utilization rate and weight of each of the n performance metrics in the current server, we can obtain the stress values ​​corresponding to each of the n performance metrics:

[0132]

[0133] Therefore, the overall load on the current server is:

[0134]

[0135] S13: Determine the target server based on the overall load of each server, and use the target server to execute preset tasks.

[0136] Specifically, after calculating the overall pressure of each server in the server cluster, the overall pressure of each server is compared to determine the target server. By taking the overall pressure of each server into account, the target server is avoided from being selected as the server with the highest overall pressure, thus preventing the target server from being under excessive overall pressure and ensuring the stability of the server cluster operation.

[0137] As a preferred embodiment, a target server is determined based on the overall load of each server, and the target server is used to perform a preset task, including:

[0138] The server with the lowest overall pressure is selected as the target server based on the overall pressure of each server, and the target server is used to execute the preset tasks.

[0139] Specifically, to achieve load balancing among multiple servers in a server cluster, this embodiment selects the server with the lowest overall load as the target server. If there is more than one server with the lowest overall load, any server can be designated as the target server, or the working status and tasks executed by each server with the lowest overall load can be obtained to determine the target server based on their working status and tasks.

[0140] As a preferred embodiment, the process of performing a preset task includes:

[0141] Receive server management logic and distribute it to each server in the server cluster.

[0142] This embodiment aims to define a specific implementation method of a preset task, which can be receiving server management logic (sent by the host computer) and distributing this server management logic to each server in the server cluster.

[0143] On the other hand, the preset task can also be any other work task sent by the host computer that needs to be executed by the server, not limited to the task of sending server management logic as exemplified above, and this application will not limit it here.

[0144] As a preferred embodiment, before obtaining multiple performance metric values ​​corresponding to each server in the server cluster, the method further includes:

[0145] Determine whether the server cluster meets the preset trigger conditions;

[0146] If the conditions are met, proceed to the step of obtaining multiple performance metric values ​​corresponding to each server in the server cluster.

[0147] Furthermore, this embodiment aims to determine when to proceed to the step of obtaining multiple performance index values ​​corresponding to each server in the server cluster. Specifically, this step is triggered only when the server cluster meets the preset triggering conditions; otherwise, this step is not initiated.

[0148] As a preferred embodiment, determining whether the server cluster meets the preset triggering conditions includes:

[0149] Determine whether servers have been added or removed from the server cluster;

[0150] If a server is added or removed, the preset triggering conditions are determined to be met.

[0151] This embodiment aims to define a specific implementation method of the preset triggering conditions. Specifically, when a server is added or removed from the server cluster, the distribution of servers in the server cluster changes. At this time, the management logic of the corresponding server will also change accordingly. At this time, it is determined that the preset triggering conditions are met, and the step of obtaining multiple performance index values ​​corresponding to each server in the server cluster is entered.

[0152] As a preferred embodiment, determining whether the server cluster meets the preset triggering conditions includes:

[0153] Determine whether the difference between the time when the last time the values ​​of multiple performance indicators for each server in the server cluster were obtained and the current time has reached the preset time interval.

[0154] If the condition is met, the preset triggering condition is deemed satisfied.

[0155] This embodiment aims to define another specific implementation method for the preset triggering conditions. Specifically, when the distribution of servers in the server cluster remains unchanged, the comprehensive pressure of each server in the server cluster is calculated once every preset time period, and the task distribution is adjusted according to the calculation results to achieve load balancing of multiple servers in the server cluster.

[0156] Therefore, in this embodiment, if the difference between the time when the last acquisition of multiple performance index values ​​corresponding to each server in the server cluster was obtained and the current time reaches a preset time interval, it is determined that the preset triggering condition is met, and the step of acquiring multiple performance index values ​​corresponding to each server in the server cluster is entered.

[0157] As a preferred embodiment, determining whether the server cluster meets the preset triggering conditions includes:

[0158] When the server cluster is initialized, it is determined that the preset triggering conditions are met.

[0159] Of the three preset trigger conditions listed above, only one of them needs to be met to proceed to the step of obtaining multiple performance index values ​​corresponding to each server in the server cluster.

[0160] In summary, the server determination method provided in this application obtains multiple performance index values ​​corresponding to each server in the server cluster; calculates the overall pressure of each server based on its performance index values; and determines the target server based on the overall pressure of each server, so as to use the target server to execute the preset task. It is evident that this application calculates the overall pressure of each server in the server cluster using multiple index values, and then determines the target server based on the overall pressure. By taking the overall pressure of the servers into account, servers with lower overall pressure can be selected to complete the preset task, thereby ensuring the stability of the server cluster.

[0161] For ease of understanding, this application also provides another specific embodiment, please refer to... Figure 2 , Figure 2 A flowchart illustrating another method for determining a server provided in this application.

[0162] S21: Determine whether a server has been added or removed from the server cluster;

[0163] S22: Alternatively, determine whether the difference between the time when the last time the values ​​of multiple performance indicators corresponding to each server in the server cluster were obtained and the current time has reached the preset time interval.

[0164] S23: If a server is added or removed, or if the time between the last time the values ​​of multiple performance metrics corresponding to each server in the server cluster were obtained and the current time reaches a preset time interval, then obtain the current usage value and upper limit value of multiple performance metrics corresponding to each server in the server cluster.

[0165] S24: The ratio of the current usage value to the upper limit value of each performance indicator is used as the usage rate corresponding to the performance indicator;

[0166] S25: The ratio of the sum of the upper limits of each performance metric across all servers to the upper limit on the current server is used as the weight of each performance metric.

[0167] S26: The product of the utilization rate and the weight of each performance indicator is used as the stress value corresponding to the performance indicator;

[0168] S27: The sum of the stress values ​​corresponding to each performance indicator is taken as the overall stress of the server;

[0169] S28: Based on the overall pressure of each server, determine the server with the lowest overall pressure as the target server, and use the target server to execute the preset task.

[0170] As can be seen, this application calculates the overall pressure of each server in the server cluster by using multiple index values ​​of the server, and then determines the target server based on the overall pressure. By taking the overall pressure of the server into account, the server with the lower overall pressure can be selected to complete the preset task, thereby ensuring the stability of the server cluster.

[0171] For ease of understanding, this application also provides a specific embodiment. In this embodiment, the server cluster includes three servers, and the calculation of the overall server load involves three performance indicators: the number of Transmission Control Protocol (TCP) connections, CPU usage, and bandwidth usage. The overall server load is calculated based on these three performance indicators to select the master server. Furthermore, all servers simultaneously upload their own relevant performance indicator values ​​to the cluster's database at preset time intervals. Each server reads relevant data from the database to calculate the overall load. The calculation process is as follows:

[0172] 1. Obtain the current number of connections T and the maximum number of connections T of the Transmission Control Protocol (TCP). max The current number of Transmission Control Protocol (TCP) connections is queried using the system command "netstat," and the upper limit for TCP connections is calculated based on system memory. max = Server memory / Memory consumed per connection. The current connection counts of the three servers in the cluster are T1, T2, and T3, respectively, and the maximum number of connections for each of the three servers in the cluster is T. max1 T max2 T max3 .

[0173] 2. Obtain the current CPU usage P and the maximum CPU usage P. max The upper limit of CPU usage is calculated by querying the CPU's maximum frequency (H) and number of cores (C) using the system command "lscpu". max =H*C, where the current CPU usage P is calculated based on the CPU utilization rate Q (Q is found to be (C*100)% by querying the system command "top"). The current CPU usage of the three servers in the cluster is P1, P2, and P3, respectively. The maximum CPU usage limits for the three servers are: P1, P2, and P3, respectively. max1 P max2 P max3 .

[0174] 3. Obtain the current bandwidth usage F and the maximum bandwidth value F. max Current bandwidth usage can be queried using the system command "iftop", and the maximum bandwidth usage can be queried using the command "speedtest-cli". The current bandwidth usage of the three servers are F1, F2, and F3, respectively, and the maximum bandwidth usage of the three servers is F... max1 F max2 F max3 .

[0175] 4. The server reads relevant metrics from the cluster database to calculate the overall load. The overall loads of the three servers are Y1, Y2, and Y3, respectively.

[0176]

[0177]

[0178]

[0179] 5. Compare the values ​​of Y1, Y2, and Y3. The value with the smallest value indicates the lowest overall server load. Select this value as the target server to execute the preset task.

[0180] As can be seen, this application calculates the overall pressure of each server in the server cluster by using multiple index values ​​of the server, and then determines the target server based on the overall pressure. By taking the overall pressure of the server into account, the server with the lower overall pressure can be selected to complete the preset task, thereby ensuring the stability of the server cluster.

[0181] To address the aforementioned technical problems, this application also provides a server determining device, please refer to... Figure 3 , Figure 3 A structural block diagram of a server determination device provided in this application, the device comprising:

[0182] The performance indicator value acquisition unit 31 is used to acquire multiple performance indicator values ​​corresponding to each server in the server cluster.

[0183] The comprehensive stress calculation unit 32 is used to calculate the comprehensive stress of each server based on the performance index values ​​corresponding to each server.

[0184] Server determination unit 33 is used to determine the target server based on the overall pressure of each server, so as to use the target server to perform preset tasks.

[0185] In a preferred embodiment, the performance index value acquisition unit is specifically used for:

[0186] Get the current usage value and upper limit value of each performance metric in each server.

[0187] As a preferred embodiment, it also includes:

[0188] The utilization rate calculation unit is used to calculate the utilization rate of each performance indicator based on the current and upper limit values ​​of each performance indicator.

[0189] The integrated pressure calculation unit is specifically used for:

[0190] The overall pressure on each server is calculated based on the utilization rate corresponding to each performance indicator.

[0191] In a preferred embodiment, the utilization rate calculation unit is specifically used for:

[0192] The ratio of the current usage value to the upper limit value of each performance metric is used as the usage rate corresponding to the performance metric.

[0193] As a preferred embodiment, it also includes:

[0194] The upper limit value acquisition unit is used to obtain the upper limit value of each performance indicator across all servers in the server cluster.

[0195] The weight calculation unit is used to calculate the weight of the current server's metrics based on the upper limit of each performance metric across all servers.

[0196] In a preferred embodiment, the weight calculation unit is specifically used for:

[0197] The ratio of the sum of the upper limits of each performance metric across all servers to the upper limit on the current server is used as the metric weight for the current server.

[0198] As a preferred embodiment, the integrated pressure calculation unit is specifically used for:

[0199] The overall pressure on each server is calculated based on the current server metric weights and the utilization rate corresponding to each performance metric.

[0200] As a preferred embodiment, the performance indicators are one or more combinations of the following: the number of connections of the transmission control protocol of each server, the amount of CPU usage, the amount of memory usage, and the amount of bandwidth usage.

[0201] In a preferred embodiment, when the performance metric is the number of connections in the Transmission Control Protocol (TCP), the performance metric value acquisition unit includes:

[0202] The memory acquisition unit is used to acquire the server's system memory and currently used memory.

[0203] The first determining unit is used to determine the upper limit of the number of connections for each transmission control protocol based on the server's system memory and the memory consumed by each transmission control protocol.

[0204] The second determining unit is used to determine the current usage value of the number of connections of the transmission control protocol based on the current memory used by the server and the memory consumed by each transmission control protocol.

[0205] In a preferred embodiment, when the performance metric is the usage of the central processing unit, the performance metric value acquisition unit includes:

[0206] The first computing unit is used to obtain the highest frequency and number of cores of the central processing unit, and calculate the upper limit of the central processing unit's usage based on the highest frequency and number of cores;

[0207] The second computing unit is used to obtain the utilization rate of the central processing unit and calculate the current usage of the central processing unit based on the utilization rate.

[0208] As a preferred embodiment, the integrated pressure calculation unit includes:

[0209] The sub-pressure calculation unit is used to calculate the pressure value corresponding to each performance index value.

[0210] The third calculation unit is used to calculate the overall pressure of the server based on the pressure values ​​corresponding to each performance indicator.

[0211] In a preferred embodiment, the sub-pressure calculation unit is specifically used to: multiply the utilization rate and weight of each performance indicator as the pressure value corresponding to the performance indicator.

[0212] In a preferred embodiment, the third calculation unit is specifically used to: sum the pressure values ​​corresponding to each performance indicator as the overall pressure of the server.

[0213] As a preferred embodiment, the process of executing the preset task includes: receiving server management logic and distributing the server management logic to each server in the server cluster.

[0214] As a preferred embodiment, the integrated pressure calculation unit is specifically used for:

[0215] The server with the lowest overall pressure is selected as the target server based on the overall pressure of each server, and the target server is used to execute the preset tasks.

[0216] As a preferred embodiment, it also includes:

[0217] The first judgment unit is used to determine whether the server cluster meets the preset triggering conditions;

[0218] The first execution unit is used to proceed to the step of obtaining multiple performance index values ​​corresponding to each server in the server cluster when a preset trigger condition is met.

[0219] In a preferred embodiment, the first determination unit is specifically used to: determine whether a server has been added or removed from the server cluster;

[0220] The first execution unit, specifically used to add or remove servers in the server cluster, determines whether the preset triggering conditions are met.

[0221] In a preferred embodiment, the first judgment unit is specifically used to: determine whether the difference between the time when the last acquisition of multiple performance index values ​​corresponding to each server in the server cluster was made and the current time reaches a preset time interval;

[0222] The first execution unit is specifically used to determine that the preset triggering condition is met when the difference between the time when the last time the values ​​of multiple performance indicators corresponding to each server in the server cluster were obtained and the current time reaches a preset time interval.

[0223] For a description of the device for determining the server, please refer to the above embodiments; this application will not repeat it here.

[0224] To address the aforementioned technical problems, this application also provides an electronic device, please refer to... Figure 4 , Figure 4 A structural block diagram of an electronic device provided in this application, the electronic device comprising:

[0225] Memory 41 is used to store computer programs;

[0226] Processor 42 is configured to implement the steps of the server determination method described above when storing computer programs.

[0227] The processor 42 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 42 may be implemented using at least one of the following hardware forms: a digital signal processor, a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 42 may also include a main processor and a coprocessor. The main processor, also known as the central processing unit, is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 42 may integrate an image processor responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 42 may also include an artificial intelligence processor for handling computational operations related to machine learning.

[0228] The memory 41 may include one or more computer-readable storage media, which may be non-transitory. The memory 41 may also include high-speed random access memory 41 and non-volatile memory 41, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 41 is used to store at least the following computer program, wherein, after being loaded and executed by the processor 42, the computer program is able to implement the relevant steps of the server determination method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 41 may also include operating systems and data, and the storage method may be temporary storage or permanent storage. The operating system may include Windows, Unix, Linux, etc. Data may include, but is not limited to, message transmission volume, message thresholds, etc. For a description of the electronic device, please refer to the above embodiments; this application will not repeat it here.

[0229] To address the aforementioned technical problems, this application also provides a computer-readable storage medium 50, please refer to... Figure 5 , Figure 5 This application provides a structural block diagram of a computer-readable storage medium 50. The computer-readable storage medium 50 stores a computer program 51, which, when executed by a processor, implements the steps of the server determination method described above. The computer-readable storage medium 50 can be a transient or non-transient storage medium, and this application does not limit its scope further. For a description of the computer-readable storage medium 50, please refer to the above embodiments; further details are omitted here.

[0230] To address the aforementioned technical problems, this application also provides a server cluster, including the electronic devices and multiple servers described above.

[0231] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0232] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily 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 this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A determination method of a server, characterized by, include: When the preset triggering conditions for adding or removing servers are met in the server cluster, multiple performance index values ​​corresponding to each of the servers in the server cluster are obtained. The performance index values ​​include the current usage value and the upper limit value of each performance index; The upper limit value is the upper limit value of the performance index for all servers in the server cluster; wherein, all servers simultaneously upload their own related performance index values ​​to the database of the server cluster at preset time intervals, and each server reads the relevant performance index values ​​from the database to calculate the overall pressure. The utilization rate of each performance indicator is calculated based on its current usage value and upper limit value; wherein, the ratio of the current usage value to the upper limit value of each performance indicator is taken as the utilization rate corresponding to the performance indicator. The weight of each performance indicator is calculated based on its upper limit across all servers; wherein, the ratio of the sum of the upper limits of the performance indicators across all servers to the upper limit of the current server is used as the weight of the performance indicator in the current server; the weight of the indicator represents the proportion of the performance indicator of the current server in the entire server cluster. The overall pressure of each server is calculated based on the performance index value corresponding to each server; wherein, the product of the utilization rate and the index weight of each performance index is used as the pressure value corresponding to the performance index, and the sum of the pressure values ​​corresponding to each performance index is used as the overall pressure of the server. The target server is determined based on the overall pressure of each server, and the target server is used to execute a preset task; wherein, the process of executing the preset task includes: receiving server management logic and distributing the server management logic to each server in the server cluster; The performance metrics are the number of connections to the transmission control protocol and the amount of CPU usage for each server. When the performance metric is the number of connections, obtaining the corresponding upper limit includes: obtaining the system memory of the server and the memory consumed by each transmission control protocol connection, and using the ratio of the system memory to the memory consumed per connection as the upper limit of the number of connections; When the performance metric is the usage of the central processing unit, obtaining the corresponding upper limit value includes: obtaining the highest frequency and the number of cores of the central processing unit, and using the product of the highest frequency and the number of cores as the upper limit value of the usage.

2. The determination method of a server according to claim 1, wherein The performance metrics also include memory usage and / or bandwidth usage.

3. The method for determining a server as described in any one of claims 1-2, characterized in that, A target server is determined based on the overall load of each of the aforementioned servers, and the target server is used to perform a preset task, including: The server with the lowest overall pressure is determined as the target server based on the overall pressure of each of the servers, and the target server is used to execute the preset task.

4. The method for determining a server as described in any one of claims 1-2, characterized in that, Determining whether the server cluster meets the preset triggering conditions further includes: Determine whether the difference between the time when the last time the values ​​of multiple performance indicators corresponding to each server in the server cluster were obtained and the current time has reached a preset time interval. If the condition is met, it is determined that the preset triggering condition is satisfied.

5. The method for determining the server as described in claim 4, characterized in that, Determining whether the server cluster meets the preset triggering conditions further includes: When the server cluster is initialized, it is determined that the preset triggering condition is met.

6. A device for determining a server, characterized in that, include: The performance indicator value acquisition unit is used to acquire multiple performance indicator values ​​corresponding to each server in the server cluster when the preset triggering conditions for adding or removing servers are met. The performance index values ​​include the current usage value and the upper limit value of each performance index; The upper limit value is the upper limit value of the performance index for all servers in the server cluster; the performance index is the number of connections of the transmission control protocol and the usage of the central processing unit for each server; wherein, all servers simultaneously upload their own related performance index values ​​to the database of the server cluster at preset time intervals, and each server reads the relevant performance index values ​​from the database to calculate the overall pressure. The comprehensive stress calculation unit is used to calculate the comprehensive stress of each server based on the performance index values ​​corresponding to each server; wherein, the product of the utilization rate and the index weight of each performance index is used as the stress value corresponding to the performance index, and the sum of the stress values ​​corresponding to each performance index is used as the comprehensive stress of the server. The server determination unit is used to determine a target server based on the overall pressure of each of the servers, so as to use the target server to execute a preset task; wherein, the process of executing the preset task includes: receiving server management logic and distributing the server management logic to each server in the server cluster; The server determining device is further configured to calculate the utilization rate corresponding to each performance indicator based on the current utilization value and the upper limit value of each performance indicator; wherein, the ratio of the current utilization value to the upper limit value of each performance indicator is used as the utilization rate corresponding to the performance indicator; and to calculate the indicator weight of each performance indicator based on the upper limit value of each performance indicator in all servers; wherein, the ratio of the sum of the upper limit values ​​of the performance indicators in all servers to the upper limit value in the current server is used as the indicator weight of the performance indicator in the current server; the indicator weight represents the proportion of the performance indicator of the current server in the entire server cluster; The server determining device is further configured to, when the performance indicator is the number of connections, obtain the corresponding upper limit value by: obtaining the system memory of the server and the memory consumed by each transmission control protocol connection, and using the ratio of the system memory to the memory consumed per connection as the upper limit value of the number of connections; when the performance indicator is the usage of the central processing unit, obtain the corresponding upper limit value by: obtaining the highest frequency and the number of cores of the central processing unit, and using the product of the highest frequency and the number of cores as the upper limit value of the usage.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the server determination method as described in any one of claims 1-5, while storing a computer program.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the server determination method as described in any one of claims 1-5.

9. A server cluster, characterized in that, It includes the electronic device as described in claim 7 and multiple servers.

Citation Information

Patent Citations

  • Load balancing method and device for server cluster, equipment and medium

    CN115408155A

  • Automatic weighting load balancing method and system, electronic equipment and storage medium

    CN116016533A