CN116566916A - Cluster service flow limiting management method, device, equipment and medium - Google Patents
Cluster service flow limiting management method, device, equipment and medium Download PDFInfo
- Publication number
- CN116566916A CN116566916A CN202310544867.2A CN202310544867A CN116566916A CN 116566916 A CN116566916 A CN 116566916A CN 202310544867 A CN202310544867 A CN 202310544867A CN 116566916 A CN116566916 A CN 116566916A
- Authority
- CN
- China
- Prior art keywords
- token
- queue
- redistribution
- tokens
- cluster service
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000007726 management method Methods 0.000 title claims abstract description 64
- 235000019580 granularity Nutrition 0.000 claims abstract description 93
- 238000000034 method Methods 0.000 claims description 33
- 238000012545 processing Methods 0.000 claims description 20
- 230000009467 reduction Effects 0.000 claims description 7
- 238000004590 computer program Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 description 15
- 239000002699 waste material Substances 0.000 description 11
- 238000010586 diagram Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 6
- 238000011161 development Methods 0.000 description 4
- 238000011084 recovery Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/215—Flow control; Congestion control using token-bucket
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/50—Queue scheduling
- H04L47/52—Queue scheduling by attributing bandwidth to queues
- H04L47/527—Quantum based scheduling, e.g. credit or deficit based scheduling or token bank
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/10015—Access to distributed or replicated servers, e.g. using brokers
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The embodiment of the invention discloses a cluster service current limiting management method, a device, equipment and a medium, wherein the cluster service current limiting management method comprises the following steps: distributing and planning the residual tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities to obtain at least two token redistribution quantity queues which have the same data in each queue and have the value corresponding to the preset token redistribution granularities; under the condition of obtaining the token redistribution request of any cluster service node, reading one queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data; and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely. The technical scheme of the embodiment can improve the accuracy of the flow limiting management of the service cluster and the token utilization rate.
Description
Technical Field
The embodiment of the invention relates to the technical field of network communication, in particular to a cluster service current limiting management method, device, equipment and medium.
Background
The access flow limit management of the service cluster is realized by a Token (Token) service center managing the Token usage number of service request consuming nodes (consumers) in the service cluster. The token service center pre-distributes a certain number of tokens to each consumer of the service cluster, and then distributes a fixed number of new tokens to each consumer again according to the token request of each consumer until the certain number of tokens are distributed.
However, in the process of implementing the present invention, it is found that at least the following technical problems exist in the prior art: because of the different consumption capacities of the service requests of different subscribers, each time a fixed number of new tokens are allocated to each subscriber, some of the subscribers cannot consume new service requests after the subscribers have been used, some of the subscribers have the rest but have no new service requests, so that part of the tokens are wasted, and the access restriction management is not accurate enough.
Disclosure of Invention
The embodiment of the invention provides a cluster service flow limit management method, device, equipment and medium, which can more flexibly distribute tokens to cluster service nodes so that the flow limit management of a service cluster is more accurate.
In a first aspect, an embodiment of the present invention provides a method for cluster service current limiting management, where the method includes:
Distributing and planning the residual tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities to obtain at least two token redistribution quantity queues which have the same data in each queue and have the value corresponding to the preset token redistribution granularities;
under the condition of obtaining the token redistribution request of any cluster service node, reading one queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data;
and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
In a second aspect, an embodiment of the present invention further provides a cluster service current limiting management device, where the device includes:
the token allocation planning module is used for carrying out allocation planning on the remaining tokens to be allocated after the pre-allocation according to at least two preset token allocation granularities to obtain at least two token allocation quantity queues which have the same data in each queue and have the value corresponding to the preset token allocation granularities;
the token allocation request acquisition module is used for reading the queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data under the condition of acquiring token redistribution requests of any cluster service node;
And the token distribution module is used for distributing tokens with the number of tokens corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
In a third aspect, an embodiment of the present invention further provides a computer apparatus, including:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement a cluster service flow restriction management method as provided by any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored, where the program when executed by a processor implements a cluster service current limit management method as provided in any embodiment of the present invention.
According to the technical scheme, distribution planning is performed on the remaining tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities, so that at least two token redistribution quantity queues which are the same in data in each queue and correspond to the preset token redistribution granularities in value are obtained; then, under the condition of obtaining token reassignment of any cluster service node, reading one queue data with the largest value in the unread queue data in the token reassignment quantity queues as target queue data; and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token reallocation number queue are read completely. The allocation of the tokens is managed more directly through the queue data, so that the token allocation mode with finer granularity can be used for meeting the token demands of the cluster service nodes, and the waste of excessive tokens in the cluster service nodes with less service request processing capacity is reduced. The technical scheme of the embodiment solves the problem of low current limiting accuracy in cluster current limiting management, realizes finer granularity current limiting management, reduces the waste of tokens and improves the accuracy of the current limiting management to a certain extent.
Drawings
Fig. 1 is a flowchart of a cluster service current limiting management method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a cluster service current limiting management example according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a working process of a cluster service node according to an embodiment of the present invention;
fig. 4 is a flowchart of a cluster service current limiting management method according to an embodiment of the present invention;
fig. 5 is a flowchart of a cluster service current limiting management method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a cluster service current limiting management device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Fig. 1 is a flowchart of a cluster service flow limit management method according to an embodiment of the present invention, where the embodiment is applicable to a scenario of flow limit management in a concurrent service process of a service cluster. The method can be executed by a cluster service flow limit management device which can be realized by software and/or hardware and is integrated into a computer device with an application development function.
As shown in fig. 1, the cluster service current limiting management method of the present embodiment includes the following steps:
s110, carrying out distribution planning on the residual tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities to obtain at least two token redistribution quantity queues which have the same data in each queue and have the value corresponding to the preset token redistribution granularities.
After the token is pre-allocated, the token service center performs token allocation to the corresponding cluster service node again according to the acquired token redistribution request, including each token allocation after the pre-allocation. The preset token redistribution granularity may be understood as granularity at which the token service center redistributes tokens to the cluster service nodes according to the acquired token redistribution request, that is, after pre-distribution, the token service nodes are distributed with the number of tokens each time. The at least two preset token redistribution granularities are that the number of tokens which are singly distributed to the cluster service node by the instruction board service center is different, and the token redistribution granularities comprise at least two different distribution numbers, namely, in the token redistribution stage, the token redistribution stage comprises different degrees of current limiting degree, and the size of the single distribution granularities corresponds to the size of the current limiting degree.
When each cluster service node requests a new token again from the token service center after the pre-allocated tokens are used, the token service center divides the tokens again to each cluster service node according to a preset fixed allocation quantity in general, namely, only one token redistribution granularity is provided, which leads to different use cases of the tokens of the cluster service nodes with different service request processing capacities, some node tokens are not used enough, some node tokens are remained, the overall analysis of the current limiting management of concurrent tasks is performed, and the current limiting management is not accurate enough, so that the tokens are not fully utilized.
In the present application, the allocation planning is performed on the tokens to be allocated in advance, and particularly, the allocation planning is performed on the remaining tokens to be allocated after the pre-allocation based on different preset token redistribution granularities, which may be that the token service center refines cluster current limiting management more, and the management accuracy is improved.
Specifically, the allocation planning is performed on the remaining tokens to be allocated after the pre-allocation according to at least two preset token redistribution granularities, and the method comprises the following steps:
firstly, establishing a functional relation between preset token reassignment granularity and the number of queue data and the number of remaining tokens to be assigned in a corresponding token reassignment number queue; and then analyzing the established functional relation to obtain at least two token reassignment quantity queues which have the same data in each queue and have the value corresponding to the preset token reassignment granularity.
Wherein the number of remaining tokens to be allocated is a value determined by subtracting the number of pre-allocated tokens from the total number of preset allocable tokens. Assuming that the total number of preset allocable tokens is 400, 30 tokens can be pre-allocated to each cluster service node, and total 4 cluster service nodes are allocated, then the number of the remaining tokens to be allocated is 400-30×4=280.
And then, under the constraint that the sum of the product values is smaller than or equal to the number of the remaining tokens to be distributed, the number of the queue data in the token redistribution number queues is a positive integer, and the minimum redistribution granularity in the preset token redistribution granularity is 1, analyzing and determining the number of the queue data in each token redistribution number queue, thereby obtaining at least two token redistribution number queues which are the same in data in each queue and correspond to the preset token redistribution granularity as a result of a token pre-distribution plan.
And S120, under the condition that the token redistribution request of any cluster service node is acquired, reading one queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data.
When the pre-allocated tokens are used up or the tokens which are required to be acquired again are used up, each cluster service node sends a token redistribution request to a token service center so as to acquire more tokens. When the token service center obtains the token reassignment request of any cluster service node, the token service center distributes the token according to the token pre-distribution strategy planned in the step.
Specifically, in the running process of the cluster service, cluster flow limiting management is a progressive process by managing a token allocation process, and firstly, queue data is read from a token reallocation quantity queue corresponding to a larger allocation granularity in each preset token reallocation granularity to serve as the quantity of token reallocation; and after all the queue data in one token redistribution quantity queue are read, reading the queue data in the token redistribution quantity queue corresponding to the next preset token redistribution granularity as the token redistribution quantity. I.e. as the processing of concurrent traffic advances, the number of single token assignments will decrease until all remaining tokens to be assigned have been assigned. In the process, the number of tokens distributed at a time can be reduced, so that the situation that a large number of tokens are distributed to a certain cluster service node and cannot be used and token waste occurs is avoided. In a preferred embodiment, the minimum pre-set token reassignment granularity may be set to 1, so each token is reasonably assigned.
The maximum number of the queue data which is not read in the queue data with the number of the re-allocated tokens is taken as target queue data, namely the maximum number of the tokens which can be allocated currently.
S130, allocating tokens with the token numbers corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
After the number of tokens allocated at the present time is determined according to the planned token allocation policy, a corresponding number of tokens may be directly allocated to the corresponding cluster service node from which the request is issued.
For each acquired token redistribution request, the number of the allocable tokens can be determined from the token redistribution number queue until the queue data in the token redistribution number queue are read, namely, all allocable tokens are allocated.
According to the technical scheme, distribution planning is performed on the remaining tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities, so that at least two token redistribution quantity queues which are the same in data in each queue and correspond to the preset token redistribution granularities in value are obtained; then, under the condition of obtaining token reassignment of any cluster service node, reading one queue data with the largest value in the unread queue data in the token reassignment quantity queues as target queue data; and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token reallocation number queue are read completely. The allocation of the tokens is managed more directly through the queue data, so that the token allocation mode with finer granularity can be used for meeting the token demands of the cluster service nodes, and the waste of excessive tokens in the cluster service nodes with less service request processing capacity is reduced. The technical scheme of the embodiment solves the problem of low current limiting accuracy in cluster current limiting management, realizes finer granularity current limiting management, reduces the waste of tokens and improves the accuracy of the current limiting management to a certain extent.
In a specific cluster current limiting management scenario, two preset token reassignment granularities, 20 and 1, are preset, and the remaining tokens to be assigned after pre-assignment are assigned and planned to obtain two token reassignment quantity queues which have the same data in each queue and have the value corresponding to the preset token reassignment granularities, as shown in fig. 2. Specifically, the Token (Token) service center needs to calculate according to the number of cluster service nodes (containers), the total threshold of current limit (the number of all allocable tokens), the number of tokens pre-allocated by each container, and the number of tokens pulled in a batch (i.e. the preset Token redistribution granularity), so as to obtain two Token redistribution quantity queues. Deposited in the first token redistribution number queue is a larger granularity single token distribution number of 20. The second Token reassignment quantity queue assigns a Token to each batch, which is a single Token assignment quantity of smaller granularity. The number of the queue data in the two queues is determined according to the following formula: 20x+y+4 x 30< = 400, 20x+4 x 30<400, y > = 1. Wherein x represents the number of queue data in the first token redistribution number queue, y represents the number of queue data in the second token redistribution number queue, 400 is the number of all allocable tokens, 4 represents the number of cluster service nodes, and 30 pre-allocates the number of tokens for each cluster service node. And analyzing the functional relation corresponding to the formula to obtain that the number of the queue data in the first token redistribution quantity queue is 13, and the number of the queue data in the second token redistribution quantity queue is 20. That is, the token service center allocates 20 new tokens to the corresponding cluster service nodes for the previous 13 acquired token redistribution requests, and allocates 1 new token to the corresponding cluster service nodes for the next 20 acquired token redistribution requests after 13.
Assume that each cluster service node, as shown in fig. 3, begins to request token reassignment from the token service center to acquire a new token after using the pre-assigned 30 tokens cached by each node. Accordingly, the token service center can obtain queue data from the first token redistribution quantity queue preferentially, and the obtained token redistribution request is used as response to distribute new token quantity to the corresponding cluster service node. And after the queue data in the first token redistribution quantity queue is consumed, responding to the subsequent token redistribution request to acquire the queue data from the second token redistribution quantity queue, and allocating new token quantity to the corresponding cluster service node as the acquired token redistribution request, wherein if the data of both queues are consumed, the token service center refuses the corresponding token redistribution request. If the requests of the cluster service nodes with the same consumption capacity are uniformly distributed, the tokens can be effectively and fully utilized, so that the accuracy of cluster current limiting is improved. In fig. 3, provider is a cluster of a distributed system, and is a producer that provides services to cluster service nodes (subscribers).
Fig. 4 is a flowchart of a cluster service flow-limiting management method according to an embodiment of the present invention, where the embodiment and the cluster service flow-limiting management method in the foregoing embodiment belong to the same inventive concept, and further describes a process of performing token recovery for a cluster service node with a smaller service request amount. The method can be executed by a cluster service flow limit management device which can be realized by software and/or hardware and is integrated into a computer device with an application development function.
As shown in fig. 4, the cluster service current limiting management method of the present embodiment includes the following steps:
and S210, carrying out allocation planning on the residual tokens to be allocated after pre-allocation according to at least two preset token allocation granularities to obtain at least two token allocation quantity queues which have the same data in each queue and have the value corresponding to the preset token allocation granularities.
And S220, under the condition that the token redistribution request of any cluster service node is acquired, reading one queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data.
S230, allocating tokens with the token numbers corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
S240, obtaining service request processing amount data of each cluster service node, and determining the number of target tokens according to the service request processing amount data to adjust the cluster service nodes.
In the process of managing the allocation of the tokens, the token service center also obtains service request processing amount data of each cluster service node through a preset thread so as to judge the processing capacity of the cluster service node for the service request of the user. The service request throughput data may be a millisecond-level data monitoring result of a Query Per Second (QPS) of each cluster service node. QPS is a measure of how much traffic a particular query server handles in a given time, and can measure the performance of the machine of the system server. Furthermore, the cluster service node with a smaller QPS value can be used as the target token number to adjust the cluster service node.
S250, under the condition that a token reassignment stage corresponding to a preset flow limiting reassignment granularity is entered, obtaining the remaining tokens to be used of the target token quantity adjustment cluster service node, and updating the queue data of the token reassignment quantity queue according to the quantity of the remaining tokens to be used.
Wherein the preset flow-limiting reassignment granularity is a smaller granularity value of the preset token reassignment granularity. The token reassignment stage corresponding to the preset flow-limiting reassignment granularity can be understood as a stage with a smaller number of assigned tokens, such as only 1 token, 3 tokens or other tokens with a smaller number at a time, when responding to the token reassignment request of the cluster service node. In this phase, it is indicated that the current limit threshold time is reached soon, i.e. that all tokens have been allocated.
And in the token reassignment stage corresponding to the preset flow limiting reassignment granularity, a token recovery mechanism can be started for the target token quantity adjustment cluster service node to acquire the remaining tokens to be used by the target token quantity adjustment cluster service node, and the queue data of the token reassignment quantity queue is updated according to the quantity of the remaining tokens to be used so as to enable other non-target token quantity adjustment cluster service nodes to use.
Specifically, when the queue data of the token redistribution number queue is updated according to the number of the remaining tokens to be used, the number of the remaining tokens to be used can be distributed to the corresponding token redistribution number queue according to the numerical value of the preset token redistribution granularity corresponding to the queue in which the queue data in the token redistribution number queue is not completely read until the number of the remaining tokens to be used is distributed. For example, in the cluster service node 4 shown in fig. 3, 23 remaining tokens to be used are acquired. The queue of which the queue data is not completely read in the token redistribution quantity queue comprises two token redistribution quantity queues with the values of 3 and 1 of the queue data; then, the token reassignment number queue with a value of 3 for queue data would be increased by 7 queue data, and the token reassignment number queue with a value of 1 for queue data would be increased by 2 queue data. Taking the number of the remaining tokens to be used as a dividend, presetting a granularity value with relatively larger token redistribution granularity in a queue with incomplete read of the queue data in the token redistribution number queue as a divisor, obtaining the quotient as the number of newly increased queue data of a queue with relatively larger token redistribution granularity in a queue with incomplete read of the queue data in the token redistribution number queue, and using the remainder as the queue data of a queue with relatively smaller token redistribution granularity in a queue with incomplete read of the queue data in the token redistribution number queue.
After the queue data of the token redistribution number queue is updated, when the token service center receives the token redistribution request, the token service center reads the corresponding queue data from the updated token redistribution number queue, and performs token distribution according to the read queue data. By the residual token reassignment mechanism in the steps, the distributable token can be fully used, and the accuracy of cluster current limiting is improved.
According to the technical scheme, distribution planning is performed on the remaining tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities, so that at least two token redistribution quantity queues which are the same in data in each queue and correspond to the preset token redistribution granularities in value are obtained; then, under the condition of obtaining token reassignment of any cluster service node, reading one queue data with the largest value in the unread queue data in the token reassignment quantity queues as target queue data; and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token reallocation number queue are read, and reallocating unused tokens of the cluster service node with weaker service request capacity in the process, so that the accuracy of flow restriction is improved. The allocation of the tokens is managed more directly through the queue data, so that the token allocation mode with finer granularity can be used for meeting the token demands of the cluster service nodes, and the waste of excessive tokens in the cluster service nodes with less service request processing capacity is reduced. The technical scheme of the embodiment solves the problem of low current limiting accuracy in cluster current limiting management, realizes finer granularity current limiting management, reduces the waste of tokens and improves the accuracy of the current limiting management to a certain extent.
Fig. 5 is a flowchart of a cluster service current limiting management method according to an embodiment of the present invention, where the embodiment and the cluster service current limiting management method in the foregoing embodiment belong to the same inventive concept, and further describe a situation of dynamically adjusting a cluster service current limiting threshold when a cluster service node fails. The method can be executed by a cluster service flow limit management device which can be realized by software and/or hardware and is integrated into a computer device with an application development function.
As shown in fig. 5, the cluster service current limiting management method of the present embodiment includes the following steps:
and S310, carrying out allocation planning on the residual tokens to be allocated after the pre-allocation according to at least two preset token allocation granularities to obtain at least two token allocation quantity queues which have the same data in each queue and have the value corresponding to the preset token allocation granularities.
And S320, under the condition that the token redistribution request of any cluster service node is acquired, reading one queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data.
S330, allocating tokens with the token numbers corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
S340, acquiring network connection state information and CPU utilization rate information of each cluster service node, and determining fault states of each cluster service node based on the network connection state information and/or the CPU utilization rate information.
In the process of managing the allocation of the tokens, the token service center can also acquire the working state of each cluster service node through a preset thread to find out the node with faults or excessively high CPU utilization rate. In the cluster service node, if a certain machine fails, such as a CPU is too high or stops servicing, and the total current limiting threshold (the total number of tokens which can be distributed for use) is unchanged, the cluster service node which can normally operate other machines can bear larger flow, and the situation that other machines are down due to incapacity of bearing the large flow and cause the whole cluster avalanche (collapse) can be caused, and then the total current limiting threshold needs to be adjusted to prevent the situation.
Specifically, in the working process of the working state supervision thread of the cluster service node, information of the node working state, such as heartbeat signals of the service cluster service nodes for determining the connection state, CPU utilization rate of the machine equipment and the like, is obtained. The configuration function module of the corresponding token service center determines the fault state of each cluster service node according to the acquired working state information of each cluster service node. Wherein the fault condition is either a fault condition or a non-fault condition. The failure state may be that the device of the cluster service node is in an offline state or that the CPU utilization is higher than a preset utilization threshold (e.g., a preset value such as 85%).
S350, adjusting the number of the current remaining tokens to be allocated based on the number of the cluster service nodes in the fault state.
In the process of adjusting the current limiting threshold value, firstly, determining the percentage of the number of the cluster service nodes in a fault state to the total number of the cluster service nodes; then, determining the number of tokens needing to be reduced in the current remaining tokens to be distributed based on the percentage, namely the number of tokens to be reduced; the result obtained by subtracting the token reduction data from the total number of allocable tokens is the dynamically adjusted current limit threshold. The token reduction number is the product value of the number of the currently remaining tokens to be distributed and the percentage.
Further, the token service center updates the current token redistribution number queue according to the adjusted throttling threshold. Specifically, according to the value size of the preset token reassignment granularity corresponding to the queue of which the queue data is not completely read in the token reassignment number queue, the corresponding queue data in the queue of which the queue data is not completely read can be reduced. Starting from a queue with larger preset token redistribution granularity in a queue with incompletely read queue data in the token redistribution quantity queue, reducing the quantity of the queue data, wherein the sum of products of the reduced quantity of the queue data in each token redistribution quantity queue and the corresponding value of the queue data is equal to the corresponding token reduction quantity.
In addition, after the normal operation of some or all failed cluster service nodes is restored, the token redistribution quantity queue can be updated, and some or all recovery tokens reduce the quantity of tokens, so that the dynamic adjustment of the throttling threshold is realized.
According to the technical scheme, distribution planning is performed on the remaining tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities, so that at least two token redistribution quantity queues which are the same in data in each queue and correspond to the preset token redistribution granularities in value are obtained; then, under the condition of obtaining token reassignment of any cluster service node, reading one queue data with the largest value in the unread queue data in the token reassignment quantity queues as target queue data; and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token reallocation number queue are read, and dynamically adjusting a current limit threshold according to the working state of the cluster service node in the process to ensure the normal operation of the cluster service node which is not in a fault state. The allocation of the tokens is managed more directly through the queue data, so that the token allocation mode with finer granularity can be used for meeting the token demands of the cluster service nodes, and the waste of excessive tokens in the cluster service nodes with less service request processing capacity is reduced. The technical scheme of the embodiment solves the problem of low current limiting accuracy in cluster current limiting management, realizes finer granularity current limiting management, reduces the waste of tokens and improves the accuracy of the current limiting management to a certain extent.
Fig. 6 is a schematic structural diagram of a cluster service current limiting management device according to an embodiment of the present invention, where the embodiment is applicable to a scenario of current limiting management in a concurrent service process of a service cluster, and the device may be implemented by software and/or hardware, and integrated in a computer terminal device with an application development function.
As shown in fig. 6, the cluster service flow limit management apparatus includes: a token allocation plan module 410, a token allocation request acquisition module 420, and a token allocation module 430.
The token allocation planning module 410 is configured to perform allocation planning on remaining tokens to be allocated after pre-allocation according to at least two preset token allocation granularities, so as to obtain at least two token allocation quantity queues with the same data in each queue and the numerical value corresponding to the preset token allocation granularities; a token allocation request obtaining module 420, configured to, when obtaining a token allocation request of any cluster service node, read, as target queue data, queue data with a maximum value in one of the queue data that is not read in the token allocation number queue; the token allocation module 430 is configured to allocate tokens with the number of tokens corresponding to the target queue data to the any cluster service node until the queue data in the token redistribution number queue are all read.
According to the technical scheme, distribution planning is performed on the remaining tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities, so that at least two token redistribution quantity queues which are the same in data in each queue and correspond to the preset token redistribution granularities in value are obtained; then, under the condition of obtaining token reassignment of any cluster service node, reading one queue data with the largest value in the unread queue data in the token reassignment quantity queues as target queue data; and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token reallocation number queue are read completely. The allocation of the tokens is managed more directly through the queue data, so that the token allocation mode with finer granularity can be used for meeting the token demands of the cluster service nodes, and the waste of excessive tokens in the cluster service nodes with less service request processing capacity is reduced. The technical scheme of the embodiment solves the problem of low current limiting accuracy in cluster current limiting management, realizes finer granularity current limiting management, reduces the waste of tokens and improves the accuracy of the current limiting management to a certain extent.
Optionally, the token allocation planning module 410 is specifically configured to:
and establishing a functional relation between the preset token reassignment granularity and the corresponding number of queue data in the token reassignment number queue and the number of the remaining tokens to be assigned, and analyzing the functional relation.
Optionally, the token allocation planning module 410 is further configured to:
calculating the product value of each preset token reassignment granularity and the number of queue data in the corresponding token reassignment number queue respectively;
and determining the number of the queue data in each token redistribution number queue under the constraint that the sum of the product values is smaller than or equal to the number of the remaining tokens to be distributed, the number of the queue data in the token redistribution number queue is a positive integer, and the minimum redistribution granularity in the preset token redistribution granularity is 1.
Optionally, the cluster service current limiting management device further includes: the token allocation adjustment module is specifically configured to:
acquiring service request processing amount data of each cluster service node, and determining the number of target tokens according to the service request processing amount data to adjust the cluster service nodes;
and under the condition of entering a token reassignment stage corresponding to a preset flow limiting reassignment granularity, acquiring the remaining tokens to be used of the target token quantity adjustment cluster service node, and updating the queue data of the token reassignment quantity queue according to the quantity of the remaining tokens to be used.
Optionally, the token allocation adjustment module is further configured to:
and distributing the quantity of the residual tokens to be used to the corresponding token redistribution quantity queues according to the value of the preset token redistribution granularity corresponding to the queue of which the queue data is not completely read in the token redistribution quantity queues until the quantity of the residual tokens to be used is distributed.
Optionally, the token allocation adjustment module is further configured to:
acquiring network connection state information and CPU utilization rate information of each cluster service node, and determining a fault state of each cluster service node based on the network connection state information and/or the CPU utilization rate information;
the number of currently remaining tokens to be allocated is adjusted based on the number of cluster service nodes in a failure state.
Optionally, the token allocation adjustment module may be further configured to:
determining the percentage of the number of cluster service nodes in a fault state to the total number of cluster service nodes, and determining the token reduction number of the current remaining tokens to be allocated based on the percentage;
and according to the number of the token reduction and the numerical value of the preset token redistribution granularity corresponding to the queue of which the queue data is not completely read in the token redistribution number queue, correspondingly reducing the queue data in the queue of which the queue data is not completely read.
The cluster service current limiting management device provided by the embodiment of the invention can execute the cluster service current limiting management method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present invention. Fig. 7 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in fig. 7 is only an example and should not be construed as limiting the functionality and scope of use of embodiments of the invention. The computer device 12 may be any terminal device with computing power, such as an intelligent controller, a server, a mobile phone, and the like.
As shown in fig. 7, the computer device 12 is in the form of a general purpose computing device. Components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 7, commonly referred to as a "hard disk drive"). Although not shown in fig. 7, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of the embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and/or any devices (e.g., network card, modem, etc.) that enable the computer device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Moreover, computer device 12 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be appreciated that although not shown in fig. 7, other hardware and/or software modules may be used in connection with computer device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running a program stored in the system memory 28, for example, implementing the cluster service flow restriction management method provided in the present embodiment, the method includes:
distributing and planning the residual tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities to obtain at least two token redistribution quantity queues which have the same data in each queue and have the value corresponding to the preset token redistribution granularities;
under the condition of obtaining the token redistribution request of any cluster service node, reading one queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data;
and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, the program when executed by a processor implementing the cluster service flow limit management method according to any embodiment of the invention, the method comprising:
Distributing and planning the residual tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities to obtain at least two token redistribution quantity queues which have the same data in each queue and have the value corresponding to the preset token redistribution granularities;
under the condition of obtaining the token redistribution request of any cluster service node, reading one queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data;
and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
It will be appreciated by those of ordinary skill in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be centralized on a single computing device, or distributed over a network of computing devices, or they may alternatively be implemented in program code executable by a computer device, such that they are stored in a memory device and executed by the computing device, or they may be separately fabricated as individual integrated circuit modules, or multiple modules or steps within them may be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.
Claims (10)
1. A cluster service flow limit management method, comprising:
distributing and planning the residual tokens to be distributed after pre-distribution according to at least two preset token redistribution granularities to obtain at least two token redistribution quantity queues which have the same data in each queue and have the value corresponding to the preset token redistribution granularities;
under the condition of obtaining the token redistribution request of any cluster service node, reading one queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data;
and allocating tokens with the token number corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
2. The method according to claim 1, wherein the allocating and planning the remaining tokens to be allocated after the pre-allocation according to at least two preset token reallocation granularities comprises:
and establishing a functional relation between the preset token reassignment granularity and the corresponding number of queue data in the token reassignment number queue and the number of the remaining tokens to be assigned, and analyzing the functional relation.
3. The method of claim 2, wherein the establishing a functional relationship between the preset token redistribution granularity and the corresponding number of queue data in the token redistribution number queue, the number of remaining tokens to be distributed, and resolving the functional relationship, comprises:
calculating the product value of each preset token reassignment granularity and the number of queue data in the corresponding token reassignment number queue respectively;
and determining the number of the queue data in each token redistribution number queue under the constraint that the sum of the product values is smaller than or equal to the number of the remaining tokens to be distributed, the number of the queue data in the token redistribution number queue is a positive integer, and the minimum redistribution granularity in the preset token redistribution granularity is 1.
4. The method according to claim 1, wherein the method further comprises:
acquiring service request processing amount data of each cluster service node, and determining the number of target tokens according to the service request processing amount data to adjust the cluster service nodes;
and under the condition of entering a token reassignment stage corresponding to a preset flow limiting reassignment granularity, acquiring the remaining tokens to be used of the target token quantity adjustment cluster service node, and updating the queue data of the token reassignment quantity queue according to the quantity of the remaining tokens to be used.
5. The method of claim 4, wherein updating the queue data of the token reassignment number queue based on the number of remaining tokens to be used comprises:
and distributing the quantity of the residual tokens to be used to the corresponding token redistribution quantity queues according to the value of the preset token redistribution granularity corresponding to the queue of which the queue data is not completely read in the token redistribution quantity queues until the quantity of the residual tokens to be used is distributed.
6. The method according to claim 1, wherein the method further comprises:
acquiring network connection state information and CPU utilization rate information of each cluster service node, and determining a fault state of each cluster service node based on the network connection state information and/or the CPU utilization rate information;
the number of currently remaining tokens to be allocated is adjusted based on the number of cluster service nodes in a failure state.
7. The method of claim 6, wherein the adjusting the number of currently remaining tokens to be allocated based on the number of cluster service nodes in a failure state comprises:
determining the percentage of the number of cluster service nodes in a fault state to the total number of cluster service nodes, and determining the token reduction number of the current remaining tokens to be allocated based on the percentage;
And according to the number of the token reduction and the numerical value of the preset token redistribution granularity corresponding to the queue of which the queue data is not completely read in the token redistribution number queue, correspondingly reducing the queue data in the queue of which the queue data is not completely read.
8. A cluster service flow limit management device, comprising:
the token allocation planning module is used for carrying out allocation planning on the remaining tokens to be allocated after the pre-allocation according to at least two preset token allocation granularities to obtain at least two token allocation quantity queues which have the same data in each queue and have the value corresponding to the preset token allocation granularities;
the token allocation request acquisition module is used for reading the queue data with the largest value in the unread queue data in the token redistribution quantity queues as target queue data under the condition of acquiring token redistribution requests of any cluster service node;
and the token distribution module is used for distributing tokens with the number of tokens corresponding to the target queue data to any cluster service node until the queue data in the token redistribution number queue are read completely.
9. A computer device, the computer device comprising:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the cluster service flow restriction management method of any of claims 1-7.
10. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a cluster service flow limit management method according to any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310544867.2A CN116566916A (en) | 2023-05-15 | 2023-05-15 | Cluster service flow limiting management method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310544867.2A CN116566916A (en) | 2023-05-15 | 2023-05-15 | Cluster service flow limiting management method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116566916A true CN116566916A (en) | 2023-08-08 |
Family
ID=87497833
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310544867.2A Pending CN116566916A (en) | 2023-05-15 | 2023-05-15 | Cluster service flow limiting management method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116566916A (en) |
-
2023
- 2023-05-15 CN CN202310544867.2A patent/CN116566916A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108667748B (en) | Method, device, equipment and storage medium for controlling bandwidth | |
CN110753131A (en) | Microservice distributed current limiting method and device, storage medium and electronic equipment | |
US20090055835A1 (en) | System and Method for Managing License Capacity in a Telecommunication Network | |
US20010044817A1 (en) | Computer system and a method for controlling a computer system | |
CN112068957B (en) | Resource allocation method, device, computer equipment and storage medium | |
US11489735B2 (en) | Dynamic network allocation apparatus, dynamic network allocation method and non-transitory computer-readable medium | |
CN105897484A (en) | Traffic management device, server and method | |
JP7506096B2 (en) | Dynamic allocation of computing resources | |
CN105468458A (en) | Resource scheduling method and system of computer cluster | |
CN111798113A (en) | Resource allocation method, device, storage medium and electronic equipment | |
CN111190719B (en) | Method, device, medium and electronic equipment for optimizing cluster resource allocation | |
CN114116173A (en) | Method, device and system for dynamically adjusting task assignment | |
CN114546587A (en) | A method for expanding and shrinking capacity of online image recognition service and related device | |
CN114489978A (en) | Resource scheduling method, device, equipment and storage medium | |
CN110427273A (en) | Scheduling memory method, apparatus, equipment and storage medium | |
CN113285890B (en) | Gateway flow distribution method and device, electronic equipment and storage medium | |
CN118034900A (en) | Calculation power scheduling method, system, device, equipment and medium of heterogeneous chip | |
CN111464331A (en) | Control method and system for thread creation and terminal equipment | |
CN113934525A (en) | Hadoop cluster task scheduling method based on positive and negative feedback load scheduling algorithm | |
JP2018190355A (en) | Resource management method | |
CN116566916A (en) | Cluster service flow limiting management method, device, equipment and medium | |
CN111813564B (en) | Cluster resource management method and device and container cluster management system | |
CN112667392B (en) | Cloud computing resource allocation method and device, computer equipment and storage medium | |
CN116909729A (en) | GPU multitasking scheduling method | |
CN115629854A (en) | Distributed task scheduling method, system, electronic device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |