CN112667467A - Cluster self-adaptive current limiting method and device, computer equipment and storage medium - Google Patents

Cluster self-adaptive current limiting method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112667467A
CN112667467A CN202011538926.8A CN202011538926A CN112667467A CN 112667467 A CN112667467 A CN 112667467A CN 202011538926 A CN202011538926 A CN 202011538926A CN 112667467 A CN112667467 A CN 112667467A
Authority
CN
China
Prior art keywords
current limiting
computer
threshold value
cluster
computers
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
Application number
CN202011538926.8A
Other languages
Chinese (zh)
Inventor
曾林新
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011538926.8A priority Critical patent/CN112667467A/en
Publication of CN112667467A publication Critical patent/CN112667467A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to the technical field of software monitoring, and provides a cluster self-adaptive current limiting method, a cluster self-adaptive current limiting device, a computer device and a storage medium, wherein the method comprises the following steps: detecting the running state of a third-party memory, wherein the third-party memory is used for storing the number of access requests received by all computers in a computer cluster in a preset period; under the condition that the third-party storage operates normally, distributed current limiting is carried out on all the computers based on a first threshold value, wherein the first threshold value is the threshold value of the number of access requests received by all the computers in the cluster; and under the condition that the third-party storage runs abnormally, performing single-machine current limiting on each computer included in the cluster based on a second threshold value, wherein the second threshold value is the threshold value of the number of the access requests received by each computer included in the cluster.

Description

Cluster self-adaptive current limiting method and device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of software monitoring, in particular to a cluster self-adaptive current limiting method and device, computer equipment and a storage medium.
Background
The current control means for high concurrent flow mainly comprises single-machine flow limitation and distributed flow limitation. The single machine current limiting is independent control for a single computer, and specifically, a token bucket algorithm or a funnel bucket algorithm can be adopted. The distributed flow limiting is to perform overall control on all computers in the cluster, and specifically, the distributed flow limiting can be realized by using a third-party memory such as redis in combination with atomicity of lua scripts so as to uniformly control the flow of the cluster. However, under the current mainstream cluster deployment, the implementation effect of single machine current limiting is like a chicken rib, while the distributed current limiting depends heavily on the availability of the redis, and when the redis is unavailable, the cluster current limiting is also unavailable, so that serious consequences such as unavailable application are easily caused.
Therefore, how to guarantee high availability of an application cluster when a third-party application is abnormal becomes a problem to be solved urgently by those skilled in the art.
Disclosure of Invention
The invention aims to provide a technical scheme capable of ensuring the stability of current limitation under high concurrent flow so as to solve the problems in the prior art.
In order to achieve the above object, the present invention provides a cluster adaptive current limiting method, which includes the following steps:
detecting the running state of a third-party memory, wherein the third-party memory is used for storing the number of access requests received by all computers in a computer cluster in a preset period;
under the condition that the third-party storage operates normally, distributed current limiting is carried out on all the computers based on a first threshold value, wherein the first threshold value is the threshold value of the number of access requests received by all the computers in the cluster;
and under the condition that the third-party storage runs abnormally, performing single-machine current limiting on each computer included in the cluster based on a second threshold value, wherein the second threshold value is the threshold value of the number of the access requests received by each computer included in the cluster.
According to the self-adaptive current limiting method provided by the invention, the step of detecting the running state of the third-party memory comprises the following steps:
in response to the computer cluster receiving an access request, sending a count value accumulation command to the third-party memory;
detecting whether accumulation success information replied by the third-party memory is received or not within preset time;
if the accumulation success information is received, determining that the third-party memory operates normally; otherwise, determining that the third-party memory runs abnormally.
According to the adaptive current limiting method provided by the invention, under the condition that the third-party memory operates normally, the step of carrying out distributed current limiting on all computers based on the first threshold value comprises the following steps:
setting a first count value from zero in each preset period, and adding one to the first count value when all computers receive an access request; wherein the first count value is stored in the third party memory;
judging whether the first count value reaches the first threshold value;
in the event that the first count value reaches the first threshold, inhibiting the reception of new access requests by all computers;
in the event that the first count value does not meet the first threshold, allowing all of the computers to receive a new access request.
According to the adaptive current limiting method provided by the invention, under the condition that the third-party memory operates abnormally, the step of performing stand-alone current limiting on each computer based on the second threshold value comprises the following steps of:
determining the current period of the current moment;
forbidding all computers to receive new access requests in the remaining time of the current period;
setting a second count value from zero in the next period of the current period, and adding one to the second count value when each computer receives an access request; wherein the second count value is stored in a memory of each of the computers;
judging whether the second count value reaches the second threshold value;
prohibiting each computer from receiving a new access request if the second count value reaches the second threshold;
and allowing each computer to receive a new access request under the condition that the second counting value does not reach the second threshold value.
According to the adaptive current limiting method provided by the invention, under the condition that the third-party memory operates abnormally, after the step of performing stand-alone current limiting on each computer based on the second threshold value, the method further comprises the following steps of:
sending an accumulation detection command to the third-party memory based on a preset frequency;
and under the condition that the accumulated detection success information replied by the third-party memory is received, carrying out distributed current limiting on all the computers based on a first threshold value.
According to the adaptive current limiting method provided by the invention, under the condition that the accumulated detection success information replied by the third-party memory is received, the step of carrying out distributed current limiting on all computers based on the first threshold value comprises the following steps:
determining a second period corresponding to the received information of successful accumulation detection;
continuing to perform stand-alone current limiting on each computer based on a second threshold value within the remaining time of the second period;
distributively current limiting all computers based on a first threshold in a next cycle of the second cycle.
According to the adaptive current limiting method provided by the invention, the second threshold value is determined based on the first threshold value and the number of computers contained in the computer cluster.
In order to achieve the above object, the present invention further provides an adaptive current limiting apparatus for a computer cluster, including:
the state detection module is suitable for detecting the running state of a third-party memory, and the third-party memory is used for storing the number of the access requests received by all the computers in the computer cluster in a preset period;
the distributed current limiting module is suitable for performing distributed current limiting on all the computers based on a first threshold value under the condition that the third-party storage operates normally, wherein the first threshold value is a threshold value of the number of access requests received by all the computers in the cluster;
and the stand-alone current limiting module is suitable for performing stand-alone current limiting on each computer contained in the cluster based on a second threshold value under the condition that the third-party storage operates abnormally, wherein the second threshold value is the threshold value of the number of the access requests received by each computer contained in the cluster.
To achieve the above object, the present invention further provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the computer program.
To achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the above method.
According to the self-adaptive current limiting method and device for the cluster, the computer equipment and the storage medium, firstly, the high performance of a third-party storage such as Redis is fully utilized, and distributed current limiting is achieved when the third-party storage operates normally. When the third-party memory operates abnormally, the single-machine current limiting is automatically switched on in time based on the state machine, so that the high availability of the current limiting system is ensured. . The single machine current limiting mode and the distributed current limiting mode are automatically switched in the whole process without manual intervention, and the working efficiency of operation and maintenance managers can be greatly improved.
Drawings
FIG. 1 is a flowchart of a first embodiment of a method for adaptive current limiting for a cluster according to the present invention;
fig. 2 shows a flow chart of yet another example according to the first embodiment of the invention;
FIG. 3 shows a schematic flow diagram for distributed current limiting according to an embodiment of the invention;
FIG. 4 is a schematic flow chart diagram illustrating a single-machine current limiting according to an embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating a transition phase from distributed throttling to stand-alone throttling in accordance with the present embodiment;
FIG. 6 illustrates a schematic flow chart diagram of recovering distributed current limits in accordance with an embodiment of the invention;
FIG. 7 is a schematic diagram illustrating a transition phase from a single flow limit to a distributed flow limit in accordance with the present embodiment;
FIG. 8 is a block diagram of a program module of an adaptive current limiting apparatus according to a first embodiment of the present invention;
fig. 9 is a schematic diagram of a hardware structure of a first adaptive current limiting apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Referring to fig. 1, the present embodiment provides a cluster adaptive current limiting method, including the following steps:
and S100, detecting the running state of a third-party memory, wherein the third-party memory is used for storing the number of the access requests received by all computers in the computer cluster in a preset period.
The cluster is a group of mutually independent computers, a computer system is formed by a high-speed network, and each cluster node is an independent server for running own process. For network users, the back end of the website is a single system, and provides system resources and system services for the users cooperatively. Are combined into a combination through network connections to collectively accomplish a task. When a user needs to access a resource or service in the computer system, an access request is sent to the cluster. It will be appreciated that the number of access requests is proportional to the number of users. In a multi-user high-concurrency scenario, it is necessary to limit the current of a computer cluster to ensure the normal operation of the network.
The present embodiment may throttle based on the number of access requests. On one hand, the flow limitation can be carried out according to the number of the access requests received by all computers in the whole computer cluster, and on the other hand, the flow limitation can also be carried out according to the number of the access requests received by a single computer in the cluster.
The third party memory can be a redis database, a mysql database or other hardware memory, and the like. The embodiment detects the running state of the third-party database according to the preset frequency so as to determine whether the third-party database can normally read or write data. The third-party storage is preferably a redis database, because the timer and the counter set by using the redis are globally unique, and the same timer and counter are used regardless of the number of computer nodes contained in the cluster, so that very accurate flow control can be realized. The redis may be provided with a counter, and configured to store the number of access requests received by the entire computer cluster in a preset period. Specifically, the counter is reset to zero at the initial time of each preset period, and then corresponding data is written into the third-party memory every time the computer cluster receives an access request, so as to increment the counter by one, thereby accurately recording the number of the access requests received by the computer cluster in the preset period.
The operational state of the third party memory may be detected by a request-response mode. In this embodiment, when the computer cluster receives the access request, a count value accumulation command may be sent to the third-party memory. Whether the accumulated success information replied by the third-party memory is received or not can be detected within a preset time. If the accumulation success information is received, determining that the third-party memory operates normally; otherwise, determining that the third-party memory runs abnormally. The preset time may be set according to an empirical value, for example, 500 ms.
And S200, under the condition that the third-party storage operates normally, performing distributed current limiting on all the computers based on a first threshold value, wherein the first threshold value is the threshold value of the number of the access requests received by all the computers in the cluster.
If the redis database can be read and written normally, the number of access requests received by the computer cluster can be recorded by using the redis database. At this time, a first threshold value may be preset, and when the number of access requests received by the cluster reaches the preset first threshold value, the current of the whole computer cluster is limited; otherwise, no current limit is performed. The distributed current limiting described in this embodiment refers to current limiting performed on a computer cluster as a whole. Specifically, when the data accumulated by the counter in the third-party memory reaches the first threshold, any access request sent to the computer cluster is intercepted, so that the computing pressure of the computer cluster is relieved, and the computer cluster can process the received access request by centralized resources.
The distributed current limiting can meet the requirements of application distributed systems in most of current scenes, the request limit of the whole service can be accurately controlled during node capacity expansion and capacity reduction, and various resources depending on the service can be protected by current limiting.
And S300, under the condition that the third-party storage runs abnormally, performing single machine current limiting on each computer contained in the cluster based on a second threshold value, wherein the second threshold value is the threshold value of the number of the access requests received by each computer contained in the cluster.
In order to deal with the situation that a third-party storage, such as a redis database, cannot be read and written normally, the embodiment may also perform stand-alone current limiting on each computer in the cluster. The single machine current limiting does not need the participation of a third-party storage, and directly records the number of the access requests received by the computer in a preset period in the memory of each computer. When the current is limited based on the number of access requests received by a single computer in the cluster, the present embodiment may preset a second threshold, and when the number of access requests received by the single computer in the cluster reaches the second threshold, the current is limited to the single computer; otherwise, no current limit is performed.
The stand-alone current limiting described in this embodiment refers to current limiting performed by using one of the computers in the computer cluster as an implementation object. Specifically, when the number of access requests recorded in the memory of the target computer reaches the second threshold, any access request sent to the target computer is intercepted, so that the computing pressure of the target computer is reduced, and the target computer can process the received access requests by concentrating resources.
The first threshold value and the second threshold value may be stored in a configuration file of each computer in advance. When the computer is started, the corresponding first threshold value and the second threshold value are read from the configuration file, so that the current limitation of all computers in the computer cluster can be realized according to the first threshold value, and the current limitation of the current single computer can be realized according to the second threshold value.
Through the steps, the embodiment can realize the automatic switching between the distributed current limiting and the single machine current limiting in the computer cluster, and can switch to the single machine current limiting mode in time when the read-write abnormality of the memory occurs in the distributed current limiting mode, thereby ensuring the effective monitoring of the flow data and maintaining the stability of the network operation.
Further, the second threshold in this embodiment may be determined based on the first threshold and the number of computers included in the computer cluster. For example, with y1 for the first threshold, y2 for the second threshold, and n for the total number of computers contained in the cluster, then y2 ≦ y1 ÷ n. Since y2 is the traffic threshold set for a single computer and y1 is the traffic threshold set for all computers in the cluster, then y1 ÷ n is the average traffic threshold for each computer in the distributed throttling process. The actual flow threshold y2 of a single computer in the single computer flow limiting process is set to be smaller than or equal to the average flow threshold of each computer in the distributed flow limiting process, so that overload operation of the single computer can be avoided, and the running stability of the system is ensured.
Further, after step S300, as shown in fig. 2, the present embodiment may further include the following steps:
and S400, sending an accumulation detection command to the third-party memory based on a preset frequency.
The accumulation detection command is issued for testing whether the third-party memory returns to the normal count value accumulation function, and the accumulation detection command may be the same as the count value accumulation command in the foregoing description, or may be different from the count value accumulation command, which is not limited in this embodiment. The preset frequency can be flexibly set according to the requirement, for example, the preset frequency is transmitted once every millisecond.
And S500, under the condition that the accumulation detection success information replied by the third-party memory is received, carrying out distributed current limiting on all the computers based on a first threshold value.
In this embodiment, if the information of successful accumulation detection replied by the third-party memory is received, it is indicated that the running state of the third-party memory is recovered to be normal; if not, the operation state of the third-party memory is still abnormal. Therefore, when the third-party storage is detected to be normal, distributed current limiting is carried out on the whole computer cluster again.
It will be appreciated that distributed throttling has a higher capacity and faster efficiency than single-machine throttling. Therefore, the current limiting mode is timely adjusted from the single machine current limiting to the distributed current limiting under the condition that the third-party memory is recovered to be normal, and the high-efficiency smoothness of the system operation can be ensured.
Fig. 3 shows a schematic flow diagram for distributed current limiting according to an embodiment of the invention. As shown in fig. 3, step S200 includes:
s210, setting a first count value from zero in each preset period, and adding one to the first count value when all computers receive an access request; wherein the first count value is stored in the third party memory.
The preset period may be set according to actual needs, for example, 5 seconds is one period, or 5 minutes is one period, and the invention is not limited. Assuming every 5 minutes as a cycle, from 0 minute 0 second to 4 minute 59 seconds is the first cycle, from 5 minute 0 second to 9 minute 59 seconds is the second cycle, … … and so on.
The first counter in this embodiment may be a built-in redis counter, which is cleared from the beginning of each cycle and counts according to the number of access requests received by all computers, that is, the number of the first counter is consistent with the number of access requests received by all computers.
S220, judging whether the first counting value reaches the first threshold value. The first threshold value can be set according to actual needs, for example, 500.
And S230, prohibiting all the computers from receiving new access requests under the condition that the first counting value reaches the first threshold value. In this case, all access requests sent to the entire computer cluster will be intercepted, thereby ensuring that the computers in the cluster have sufficient resources to process the existing requests, and avoiding causing access congestion.
And S240, allowing all the computers to receive a new access request under the condition that the first counting value does not reach the first threshold value.
The first counting value does not reach the first threshold value, which indicates that the computer cluster has idle resources, so that new access requests can be continuously received and processed.
FIG. 4 is a schematic flow chart diagram illustrating a single-machine current limiting according to an embodiment of the present invention. As shown in fig. 4, step S300 includes:
and S310, determining the current period of the current moment.
Still taking a 5 minute cycle as an example, the current cycle at which it is located may be determined based on the current time. For example, if the current time is 5 minutes 10 seconds, it may be determined that the current cycle is the second cycle, and then the remaining time of the current cycle is from 5 minutes 11 seconds to 9 minutes 59 seconds.
And S320, prohibiting all the computers from receiving new access requests in the remaining time of the current period.
In order to ensure that the current-limiting policy is switched smoothly and the flow is not over-flown in the switching process, the embodiment performs flow interception in the remaining time of the current period, and this transitional stage is called a distributed abnormal stage
S330, setting a second count value from zero in the next period of the current period, and adding one to the second count value when each computer receives an access request; wherein the second count value is stored in a memory of each of the computers.
A second counter may be provided in the memory of each computer to indicate the number of access requests received by the corresponding computer in each cycle. It will be appreciated that the value of the second counter corresponds to the number of access requests received by the corresponding computer in a cycle.
S340, judging whether the second counting value reaches the second threshold value.
And S350, forbidding each computer to receive a new access request under the condition that the second counting value reaches the second threshold value.
And S360, allowing each computer to receive a new access request under the condition that the second counting value does not reach the second threshold value.
Through the steps, the switching from the abnormal state of the distributed current limiting to the single machine current limiting state can be smoothly realized, and the current limiting is continuously carried out on the access request based on the single machine current limiting strategy so as to ensure the normal operation of the network data.
Fig. 5 shows a schematic diagram of a transition phase from distributed to stand-alone current limiting according to the present embodiment. As shown in fig. 5, distributed current limiting is performed at the cycle 1 to cycle E-1 nodes. Detecting the redis abnormity at the TE moment in the period E, then carrying out flow interception on all received access requests after the TE moment in the period E, and starting to execute single machine current limiting from the period E + 1.
Fig. 6 shows a schematic flow diagram of a method of resuming distributed current limiting according to an embodiment of the invention. As shown in fig. 6, step S500 includes:
and S510, determining a second period corresponding to the successful accumulation detection information.
And acquiring the time when the third-party memory such as the redis is detected to be recovered to be normal, and determining a corresponding second period according to the time. The second period here refers to a period corresponding to the redis recovery normal time, and may be specifically determined by a multiple of the recovery normal time with respect to the period duration. Assuming that the time for recovering to normal is t and the period duration is t0, the corresponding second period may be an integer obtained by t/t0 plus 1. Still taking 5 minutes as an example, assuming that the time when redis detected to return to normal is 16 minutes and 0 seconds, the integer of (16/5) is added with 1 to obtain 4, which corresponds to the 4 th period.
And S520, continuing to perform single machine current limiting on each computer based on a second threshold value in the remaining time of the second period.
In order to ensure the smooth switching of the current limiting strategy, the flow is not over-spent in the switching process, and the single machine current limiting is still carried out in the remaining time in the period R, which is referred to as a distributed recovery stage transitionally.
And S530, performing distributed current limiting on all the computers based on a first threshold value in the next period of the second period.
Through the steps, smooth transition from a single machine current limiting mode to distributed current limiting can be achieved.
Fig. 7 shows a schematic diagram of a transition phase from a single flow limit to a distributed flow limit according to the present embodiment. As shown in fig. 7, the single current limiting is performed in the period 1 to the period R-1. And detecting that the redis returns to normal at the TR moment in the period R, continuously executing the single machine current limiting in the rest time of the period R, and starting executing the distributed current limiting in the period R + 1.
In summary, the invention uses single machine current limiting as the bottom pocket on the basis of performing distributed current limiting on the computer cluster, thereby ensuring the high availability of the system. By defining the state machine, the switching of various system states and the automatic processing and recovery of faults can be automatically completed, the burden of operators is reduced, and the working efficiency is improved.
With continued reference to fig. 8, a clustered adaptive current limiting apparatus is shown, in this embodiment, the adaptive current limiting apparatus 80 may include or be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to implement the adaptive current limiting method of the present invention. The program modules referred to herein are a series of computer program instruction segments that perform particular functions and are more suitable than the program itself for describing the execution of the adaptive current limiting device 80 in a storage medium. The following description will specifically describe the functions of the program modules of the present embodiment:
the state detection module 81 is adapted to detect an operating state of a third-party storage, where the third-party storage is used to store the number of access requests received by all computers included in a computer cluster in a preset period;
the distributed current limiting module 82 is adapted to perform distributed current limiting on all the computers based on a first threshold value when the third-party storage operates normally, where the first threshold value is a threshold value of the number of access requests received by all the computers included in the cluster;
and the stand-alone current limiting module 83 is adapted to perform stand-alone current limiting on each computer included in the cluster based on a second threshold value when the third-party storage operates abnormally, where the second threshold value is a threshold value of the number of access requests received by each computer included in the cluster.
The embodiment also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. The computer device 90 of the present embodiment includes at least, but is not limited to: a memory 91 and a processor 92 communicatively connected to each other via a system bus, as shown in fig. 9. It should be noted that fig. 9 only shows a computer device 90 having components 91-92, but it should be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the memory 91 (i.e., a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 91 may be an internal storage unit of the computer device 90, such as a hard disk or a memory of the computer device 90. In other embodiments, the memory 91 may be an external storage device of the computer device 90, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 90. Of course, the memory 91 may also include both internal and external memory units of the computer device 90. In this embodiment, the memory 91 is generally used to store an operating system and various application software installed in the computer device 90, such as the program code of the adaptive current limiting device 80 in the first embodiment. Further, the memory 91 can also be used to temporarily store various types of data that have been output or are to be output.
Processor 92 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 92 is typically used to control the overall operation of the computer device 90. In this embodiment, the processor 92 is configured to execute the program code stored in the memory 91 or process data, for example, execute the adaptive current limiting device 80, so as to implement the adaptive current limiting method according to the first embodiment.
The present embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer readable storage medium of this embodiment is used to store the adaptive current limiting apparatus 80, and when executed by the processor, the adaptive current limiting method of the first embodiment is implemented.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example" or "some examples" or the like are intended to mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A cluster adaptive current limiting method is characterized by comprising the following steps:
detecting the running state of a third-party memory, wherein the third-party memory is used for storing the number of access requests received by all computers in a computer cluster in a preset period;
under the condition that the third-party storage operates normally, distributed current limiting is carried out on all the computers based on a first threshold value, wherein the first threshold value is the threshold value of the number of access requests received by all the computers in the cluster;
and under the condition that the third-party storage runs abnormally, performing single-machine current limiting on each computer included in the cluster based on a second threshold value, wherein the second threshold value is the threshold value of the number of the access requests received by each computer included in the cluster.
2. The adaptive current limiting method of claim 1, wherein the step of detecting an operating state of a third party memory comprises:
in response to the computer cluster receiving an access request, sending a count value accumulation command to the third-party memory;
detecting whether accumulation success information replied by the third-party memory is received or not within preset time;
if the accumulation success information is received, determining that the third-party memory operates normally; otherwise, determining that the third-party memory runs abnormally.
3. The adaptive current limiting method of claim 2, wherein the step of distributively limiting the current to all computers based on a first threshold value in case the third party memory is operating normally comprises:
setting a first count value from zero in each preset period, and adding one to the first count value when all computers receive an access request; wherein the first count value is stored in the third party memory;
judging whether the first count value reaches the first threshold value;
in the event that the first count value reaches the first threshold, inhibiting the reception of new access requests by all computers;
in the event that the first count value does not meet the first threshold, allowing all of the computers to receive a new access request.
4. The adaptive current limiting method of claim 3, wherein the step of limiting current to each computer included in the cluster on a single basis based on a second threshold in the event of an abnormal operation of the third-party storage comprises:
determining the current period of the current moment;
forbidding all computers to receive new access requests in the remaining time of the current period;
setting a second count value from zero in the next period of the current period, and adding one to the second count value when each computer receives an access request; wherein the second count value is stored in a memory of each of the computers;
judging whether the second count value reaches the second threshold value;
prohibiting each computer from receiving a new access request if the second count value reaches the second threshold;
and allowing each computer to receive a new access request under the condition that the second counting value does not reach the second threshold value.
5. The adaptive current limiting method of claim 1, wherein after the step of performing individual current limiting on each computer included in the cluster based on a second threshold in case of abnormal operation of the third-party storage, further comprising:
sending an accumulation detection command to the third-party memory based on a preset frequency;
and under the condition that the accumulated detection success information replied by the third-party memory is received, carrying out distributed current limiting on all the computers based on a first threshold value.
6. The adaptive current-limiting method of claim 5, wherein the step of performing distributed current limiting on all computers based on a first threshold upon receiving the accumulated successful detection information replied by the third-party memory comprises:
determining a second period corresponding to the received information of successful accumulation detection;
continuing to perform stand-alone current limiting on each computer based on a second threshold value within the remaining time of the second period;
distributively current limiting all computers based on a first threshold in a next cycle of the second cycle.
7. The adaptive current limiting method of any of claims 1-6, wherein the second threshold is determined based on the first threshold and a number of computers included in the cluster of computers.
8. A clustered adaptive current limiting apparatus, comprising:
the state detection module is suitable for detecting the running state of a third-party memory, and the third-party memory is used for storing the number of the access requests received by all the computers in the computer cluster in a preset period;
the distributed current limiting module is suitable for performing distributed current limiting on all the computers based on a first threshold value under the condition that the third-party storage operates normally, wherein the first threshold value is a threshold value of the number of access requests received by all the computers in the cluster;
and the stand-alone current limiting module is suitable for performing stand-alone current limiting on each computer contained in the cluster based on a second threshold value under the condition that the third-party storage operates abnormally, wherein the second threshold value is the threshold value of the number of the access requests received by each computer contained in the cluster.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented by the processor when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202011538926.8A 2020-12-23 2020-12-23 Cluster self-adaptive current limiting method and device, computer equipment and storage medium Pending CN112667467A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011538926.8A CN112667467A (en) 2020-12-23 2020-12-23 Cluster self-adaptive current limiting method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011538926.8A CN112667467A (en) 2020-12-23 2020-12-23 Cluster self-adaptive current limiting method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112667467A true CN112667467A (en) 2021-04-16

Family

ID=75408985

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011538926.8A Pending CN112667467A (en) 2020-12-23 2020-12-23 Cluster self-adaptive current limiting method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112667467A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113285883A (en) * 2021-05-25 2021-08-20 挂号网(杭州)科技有限公司 Access request current limiting method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113285883A (en) * 2021-05-25 2021-08-20 挂号网(杭州)科技有限公司 Access request current limiting method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
EP2414932B1 (en) Execution of a plugin according to plugin stability level
US11397648B2 (en) Virtual machine recovery method and virtual machine management device
CN111818159B (en) Management method, device, equipment and storage medium of data processing node
CN109857592A (en) Data recovery control method, server and storage medium
CN111209110B (en) Task scheduling management method, system and storage medium for realizing load balancing
CN109445927B (en) Task management method and device for storage cluster
CN113010260A (en) Elastic expansion method and system for container quantity
CN111880906A (en) Virtual machine high-availability management method, system and storage medium
US20180107503A1 (en) Computer procurement predicting device, computer procurement predicting method, and recording medium
CN112650575B (en) Resource scheduling method, device and cloud service system
CN111538585B (en) Js-based server process scheduling method, system and device
CN114443441B (en) Storage system management method, device and equipment and readable storage medium
CN109474470A (en) One kind is from monitoring method and device
CN115297124A (en) System operation and maintenance management method and device and electronic equipment
CN112948169A (en) Data backup method, device, equipment and storage medium
CN112667467A (en) Cluster self-adaptive current limiting method and device, computer equipment and storage medium
EP4006725A1 (en) Virtual machine migration processing and strategy generation method, apparatus and device, and storage medium
CN112835702A (en) Service switching method and device, computer equipment and storage medium
CN109032762B (en) Virtual machine backtracking method and related equipment
CN111949384B (en) Task scheduling method, device, equipment and computer readable storage medium
CN114237910A (en) Client load balancing implementation method and device
CN114296909A (en) Automatic node capacity expansion and reduction method and system according to kubernets event
CN113127191A (en) Resource updating method, storage medium and related device
CN111158899A (en) Data acquisition method, data acquisition device, task management center and task management system
US11500676B2 (en) Information processing apparatus, method, and non-transitory computer-readable 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