Dynamic balanced connection method, system and device of current limiting cluster and medium

By adopting a dynamic balanced connection method in a current-limited cluster and adjusting connections according to client access data, the problem of uneven client distribution in a current-limited cluster is solved, improving service stability and reducing costs.

CN118612151APending Publication Date: 2024-09-06PINGAN YIQIANBAO E COMMERCE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410715154.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-03
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

The number of clients connected to each current-limiting server in the existing current-limiting cluster is unbalanced, resulting in heavy processing pressure on some servers and idle resources of some servers, which reduces the stability of the current-limiting service.

Method used

Using the dynamic balancing connection method, the client access data of each node is obtained through the master node, the data to be balanced and the node data set are calculated according to the preset strategy, a reconnection notification is sent to the client to be balanced, the connection is disconnected and re-established to the target The connection of nodes realizes the dynamic balanced distribution of clients.

Benefits of technology

It improves the service stability of current-limited clusters. By dynamically adjusting client connections, it avoids idleness and overload of server resources, reduces implementation costs, and further improves stability through preset filtering strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118612151A
    Figure CN118612151A
Patent Text Reader

Abstract

The invention relates to the technical field of distributed deployment, and discloses a dynamic balanced connection method, system and device for a current limiting cluster and a medium, and the method comprises the steps that a main node obtains client access data corresponding to each node, and according to the client access data, the client access data corresponding to each node is obtained; calculating to-be-balanced data corresponding to each node and a node data set according to a dynamic balancing strategy; the main node sends the to-be-balanced data corresponding to the child nodes and the node data set to the child nodes; according to the to-be-balanced data and the node data set, the node determines each to-be-balanced client and target node data corresponding to each to-be-balanced client according to a screening strategy; and the node sends a reconnection notification to a to-be-balanced client corresponding to the target node data according to the target node data and disconnects the connection with the to-be-balanced client, and the to-be-balanced client is used for recreating the connection according to the reconnection notification. Therefore, the stability of providing the current limiting service by the current limiting cluster is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of distributed deployment technology, and in particular to a method, system, device and medium for dynamically balancing connection of a current-limiting cluster. Background Art

[0002] A current limiting cluster is a cluster that provides current limiting services to the outside world in a unified manner. The client selects a current limiting server in the current limiting cluster to create a connection; when the client makes a request, it forwards the request to the connected current limiting server, which performs current limiting calculations for the request and then returns the results of the current limiting calculations to the client. However, as the number of client creation and disconnection behaviors increases, the number of clients connected to each current limiting server is no longer balanced. As time goes by, this imbalance becomes greater, causing some current limiting servers to be under greater pressure to process business, which may affect processing efficiency, while other current limiting servers are under less pressure to process business, resulting in idle computing resources, thereby reducing the stability of the current limiting service provided by the current limiting cluster. Summary of the invention

[0003] Based on this, it is necessary to address the technical problem that the number of clients connected to each current limiting server in the current limiting cluster of the prior art is unbalanced, which reduces the stability of the current limiting service provided by the current limiting cluster, and propose a dynamic balanced connection method, system, device and medium for the current limiting cluster.

[0004] In a first aspect, a dynamic balanced connection method of a current limiting cluster is provided, the method being applied to a current limiting cluster, the current limiting cluster comprising a plurality of nodes, each of the nodes being divided into a main node and each sub-node, the method comprising:

[0005] The master node obtains the client access data corresponding to each of the nodes, and calculates the to-be-balanced data and the node data set corresponding to each of the nodes according to the preset dynamic balancing strategy based on the client access data;

[0006] The master node sends the to-be-balanced data and the node data set corresponding to the child node to the child node;

[0007] The node determines each client to be balanced and the target node data corresponding to each client to be balanced according to the data to be balanced and the node data set and a preset screening strategy;

[0008] The node sends a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnects the connection with the client to be balanced, wherein the client to be balanced is used to re-establish the connection according to the reconnection notification.

[0009] In a second aspect, a dynamic balanced connection system of a current limiting cluster is provided, the system comprising: the system is applied to a current limiting cluster, the current limiting cluster comprises a plurality of nodes, each of the nodes is divided into a main node and each sub-node, the system comprising:

[0010] A dynamic balancing evaluation module is used for the master node to obtain the client access data corresponding to each of the nodes, and calculate the to-be-balanced data and node data set corresponding to each of the nodes according to the preset dynamic balancing strategy based on the client access data;

[0011] A data distribution module, used for the master node to send the to-be-balanced data and the node data set corresponding to the child node to the child node;

[0012] The client screening module is used for the node to determine each client to be balanced and the target node data corresponding to each client to be balanced according to the data to be balanced and the node data set and a preset screening strategy;

[0013] A dynamic balancing execution module is used for the node to send a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnect the connection with the client to be balanced, wherein the client to be balanced is used to re-establish the connection according to the reconnection notification.

[0014] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method for dynamically balancing connection of a current-limiting cluster when executing the computer program.

[0015] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the dynamic balanced connection method of the current limiting cluster are implemented.

[0016] The dynamic balancing connection method of the current limiting cluster of the present application obtains the client access data corresponding to each node through the master node, and calculates the data to be balanced and the node data set corresponding to each node according to the preset dynamic balancing strategy based on the access data of each client; the master node sends the data to be balanced and the node data set corresponding to the child node to the child node; the node determines the target node data corresponding to each client to be balanced and each client to be balanced according to the data to be balanced and the node data set according to the preset screening strategy; the node sends a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnects the connection with the client to be balanced, wherein the client to be balanced is used to re-create the connection according to the reconnection notification. Thus, the client connected to each node in the dynamic balancing current limiting cluster is realized, and the stability of the current limiting cluster providing the current limiting service is improved; by setting a node in the current limiting cluster as the master node, no additional hardware equipment is required, and the implementation cost of the present application is reduced; the client to be balanced is determined by the preset screening strategy, which is conducive to further improving the stability of the current limiting cluster providing the current limiting service. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] in:

[0019] Figure 1 It is an application environment diagram of a dynamic balanced connection method of a current limiting cluster in one embodiment;

[0020] Figure 2 It is a flowchart of a method for dynamically balancing connections of a current-limiting cluster in one embodiment;

[0021] Figure 3 It is a structural block diagram of a dynamic balanced connection system of a current limiting cluster in one embodiment;

[0022] Figure 4 FIG. 4 is a structural block diagram of a computer device in one embodiment. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0024] The dynamic balanced connection method of the current limiting cluster provided in the embodiment of the present application can be applied in the following aspects: Figure 1 In the application environment, Figure 1 A current limiting cluster is illustrated, and the current limiting cluster includes multiple nodes, and all the nodes in the current limiting cluster are divided into a main node and each sub-node, and the two nodes are connected through the network. A current limiting server is set on each node, which is used to perform current limiting calculations on each request of a successfully connected client. Each node in the current limiting cluster has the opportunity to become a main node and also has the opportunity to become a sub-node. Therefore, the current limiting server of each node is loaded with a program file that implements the dynamic balanced connection method of the current limiting cluster of the present application. During the actual operation of the program file, the node executes the specific function of the program file according to the role (main node or sub-node). The master node is generated from each successfully started current limiting server by election. The client creates a connection with the node in the current limiting cluster, and then sends a request to the successfully connected node. That is to say, the current limiting cluster provides current limiting services to the client through the current limiting server on the node to which the client successfully connects.

[0025] The client can run on mobile phones and smart wearable devices, on personal computers, or on servers. The selection range of smart wearable devices includes but is not limited to: smart watches, smart helmets, and smart bracelets.

[0026] Optionally, the functions of each node are the same.

[0027] The current limiting cluster provides current limiting services in a cluster manner. Compared with the current limiting service that only uses one server, the current limiting service provided by the cluster can connect to more clients.

[0028] The functions that the master node needs to implement include: current limiting calculation, dynamic balancing evaluation and dynamic balancing execution. The functions that the child node needs to implement include: current limiting calculation and dynamic balancing execution. Current limiting calculation includes calculating the current limiting threshold for the request sent by the client. Dynamic balancing evaluation is used to calculate the data to be balanced and the node data set corresponding to each of the nodes, wherein the data to be balanced is the relevant data of the client that needs to be balanced, and the node data set is a collection of node data of the nodes that need to be redistributed. Dynamic balancing execution is used to filter out the clients that need to be balanced and the balanced node data corresponding to the clients that need to be balanced according to the data to be balanced and the node data set distributed by the master node, send a notification to the client that needs to be balanced, and disconnect the connection with the client that needs to be balanced. The client re-creates the connection with the node corresponding to the balanced node data in the received notification. Thereby, the clients connected to each node in the dynamic balancing current limiting cluster are realized, and the stability of the current limiting service provided by the current limiting cluster is improved.

[0029] Optionally, the dynamic balanced connection of the current limiting cluster of the present application can be applied to the field of digital medicine, such as medical cloud. Medical cloud refers to the use of "cloud computing" to create a medical and health service cloud platform based on new technologies such as cloud computing, mobile technology, multimedia, 4G communication, big data, and the Internet of Things, combined with medical technology, to achieve the sharing of medical resources and the expansion of medical scope. Because of the application and combination of cloud computing technology, the medical cloud improves the efficiency of medical institutions and facilitates residents' medical treatment. For example, the current hospital appointment registration, electronic medical records, medical insurance, etc. are all the products of the combination of cloud computing and the medical field. The medical cloud also has the advantages of data security, information sharing, dynamic expansion, and overall layout.

[0030] Optionally, it can also be applied in the field of financial technology, for example, e-commerce systems.

[0031] See also Figure 2 As shown, Figure 2 A flow chart of a dynamic balanced connection method of a current limiting cluster provided in an embodiment of the present application is provided. The method is applied to a current limiting cluster, wherein the current limiting cluster includes a plurality of nodes, each of which is divided into a main node and each sub-node, and includes the following steps:

[0032] S1: The master node obtains the client access data corresponding to each of the nodes, and calculates the to-be-balanced data and the node data set corresponding to each of the nodes according to the preset dynamic balancing strategy based on the client access data;

[0033] Optionally, the master node obtains the client access data corresponding to each node according to a preset time period to achieve dynamic balanced connection of the current limiting cluster, thereby achieving regular dynamic balanced evaluation, which is conducive to improving the stability of providing current limiting services.

[0034] The client access data corresponding to the node is the node identifier and data related to the client accessing the node. For example, the data related to the client accessing the node is the number of the clients accessing the node.

[0035] The node identifier may be data that uniquely identifies a node, such as a node name, a node ID, or a node IP address.

[0036] Optionally, the master node obtains the client access data corresponding to each node according to the current limiting startup instruction to achieve dynamic balanced connection of the current limiting cluster, thereby achieving regular dynamic balanced evaluation, which is conducive to improving the stability of providing current limiting services.

[0037] The current limiting startup instruction can be sent by the user through a third-party application, or actively generated by the third-party application according to preset conditions, or input by the user in the operation interface corresponding to the current limiting cluster, or generated by the program file implementing the method of the present application according to preset conditions.

[0038] The master node obtains the client access data corresponding to each of the nodes, and the scope of the acquisition includes the client access data corresponding to the master node and the client access data corresponding to all the child nodes.

[0039] Specifically, when the master node completes the acquisition of client access data of all nodes, it calculates the data to be balanced and the node data set corresponding to each node according to the preset dynamic balancing strategy based on each client access data, so that the dynamic balancing goal meets the dynamic balancing strategy.

[0040] Optionally, the preset dynamic balancing strategy is a quantity equalization strategy, and the goal of dynamic balancing is to make the difference in the number of clients connected to each node not exceed 1.

[0041] Optionally, the preset dynamic balancing strategy is a quantity equalization strategy, and the goal of dynamic balancing is to make the quantity difference of clients connected to each node fall within a preset quantity difference range.

[0042] The data to be balanced is the amount that needs to be balanced to other nodes. For example, when the preset dynamic balancing strategy is the quantity equalization strategy, the data to be balanced is the number of clients that need to be balanced to other nodes.

[0043] Optionally, the node data set includes one or more node data.

[0044] Optionally, the node data includes: a node IP address. The node IP address is the IP address of the current limiting server on the node. The full name of the IP address in English is Internet Protocol Address.

[0045] Optionally, the node data includes: a node IP address and a node allocation amount, wherein the node allocation amount is data corresponding to each client that needs to be allocated to the node corresponding to the node IP address.

[0046] Optionally, the master node sends a calculation notification to each node, and each node calculates the client access data when receiving the calculation notification.

[0047] S2: The master node sends the to-be-balanced data and the node data set corresponding to the child node to the child node;

[0048] It can be understood that the master node performs dynamic balancing evaluation, and the data to be balanced and the node data set corresponding to the master node are already on the master node. Therefore, there is no need to send the data to be balanced and the node data set corresponding to the master node.

[0049] Specifically, the master node sends the to-be-balanced data and the node data set corresponding to the child node to the child node through the connection with the child node.

[0050] S3: The node determines each client to be balanced and the target node data corresponding to each client to be balanced according to the data to be balanced and the node data set and a preset screening strategy;

[0051] Specifically, any one of the nodes in the current limiting cluster is used as the first node; the first node determines each client to be balanced according to a preset screening strategy based on the received data to be balanced and the data related to the client connected to the first node, and then determines a node data from the received node data set as the target node data based on the data related to the client to be balanced.

[0052] Optionally, the preset screening strategy is to select the client with the earliest last active time as the client to be balanced.

[0053] S4: The node sends a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnects the connection with the client to be balanced, wherein the client to be balanced is used to re-establish the connection according to the reconnection notification.

[0054] Specifically, any one of the nodes in the current limiting cluster is used as the second node; the second node, based on the received target node data, sends a reconnection notification to the client to be balanced corresponding to the target node data, thereby informing the node data of the node that needs to be reconnected; after successfully sending the reconnection notification, the second node disconnects the connection with the client to be balanced corresponding to the target node data; when receiving the reconnection notification, the client to be balanced corresponding to the target node data will re-establish the connection according to the target node data carried in the reconnection notification, thereby balancing the client to be balanced to the node corresponding to the target node data.

[0055] This embodiment realizes dynamic balancing of clients connected to each node in the current limiting cluster, thereby improving the stability of the current limiting service provided by the current limiting cluster; by setting a node in the current limiting cluster as the master node, no additional hardware equipment is required, thereby reducing the implementation cost of this application; determining the client to be balanced through a preset screening strategy is conducive to further improving the stability of the current limiting service provided by the current limiting cluster.

[0056] In one embodiment, the method further comprises:

[0057] S01: When the node is started up, it is determined whether the current limiting cluster has the master node. If not, a preset master node election method is executed;

[0058] Specifically, when the current limiting server of the node is successfully powered on (that is, the power-on is completed), a preset judgment method is used to determine whether the current limiting cluster has the master node; if the current limiting cluster has the master node, it is not necessary to re-determine the master node at this time, and step S01 is terminated; if the current limiting cluster does not have the master node, it is necessary to re-determine the master node at this time, and the preset master node election method is executed. In this way, each node can automatically elect a master node when it is powered on.

[0059] Optionally, the preset judgment method is that the master node registers a machine information in zookeeper. As long as the zookeeper is monitored, it can be determined whether the current limiting cluster has the master node. Zookeeper is a distributed, open source distributed application coordination service. It is an open source implementation of Google's Chubby and an important component of Hadoop and Hbase.

[0060] Optionally, the preset judgment method is that the master node sends a heartbeat to the non-master node. If the non-master node does not receive the heartbeat sent by the master node within a preset time, it is determined that the master node does not exist in the current limiting cluster; if the non-master node receives the heartbeat sent by the master node within a preset time, it is determined that the master node exists in the current limiting cluster.

[0061] Optionally, the preset judgment method is that the non-master node periodically sends a status detection packet to the master node. If no feedback information is received from the master node within a period of time, it is determined that the master node does not exist in the current limiting cluster; if feedback information is received from the master node within a period of time, it is determined that the master node exists in the current limiting cluster.

[0062] S02: After the node is powered on, it is determined whether the current limiting cluster has the master node according to a preset time interval. If not, the master node election method is executed.

[0063] Specifically, after the node is started up, it actively triggers the use of a preset judgment method at a preset time interval to determine whether the current limiting cluster has the master node; if the current limiting cluster has the master node, it is not necessary to re-determine the master node and the execution of the master node election is terminated; if the current limiting cluster does not have the master node, it is necessary to re-determine the master node and execute the preset master node election method. This enables each node to automatically elect a master node when it is started up.

[0064] In this embodiment, the node actively elects the master node when the startup is completed, which is conducive to quickly determining the master node when the current limiting cluster is restarted; and after the startup is completed, it actively elects the master node regularly according to the preset time interval, so that when the master node goes down, a new master node can be quickly determined, which is conducive to further improving the stability of the current limiting service provided by the current limiting cluster.

[0065] In one embodiment, the client access data is used to describe the total usage of computing resources corresponding to each client accessing the node within the first time period;

[0066] The step of calculating the data to be balanced and the node data set corresponding to each node according to the preset dynamic balancing strategy based on the access data of each client includes:

[0067] S111: calculating an average total occupancy according to the total occupancy of each computing resource in the access data of each client;

[0068] The total amount of computing resources occupied is the sum of the amount of computing resources occupied by each client accessing the node within the first time period. Computing resources include CPU resources, memory resources, hard disk resources and network resources. The start calculation time of the client access data is taken as the end time, and the total amount of computing resources corresponding to each client accessing the node within the first time period is taken as the client access data corresponding to the node.

[0069] Specifically, an average value is calculated for the total occupancy of the computing resources in the access data of each client, and the calculated average value is used as the total occupancy average value.

[0070] S112: subtracting the average occupancy value from each client access data to obtain an occupancy difference value;

[0071] Specifically, the average occupancy value is subtracted from the client access data, and the data obtained by the subtraction is used as the occupancy difference value corresponding to the client access data.

[0072] The occupancy difference may be greater than 0, less than 0, or equal to 0.

[0073] S113: The nodes whose occupancy difference is greater than the upper limit of the preset first numerical range are taken as nodes to be transferred out, and the nodes whose occupancy difference is less than the lower limit of the first numerical range are taken as nodes to be transferred in;

[0074] The preset first numerical range is a preset first numerical range, and the first numerical range includes an upper limit and a lower limit.

[0075] Specifically, the node whose occupancy difference is greater than the upper limit value of the preset first numerical range has a relatively high business processing pressure, and it is necessary to balance some clients connected to the node to other nodes. Therefore, the node whose occupancy difference is greater than the upper limit value of the preset first numerical range is treated as a node to be called out; the node whose occupancy difference is less than the lower limit value of the first numerical range has a relatively low business processing pressure, and it is necessary to increase the number of clients connected to the node. Therefore, the node whose occupancy difference is less than the lower limit value of the first numerical range is treated as a node to be called in.

[0076] Optionally, the upper limit value of the first numerical range is different from the lower limit value of the first numerical range, and the adjusted client access data of each node after balancing is within a certain range, so as to minimize the impact of dynamic balancing on the client while ensuring the effect of dynamic balancing.

[0077] Optionally, the upper limit value of the first numerical range is the same as the lower limit value of the first numerical range.

[0078] S114: subtracting the upper limit of the first value range from the occupancy difference corresponding to the node to be called out, to obtain the to-be-balanced data corresponding to the node to be called out;

[0079] Specifically, the occupancy difference corresponding to the node to be called out is subtracted from the upper limit of the first numerical range, which provides a basis for ensuring that the data corresponding to each client accessing each current limiting server is within a certain range after dynamic balancing is completed.

[0080] S115: Determine the node data set from each of the nodes to be transferred in according to the to-be-balanced data of the nodes to be transferred out and the occupancy differences corresponding to each of the nodes to be transferred in.

[0081] Specifically, the sum of the node allocation amounts corresponding to the node data set is equal to the data to be balanced of the node to be called out, and each node allocation amount in the node data set is not greater than the occupancy difference corresponding to the node to be called in corresponding to the node allocation amount.

[0082] The client access data of this embodiment describes the total occupancy of computing resources, providing a basis for achieving a balanced occupancy of computing resources, thereby enabling the present application to achieve a balanced occupancy of computing resources corresponding to each client accessing the node; by setting the first time length, it avoids inaccurate data caused by a time range that is too wide, which is beneficial to improving the accuracy of the data to be balanced and the node data set corresponding to each of the nodes being calculated.

[0083] In one embodiment, the client access data is used to describe the total proportion of computing resources of the node;

[0084] The step of calculating the to-be-balanced data and the node data set corresponding to each node according to a preset dynamic balancing strategy based on the access data of each client further includes:

[0085] S121: Calculating an average proportion according to the total proportion of each computing resource in the access data of each client;

[0086] The total computing resource ratio is the total ratio of the node's computing resources. The more clients connected, the higher the node's computing resource ratio.

[0087] Specifically, an average value of the total proportions of each computing resource in each client access data is calculated, and the calculated average value is used as the proportion average value.

[0088] S122: Subtract the average proportion from each client access data to obtain a proportion difference;

[0089] Specifically, the average proportion is subtracted from each client access data, and the data obtained by the subtraction is used as the proportion difference corresponding to the client access data.

[0090] The percentage difference can be greater than 0, less than 0, or equal to 0.

[0091] S123: taking the nodes whose proportion difference is greater than the upper limit of the preset second numerical range as nodes to be transferred out, and taking the nodes whose proportion difference is less than the lower limit of the second numerical range as nodes to be transferred in;

[0092] The preset second numerical range is a preset second numerical range. The second numerical range includes an upper limit and a lower limit.

[0093] Specifically, the node whose proportion difference is greater than the upper limit value of the preset second numerical range has a greater business processing pressure, and it is necessary to balance some clients connected to the node to other nodes. Therefore, the node whose proportion difference is greater than the upper limit value of the preset second numerical range is used as the node to be called out; the node whose proportion difference is less than the lower limit value of the second numerical range has a smaller business processing pressure, and it is necessary to increase the number of clients connected to the node. Therefore, the node whose proportion difference is less than the lower limit value of the second numerical range is used as the node to be called in.

[0094] Optionally, the upper limit value of the second numerical range is different from the lower limit value of the second numerical range, and the adjusted client access data of each node after balancing is within a certain range, so as to minimize the impact of dynamic balancing on the client while ensuring the effect of dynamic balancing.

[0095] Optionally, the upper limit value of the second numerical range is the same as the lower limit value of the second numerical range.

[0096] S124: subtracting the upper limit value of the second numerical range from the proportion difference value corresponding to the node to be called out, to obtain the to-be-balanced data corresponding to the node to be called out;

[0097] Specifically, the upper limit value of the second numerical range is subtracted from the proportion difference corresponding to the node to be called out, which provides a basis for ensuring that the corresponding data of each client accessing each current limiting server is within a certain range after dynamic balancing is completed.

[0098] S125: Determine the node data set from each of the nodes to be transferred in according to the to-be-balanced data of the node to be transferred out and each of the proportion differences corresponding to each of the nodes to be transferred in.

[0099] Specifically, the sum of the node allocation amounts corresponding to the node data set is equal to the data to be balanced of the node to be called out, and each node allocation amount in the node data set is not greater than the proportion difference corresponding to the node to be called in corresponding to the node allocation amount.

[0100] The client access data of this embodiment describes the total proportion of computing resources, which provides a basis for balancing the total proportion of computing resources of nodes, thereby enabling this application to achieve a balance in the total proportion of computing resources of each node.

[0101] In one embodiment, the client access data is used to describe the number of clients accessing the node;

[0102] The step of calculating the to-be-balanced data and the node data set corresponding to each node according to a preset dynamic balancing strategy based on the access data of each client further includes:

[0103] S131: Calculating the average access quantity according to the number of each client corresponding to each client access data;

[0104] The number of clients is the number of clients connected to the node.

[0105] Specifically, an average value of each of the client numbers corresponding to each of the client access data is calculated, and the calculated average value is used as the access number average value.

[0106] S132: Subtract the access quantity average from each client access data to obtain an access quantity difference;

[0107] Specifically, the average access quantity is subtracted from each client access data, and the data obtained by the subtraction is used as the access quantity difference corresponding to the client access data.

[0108] The access quantity difference may be greater than 0, less than 0, or equal to 0.

[0109] S133: The node whose access quantity difference is greater than the upper limit of the preset third numerical range is taken as a node to be transferred out, and the node whose access quantity difference is less than the lower limit of the third numerical range is taken as a node to be transferred in;

[0110] Specifically, the node whose access number difference is greater than the upper limit value of the preset third numerical range has a relatively large business processing pressure, and it is necessary to balance some clients accessing the node to other nodes. Therefore, the node whose access number difference is greater than the upper limit value of the preset third numerical range is used as the node to be called out; the node whose access number difference is less than the lower limit value of the third numerical range has a relatively small business processing pressure, and it is necessary to increase the number of clients accessing the node. Therefore, the node whose access number difference is less than the lower limit value of the third numerical range is used as the node to be called in.

[0111] Optionally, the upper limit value of the third numerical range is different from the lower limit value of the third numerical range, and the adjusted client access data of each node after balancing is within a certain range, so as to minimize the impact of dynamic balancing on the client while ensuring the effect of dynamic balancing.

[0112] Optionally, the upper limit value of the third numerical range is the same as the lower limit value of the third numerical range.

[0113] S134: Subtract the upper limit value of the third numerical range from the access quantity difference corresponding to the node to be called out, to obtain the to-be-balanced data corresponding to the node to be called out;

[0114] Specifically, the access quantity difference corresponding to the node to be called out is subtracted from the upper limit value of the third numerical range, which provides a basis for ensuring that the data corresponding to each client accessing each current limiting server is within a certain range after dynamic balancing is completed.

[0115] S135: Determine the node data set from each of the nodes to be transferred in, according to the to-be-balanced data of the nodes to be transferred out and the access quantity differences corresponding to each of the nodes to be transferred in.

[0116] Specifically, the sum of the node allocation amounts corresponding to the node data set is equal to the data to be balanced of the node to be called out, and each node allocation amount in the node data set is not greater than the access quantity difference corresponding to the node to be called in corresponding to the node allocation amount.

[0117] The client access data of this embodiment describes the number of clients accessing the node, and provides a basis for achieving a balance in the number of clients, thereby enabling this application to achieve a balance in the number of clients accessing the node.

[0118] In one embodiment, the connection type of the node includes a long connection or a short connection, the node with the long connection type is used to receive a client to create a long connection, and the node with the short connection type is used to receive a client to create a short connection, and the step of calculating the data to be balanced and the node data set corresponding to each node according to the preset dynamic balancing strategy based on the access data of each client, further includes:

[0119] S14: Based on the access data of each client, the data to be balanced and the node data set corresponding to each node are calculated according to the dynamic balancing strategy, wherein each connection type corresponding to the node data set is the same as the connection type corresponding to the node data set.

[0120] Specifically, each connection type corresponding to the node data set is the same as the connection type corresponding to the node data set, providing a basis for clients with long connections to be balanced to the nodes with long connection type and clients with short connections to be balanced to the nodes with short connection type.

[0121] It can be understood that in another embodiment of the present application, there is no need to distinguish the connection type.

[0122] This embodiment implements classified services by allowing a node to accept only one type of connection, thereby further improving the stability of the current limiting service provided by the current limiting cluster.

[0123] In one embodiment, the step of determining, according to the data to be balanced and the node data set, each client to be balanced and the target node data corresponding to each client to be balanced according to a preset screening strategy includes:

[0124] S31: Obtain the number of data packets of each client accessing the node within a second time period;

[0125] Packet Quantity is the number of packets.

[0126] Specifically, when the node receives the data to be balanced and the node data set, it calculates the number of data packets of each client accessing the node within the second time period, taking the reception completion time of the data to be balanced and the node data set as the end time.

[0127] S32: sorting the clients connected to the node in positive order according to the number of the data packets;

[0128] Specifically, the clients accessing the node are sorted in positive order according to the number of data packets, so that the number of data packets of the clients at the front is smaller than the number of data packets of the clients at the back.

[0129] S33: adopting a method of screening from scratch, according to the data to be balanced of the node, screening the client from the sorted clients as the client to be balanced;

[0130] Specifically, the client is screened from the sorted clients according to the data to be balanced of the node by screening from the beginning, so as to first screen out the client with the smallest number of data packets as the client to be balanced.

[0131] S34: According to the client to be balanced, node data is obtained from the node data set as the target node data.

[0132] Specifically, according to the client to be balanced, node data is randomly obtained from the node data set as the target node data. During this process, it is necessary to ensure that the data corresponding to all the clients to be balanced corresponding to the target node data (the data is of the same type as the data related to the client accessing the node in the client access data) does not exceed the node allocation amount corresponding to the target node data.

[0133] This embodiment selects the clients with the smallest number of data packets as the clients to be balanced, thereby helping to reduce the impact on interactive clients and further improving the stability of the current limiting service provided by the current limiting cluster.

[0134] See also Figure 3 As shown, in one embodiment, a dynamic balanced connection system of a current limiting cluster is provided, the system is applied to the current limiting cluster, the current limiting cluster includes a plurality of nodes, each of the nodes is divided into a main node and each sub-node, the system includes:

[0135] The dynamic balancing evaluation module 801 is used for the master node to obtain the client access data corresponding to each of the nodes, and calculate the to-be-balanced data and node data set corresponding to each of the nodes according to the preset dynamic balancing strategy based on the client access data;

[0136] A data distribution module 802 is used for the master node to send the to-be-balanced data and the node data set corresponding to the child node to the child node;

[0137] The client screening module 803 is used for the node to determine each client to be balanced and the target node data corresponding to each client to be balanced according to the data to be balanced and the node data set and a preset screening strategy;

[0138] The dynamic balancing execution module 804 is used for the node to send a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnect the connection with the client to be balanced, wherein the client to be balanced is used to re-establish the connection according to the reconnection notification.

[0139] This embodiment realizes dynamic balancing of clients connected to each node in the current limiting cluster, thereby improving the stability of the current limiting service provided by the current limiting cluster; by setting a node in the current limiting cluster as the master node, no additional hardware equipment is required, thereby reducing the implementation cost of this application; determining the client to be balanced through a preset screening strategy is conducive to further improving the stability of the current limiting service provided by the current limiting cluster.

[0140] In one embodiment, the system further comprises: a master node election module;

[0141] The master node election module is used to determine whether the master node exists in the current limiting cluster when the node is powered on, and if not, execute the preset master node election method; after the node is powered on, determine whether the master node exists in the current limiting cluster according to a preset time interval, and if not, execute the master node election method.

[0142] In this embodiment, the node actively elects the master node when the startup is completed, which is conducive to quickly determining the master node when the current limiting cluster is restarted; and after the startup is completed, it actively elects the master node regularly according to the preset time interval, so that when the master node goes down, a new master node can be quickly determined, which is conducive to further improving the stability of the current limiting service provided by the current limiting cluster.

[0143] In one embodiment, the client access data is used to describe the total usage of computing resources corresponding to each client accessing the node within the first time period;

[0144] The dynamic balance evaluation module 801 is further used for:

[0145] Calculate the average total occupancy according to the total occupancy of each computing resource in the access data of each client;

[0146] Subtract the average occupancy value from each client access data to obtain an occupancy difference;

[0147] The nodes whose occupancy difference is greater than the upper limit of the preset first numerical range are regarded as nodes to be transferred out, and the nodes whose occupancy difference is less than the lower limit of the first numerical range are regarded as nodes to be transferred in;

[0148] Subtract the upper limit value of the first value range from the occupancy difference value corresponding to the node to be called out to obtain the to-be-balanced data corresponding to the node to be called out;

[0149] The node data set is determined from each of the nodes to be transferred in according to the to-be-balanced data of the node to be transferred out and the occupancy differences corresponding to each of the nodes to be transferred in.

[0150] The client access data of this embodiment describes the total occupancy of computing resources, providing a basis for achieving a balanced occupancy of computing resources, thereby enabling the present application to achieve a balanced occupancy of computing resources corresponding to each client accessing the node; by setting the first time length, it avoids inaccurate data caused by a time range that is too wide, which is beneficial to improving the accuracy of the data to be balanced and the node data set corresponding to each of the nodes being calculated.

[0151] In one embodiment, the client access data is used to describe the total proportion of computing resources of the node;

[0152] The dynamic balance evaluation module 801 is further used for:

[0153] Calculate the average proportion of each computing resource in the access data of each client according to the total proportion of each computing resource;

[0154] Subtract the average proportion from each client access data to obtain a proportion difference;

[0155] The nodes whose proportion difference is greater than the upper limit of the preset second numerical range are taken as nodes to be transferred out, and the nodes whose proportion difference is less than the lower limit of the second numerical range are taken as nodes to be transferred in;

[0156] Subtract the upper limit value of the second numerical range from the proportion difference value corresponding to the node to be called out, to obtain the to-be-balanced data corresponding to the node to be called out;

[0157] The node data set is determined from each of the nodes to be transferred in according to the to-be-balanced data of the node to be transferred out and each of the proportion differences corresponding to each of the nodes to be transferred in.

[0158] The client access data of this embodiment describes the total proportion of computing resources, which provides a basis for balancing the total proportion of computing resources of nodes, thereby enabling this application to achieve a balance in the total proportion of computing resources of each node.

[0159] In one embodiment, the client access data is used to describe the number of clients accessing the node;

[0160] The dynamic balance evaluation module 801 is further used for:

[0161] Calculate the average access quantity according to the number of each client corresponding to each client access data;

[0162] Subtract the access quantity average from each client access data to obtain an access quantity difference;

[0163] The node whose access quantity difference is greater than the upper limit of the preset third numerical range is used as a node to be transferred out, and the node whose access quantity difference is less than the lower limit of the third numerical range is used as a node to be transferred in;

[0164] Subtracting the upper limit value of the third value range from the access quantity difference corresponding to the node to be called out, to obtain the to-be-balanced data corresponding to the node to be called out;

[0165] The node data set is determined from each of the nodes to be transferred in according to the to-be-balanced data of the nodes to be transferred out and the access quantity differences corresponding to each of the nodes to be transferred in.

[0166] The client access data of this embodiment describes the number of clients accessing the node, and provides a basis for achieving a balance in the number of clients, thereby enabling this application to achieve a balance in the number of clients accessing the node.

[0167] In one embodiment, the connection type of the node includes a long connection or a short connection, the node with the long connection type is used to receive a client to create a long connection, and the node with the short connection type is used to receive a client to create a short connection. The dynamic balancing evaluation module 801 is further used to:

[0168] According to each of the client access data, the data to be balanced and the node data set corresponding to each of the nodes are calculated according to the dynamic balancing strategy, wherein each of the connection types corresponding to the node data set is the same as the connection type corresponding to the node data set.

[0169] This embodiment implements classified services by allowing a node to accept only one type of connection, thereby further improving the stability of the current limiting service provided by the current limiting cluster.

[0170] In one embodiment, the client screening module 803 is further used to:

[0171] Obtaining the number of data packets of each client accessing the node within a second time period;

[0172] According to the number of the data packets, the clients accessing the node are sorted in positive order;

[0173] Adopting a method of screening from scratch, according to the to-be-balanced data of the node, screening the client from the sorted clients as the to-be-balanced client;

[0174] According to the client to be balanced, node data is obtained from the node data set as the target node data.

[0175] This embodiment selects the clients with the smallest number of data packets as the clients to be balanced, thereby helping to reduce the impact on interactive clients and further improving the stability of the current limiting service provided by the current limiting cluster.

[0176] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a connection. When the computer program is executed by the processor, it realizes the functions or steps on the server side of a dynamic balanced connection method for a current limiting cluster.

[0177] In one embodiment, a computer device is proposed, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, a dynamic balanced connection method of a current limiting cluster is implemented. The method is applied to a current limiting cluster, and the current limiting cluster includes a plurality of nodes, each of which is divided into a main node and each sub-node. The method includes:

[0178] The master node obtains the client access data corresponding to each of the nodes, and calculates the to-be-balanced data and the node data set corresponding to each of the nodes according to the preset dynamic balancing strategy based on the client access data;

[0179] The master node sends the to-be-balanced data and the node data set corresponding to the child node to the child node;

[0180] The node determines each client to be balanced and the target node data corresponding to each client to be balanced according to the data to be balanced and the node data set and a preset screening strategy;

[0181] The node sends a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnects the connection with the client to be balanced, wherein the client to be balanced is used to re-establish the connection according to the reconnection notification.

[0182] This embodiment realizes dynamic balancing of clients connected to each node in the current limiting cluster, thereby improving the stability of the current limiting service provided by the current limiting cluster; by setting a node in the current limiting cluster as the master node, no additional hardware equipment is required, thereby reducing the implementation cost of this application; determining the client to be balanced through a preset screening strategy is conducive to further improving the stability of the current limiting service provided by the current limiting cluster.

[0183] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, a dynamic balanced connection method of a current limiting cluster is implemented. The method is applied to a current limiting cluster, and the current limiting cluster includes multiple nodes, each of which is divided into a main node and each sub-node. The method includes:

[0184] The master node obtains the client access data corresponding to each of the nodes, and calculates the to-be-balanced data and the node data set corresponding to each of the nodes according to the preset dynamic balancing strategy based on the client access data;

[0185] The master node sends the to-be-balanced data and the node data set corresponding to the child node to the child node;

[0186] The node determines each client to be balanced and the target node data corresponding to each client to be balanced according to the data to be balanced and the node data set and a preset screening strategy;

[0187] The node sends a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnects the connection with the client to be balanced, wherein the client to be balanced is used to re-establish the connection according to the reconnection notification.

[0188] This embodiment realizes dynamic balancing of clients connected to each node in the current limiting cluster, thereby improving the stability of the current limiting service provided by the current limiting cluster; by setting a node in the current limiting cluster as the master node, no additional hardware equipment is required, thereby reducing the implementation cost of this application; determining the client to be balanced through a preset screening strategy is conducive to further improving the stability of the current limiting service provided by the current limiting cluster.

[0189] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.

[0190] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0191] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.

[0192] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A dynamic balanced connection method for a current limiting cluster, the method being applied to a current limiting cluster, the current limiting cluster comprising a plurality of nodes, each of the nodes being divided into a main node and each sub-node, the method comprising: The master node obtains the client access data corresponding to each of the nodes, and calculates the to-be-balanced data and the node data set corresponding to each of the nodes according to the preset dynamic balancing strategy based on the client access data; The master node sends the to-be-balanced data and the node data set corresponding to the child node to the child node; The node determines each client to be balanced and the target node data corresponding to each client to be balanced according to the data to be balanced and the node data set and a preset screening strategy; The node sends a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnects the connection with the client to be balanced, wherein the client to be balanced is used to re-establish the connection according to the reconnection notification.

2. The method for dynamically balancing the connection of a current-limiting cluster according to claim 1, characterized in that: The method further comprises: When the node is started up, it is determined whether the current limiting cluster has the master node. If not, a preset master node election method is executed; After the node is powered on, it is determined whether the current limiting cluster has the master node according to a preset time interval. If not, the master node election method is executed.

3. The method for dynamically balancing the connection of a current-limiting cluster according to claim 1, characterized in that: The client access data is used to describe the total usage of computing resources corresponding to each client accessing the node within the first time period; The step of calculating the data to be balanced and the node data set corresponding to each node according to the preset dynamic balancing strategy based on the access data of each client includes: Calculate the average total occupancy according to the total occupancy of each computing resource in the access data of each client; Subtract the average occupancy value from each client access data to obtain an occupancy difference; The nodes whose occupancy difference is greater than the upper limit of the preset first numerical range are regarded as nodes to be transferred out, and the nodes whose occupancy difference is less than the lower limit of the first numerical range are regarded as nodes to be transferred in; Subtract the upper limit value of the first value range from the occupancy difference value corresponding to the node to be called out to obtain the to-be-balanced data corresponding to the node to be called out; The node data set is determined from each of the nodes to be transferred in according to the to-be-balanced data of the node to be transferred out and the occupancy differences corresponding to each of the nodes to be transferred in.

4. The method for dynamically balancing the connection of a current-limiting cluster according to claim 1, characterized in that: The client access data is used to describe the total proportion of computing resources of the node; The step of calculating the to-be-balanced data and the node data set corresponding to each node according to a preset dynamic balancing strategy based on the access data of each client further includes: Calculate the average proportion of each computing resource in the access data of each client according to the total proportion of each computing resource; Subtract the average proportion from each client access data to obtain a proportion difference; The nodes whose proportion difference is greater than the upper limit of the preset second numerical range are taken as nodes to be transferred out, and the nodes whose proportion difference is less than the lower limit of the second numerical range are taken as nodes to be transferred in; Subtract the upper limit value of the second numerical range from the proportion difference value corresponding to the node to be called out, to obtain the to-be-balanced data corresponding to the node to be called out; The node data set is determined from each of the nodes to be transferred in according to the to-be-balanced data of the node to be transferred out and each of the proportion differences corresponding to each of the nodes to be transferred in.

5. The method for dynamically balancing connection of a current-limiting cluster according to claim 1, characterized in that: The client access data is used to describe the number of clients accessing the node; The step of calculating the to-be-balanced data and the node data set corresponding to each node according to a preset dynamic balancing strategy based on the access data of each client further includes: Calculate the average access quantity according to the number of each client corresponding to each client access data; Subtract the access quantity average from each client access data to obtain an access quantity difference; The node whose access quantity difference is greater than the upper limit of the preset third numerical range is used as a node to be transferred out, and the node whose access quantity difference is less than the lower limit of the third numerical range is used as a node to be transferred in; Subtracting the upper limit value of the third value range from the access quantity difference corresponding to the node to be called out, to obtain the to-be-balanced data corresponding to the node to be called out; The node data set is determined from each of the nodes to be transferred in according to the to-be-balanced data of the nodes to be transferred out and the access quantity differences corresponding to each of the nodes to be transferred in.

6. The method for dynamically balancing the connection of a current-limiting cluster according to claim 1, characterized in that: The connection type of the node includes a long connection or a short connection. The node with the long connection type is used to receive a client to create a long connection, and the node with the short connection type is used to receive a client to create a short connection. The step of calculating the to-be-balanced data and the node data set corresponding to each node according to the preset dynamic balancing strategy based on the access data of each client also includes: According to each of the client access data, the data to be balanced and the node data set corresponding to each of the nodes are calculated according to the dynamic balancing strategy, wherein each of the connection types corresponding to the node data set is the same as the connection type corresponding to the node data set.

7. The method for dynamically balancing connection of a current-limiting cluster according to claim 1, characterized in that: The step of determining, according to the data to be balanced and the node data set, each client to be balanced and the target node data corresponding to each client to be balanced according to a preset screening strategy includes: Obtaining the number of data packets of each client accessing the node within a second time period; According to the number of the data packets, the clients accessing the node are sorted in positive order; Adopting a method of screening from scratch, according to the to-be-balanced data of the node, screening the client from the sorted clients as the to-be-balanced client; According to the client to be balanced, node data is obtained from the node data set as the target node data.

8. A dynamic balanced connection system for a current limiting cluster, the system being applied to the current limiting cluster, the current limiting cluster comprising a plurality of nodes, each of the nodes being divided into a main node and each sub-node, the system comprising: A dynamic balancing evaluation module is used for the master node to obtain the client access data corresponding to each of the nodes, and calculate the to-be-balanced data and node data set corresponding to each of the nodes according to the preset dynamic balancing strategy based on the client access data; A data distribution module, used for the master node to send the to-be-balanced data and the node data set corresponding to the child node to the child node; The client screening module is used for the node to determine each client to be balanced and the target node data corresponding to each client to be balanced according to the data to be balanced and the node data set and a preset screening strategy; A dynamic balancing execution module is used for the node to send a reconnection notification to the client to be balanced corresponding to the target node data according to the target node data, and disconnect the connection with the client to be balanced, wherein the client to be balanced is used to re-establish the connection according to the reconnection notification.

9. A computer-readable storage medium, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the dynamic balanced connection method of the current limiting cluster as claimed in any one of claims 1 to 7 are implemented.

10. A computer device, wherein the computer-readable storage medium stores a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for dynamically balancing connection of a current limiting cluster as claimed in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Resource regulation and control method, device and system, electronic equipment and storage medium

    CN121691826A