CN110753131A - Microservice distributed current limiting method and device, storage medium and electronic equipment - Google Patents

Microservice distributed current limiting method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN110753131A
CN110753131A CN201911067292.XA CN201911067292A CN110753131A CN 110753131 A CN110753131 A CN 110753131A CN 201911067292 A CN201911067292 A CN 201911067292A CN 110753131 A CN110753131 A CN 110753131A
Authority
CN
China
Prior art keywords
cluster
current
micro
service
current limiting
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
CN201911067292.XA
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201911067292.XA priority Critical patent/CN110753131A/en
Publication of CN110753131A publication Critical patent/CN110753131A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/21Flow control; Congestion control using leaky-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching

Abstract

The disclosure relates to the technical field of internet, and discloses a distributed micro-service current limiting method and device, a storage medium and electronic equipment. The method comprises the following steps: acquiring cluster current limiting information, wherein the cluster current limiting information comprises cluster total current limiting and current operation state information of each micro service in a micro service cluster; updating the current limit in the local cache of the micro-service according to the cluster total current limit and the current operation state information; and carrying out current limiting control according to the current limiting limit in the local cache. Any micro service in the micro service cluster updates cluster current-limiting information to a local cache so as to realize current-limiting control in a local memory according to the current-limiting limit in the local cache, reduce the information transmission quantity, avoid request delay and further improve the response speed; meanwhile, the current limit is allowed to be dynamically adjusted according to the current running state information of each micro service in the micro service cluster, and the flexibility and the expansibility of current limit control are improved.

Description

Microservice distributed current limiting method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a distributed micro-service current limiting method, a distributed micro-service current limiting apparatus, a computer storage medium, and an electronic device.
Background
With the development of science and technology, internet application is more and more common, when a server is accessed by a large number of users, in order to guarantee the stability of the operation of the server, the problems of service quality reduction, time delay, service restart, even service break-down and the like caused by access flow which is suddenly gushed into the server are prevented by controlling in a current limiting mode. In the related art, a distributed current limiting method, such as distributed current limiting based on a database Redis or the like, is generally adopted for a microservice cluster, but the current limiting method has problems of request delay, poor current limiting stability and the like to some extent.
It is to be noted that the information invented in the background section above is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure is directed to a distributed micro-service current limiting method, a distributed micro-service current limiting device, a storage medium, and an electronic device, so as to avoid problems of high latency and poor current limiting stability of a distributed current limiting method in the related art at least to a certain extent.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, there is provided a microservice distributed current limiting method, the method including: acquiring cluster current limiting information, wherein the cluster current limiting information comprises cluster total current limiting and current operation state information of each micro service in a micro service cluster; updating the current limit in the local cache of the micro-service according to the cluster total current limit and the current operation state information; and carrying out current limiting control according to the current limiting limit in the local cache.
In an exemplary embodiment of the present disclosure, the method further comprises: and when each micro service in the micro service cluster is started, sending registration information to a micro service management module so that the micro service management module determines the current running state information corresponding to each micro service in the micro service cluster according to the registration information.
In an exemplary embodiment of the present disclosure, the obtaining of cluster current limiting information includes: and periodically acquiring the cluster current limiting information from the micro-service management module according to a preset time interval.
In an exemplary embodiment of the present disclosure, the updating, according to the total cluster current limit and the current operating state information, a current limit quota in the local cache of the micro service includes: determining the number of healthy microservices in the microservice cluster according to the current running state information; and calculating the current limit amount according to the cluster total current limit and the number of the healthy micro-services, and updating the current limit amount in the local cache of the micro-services according to the current limit amount.
In an exemplary embodiment of the present disclosure, the method further comprises: and periodically updating the network address path corresponding to the healthy microservices in the microservice cluster through a request distribution module based on the current running state information corresponding to each microservice in the microservice cluster.
In an exemplary embodiment of the disclosure, before performing the current limit control according to the current limit amount in the local cache, the method further includes: receiving a target request sent by the request distribution module based on the updated network address path; the current limit control according to the current limit amount in the local cache comprises the following steps: judging whether the request frequency corresponding to the target request exceeds the limit in the local cache or not; if the current limit value exceeds the preset value, performing current limit processing on the target request; and if not, responding to the target request to perform corresponding logic processing.
According to an aspect of the present disclosure, there is provided a microservice distributed current limiting apparatus, the apparatus comprising: the current limiting information acquisition module is used for acquiring cluster current limiting information, wherein the cluster current limiting information comprises cluster total current limiting and current operation state information of each micro service in a micro service cluster; the current limit updating module is used for updating the current limit in the local cache of the micro-service according to the cluster total current limit and the current operation state information; and the current limit control module is used for carrying out current limit control according to the current limit in the local cache.
According to another aspect of the present disclosure, there is provided a microservice distributed current limiting apparatus, the apparatus comprising: the micro-service management module is used for managing cluster current limiting information of a micro-service cluster, wherein the cluster current limiting information comprises a cluster total current limit and current operation state information of each micro-service in the micro-service cluster; the request distribution module is used for distributing the request to be processed to the micro-services in the micro-service cluster based on the current running state information corresponding to each micro-service in the micro-service cluster; and the micro-service cluster comprises at least one micro-service and is used for carrying out current limit control on the to-be-processed request distributed by the request distribution module according to the cluster total current limit and the current running state information provided by the micro-service management module.
According to one aspect of the disclosure, a micro-service distributed current limiting system is provided, which includes a micro-service cluster, and any micro-service in the micro-service cluster performs the micro-service distributed current limiting method of any one of the above.
According to an aspect of the present disclosure, there is provided a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the microservice distributed current limiting method of any of the above.
According to an aspect of the present disclosure, there is provided an electronic device including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any one of the above-described microservice distributed current limiting methods via execution of the executable instructions.
In the distributed current limiting method for the micro-services in the exemplary embodiment of the disclosure, any micro-service in the micro-service cluster updates the cluster current limiting information to the current limiting limit in the local cache of the micro-service, so as to realize the control of current limiting in the local memory according to the current limiting limit in the local cache. On one hand, the current limit amount in the local cache is updated based on the cluster total current limit and the current running state information of the micro-service in the micro-service cluster, so that excessive information transmission quantity is avoided, and the request delay is reduced; on the other hand, the current limit is allowed to be dynamically adjusted according to the current running state information of each micro service in the micro service cluster, so that the flexibility of current limit control is improved, and the expandability is high; on the other hand, the distributed current limiting method does not need to rely on a database middleware, current limiting is directly carried out in a local cache according to the current limiting limit, and the stability of the current limiting process is high.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
fig. 1 illustrates a flow chart of a microservice distributed current limiting method of an exemplary embodiment of the present disclosure;
fig. 2 illustrates an architecture diagram of a microservice distributed current limiting device of an exemplary embodiment of the present disclosure;
FIG. 3 is a flow chart illustrating updating of a limit amount in a local cache of a microservice according to a cluster total limit and current operating state information of the microservice within a microservice cluster according to an exemplary embodiment of the present disclosure;
FIG. 4 illustrates a schematic diagram of a token bucket algorithm based throttling control according to an exemplary embodiment of the present disclosure;
fig. 5 illustrates a block diagram of a microservice distributed current limiting apparatus of an exemplary embodiment of the present disclosure;
FIG. 6 shows a schematic diagram of a storage medium of an exemplary embodiment of the present disclosure; and
fig. 7 shows a block diagram of an electronic device of an exemplary embodiment of the present disclosure.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
Exemplary embodiments will now be described more fully with reference to the accompanying drawings. The exemplary embodiments, however, may be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and thus their detailed description will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, modules, steps, and the like. In other instances, well-known structures, methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in the form of software, or in one or more software-hardened modules, or in different networks and/or processor devices and/or microcontroller devices.
In the related art in the field, the current limiting scheme may be divided into two types, one is to configure a current limiting limit for each application service separately, and each application current limiting limit sums up to a current limiting limit for the whole application; the other method is that a distributed caching middleware such as a database Redis is used, a token bucket based on the total limit is set in the database Redis, each application server obtains one or more tokens from the database Redis when executing the controlled method, and the execution times of the controlled method are controlled according to the number of the taken tokens.
The following disadvantages exist in the related art: on one hand, the single machine current limiting scheme has the problem of static configuration; compared with distributed current-limiting control, the current-limiting of a pure single machine is relatively inflexible in configuration, and is usually configured statically, that is, a fixed limit is configured for each application server during project deployment, and the current-limiting limit of each machine is not easy to be dynamically adjusted during application operation; on the other hand, the token bucket algorithm current limiting scheme based on distributed middleware such as the database Redis can dynamically adjust the execution frequency of each machine and accurately control the execution frequency of multiple machines, but the efficiency is often lower than that of single machine current limiting, high-frequency competition access of the middleware exists, higher time delay may be caused, and the network overhead for obtaining the token is higher.
Based on this, in the exemplary embodiment of the present disclosure, firstly, a micro-service distributed current limiting method is provided, which is applied to any micro-service within a micro-service cluster.
Fig. 1 shows a flowchart of a micro-service distributed current limiting method, and referring to fig. 1, the micro-service distributed current limiting method includes the following steps:
step S110: acquiring cluster current limiting information, wherein the cluster current limiting information comprises cluster total current limiting and current operation state information of each micro service in a micro service cluster;
step S120: updating the current limit in the local cache of the micro-service according to the cluster total current limit and the current operation state information;
step S130: and carrying out current limiting control according to the current limiting limit in the local cache.
According to the distributed current limiting method for the micro-service in the exemplary embodiment, on one hand, the current limiting amount in the local cache is updated based on the cluster total current limiting and the current operation state information of the micro-service in the micro-service cluster, so that the current limiting control is realized in the local memory according to the current limiting amount in the local cache, the excessive information transmission quantity is avoided, and the request delay is reduced; on the other hand, the current limit in the local memory is allowed to be dynamically adjusted according to the current running state information, so that the flexibility of current limit control is improved, and the expandability is high; on the other hand, the distributed current limiting method does not need to rely on a database middleware, current limiting is directly carried out in a local cache according to the current limiting limit, and the stability of the current limiting process is high.
Fig. 2 shows an architecture diagram of a micro-service distributed current limiting apparatus in an exemplary embodiment of the present disclosure, and as shown in fig. 2, the apparatus 200 includes a micro-service management module 210, a request assignment module 220, and a micro-service cluster 230, where:
a micro service management module 210, configured to manage cluster current limiting information of a micro service cluster 230, where the cluster current limiting information includes a cluster total current limit and current operating state information of each micro service in the micro service cluster;
a request allocating module 220, configured to allocate a request to be processed to a microservice in the microservice cluster 230 based on current operating state information corresponding to each microservice in the microservice cluster 230;
the microservice cluster 230 includes at least one microservice, and is configured to perform flow limitation control on the to-be-processed request distributed by the request distribution module according to the cluster total flow limitation and the current operating state information provided by the microservice management module 210.
The architecture of the microservice distributed current limiting apparatus in the exemplary embodiment of the present disclosure is described below with reference to fig. 2.
Referring to fig. 2, when each microservice in the microservice cluster 230 is started, registration information may be sent to the microservice management module 210, so that the microservice management module 210 determines current operating state information corresponding to each microservice in the microservice cluster 230 according to the registration information. Accordingly, the micro-service management module 210 is also unregistered before the micro-service stops the process. The micro-service management module 210 may be, for example, a registry such as Consul, Zookeeper, or Etcd that can provide service discovery, health check, and storage functions, and the registration information includes, but is not limited to, a health detection address and a request timeout time. The micro service management module 210 obtains the current operating state information of the corresponding micro service according to the health detection address at preset time intervals. For example, the microservice management module 210 creates a request to send to the microservice cluster 230 at a predetermined time interval, and identifies the state of the microservice in the microservice cluster 230 by requesting a response code, for example, any 2xx response code is considered to be normal, other response codes are considered to be abnormal, and so on. In addition, through the storage function of the micro service management module 210, current limit information configured in advance by a user may also be stored, so as to obtain a cluster total current limit of the micro service cluster, which may be stored in a key value pair form, for example.
Further, the request allocating module 220 also periodically obtains the current operation state information of the micro-services in the micro-service cluster 230 from the micro-service management module 210, updates the network address path corresponding to the micro-services in the micro-service cluster according to the current operation state information, and allocates the request according to the updated network address path corresponding to the micro-services when a subsequent request comes. Optionally, the request allocating module 220 may allocate each subsequent request to the microservices in different microservice clusters 230 in sequence through a polling load balancing mechanism, and of course, optionally, other polling mechanisms may be selected according to the actual current limiting requirement, for example, a weighted polling mechanism, and allocate the request to the microservices with higher weights first according to a preset weight value, and the like, which includes but is not limited to the polling mechanism of the request allocating module 220 described above.
In addition, any micro service in the micro service cluster 230 may also periodically obtain cluster current limiting information from the micro service management module 210 according to a preset time interval, so as to update the current limiting limit in the local cache according to the cluster current limiting information, and perform current limiting control on the target request distributed by the request distribution module 220 according to the updated current limiting limit. Specifically, the distributed current limiting method for the micro-service in the exemplary embodiment of the present disclosure is described in detail below with reference to fig. 1, which performs a main object of any micro-service in the micro-service cluster 230:
in step S110, cluster current limiting information is obtained, where the cluster current limiting information includes a cluster total current limit and current operating state information of each micro-service in the micro-service cluster.
In an exemplary embodiment of the present disclosure, the cluster current limit information is a total current limit amount corresponding to the micro service cluster, for example, the number of requests allowed by the micro service cluster for one minute, and the like, and may be configured by a user according to actual current limit requirements, and may be stored in a key value pair form. And obtaining the condition of each micro service according to the current operation state information of each micro service in the micro service cluster. Any micro service in the micro service cluster 230 may periodically obtain the cluster current limiting information from the micro service management module 210 according to a preset time interval, synchronize the cluster current limiting information to the local cache, and in order to update the cluster current limiting information in the local cache in real time, the preset time interval may be, for example, 1s, 0.5s, and the like, which is not particularly limited by the present disclosure. Through the process, any micro service can directly store the cluster current limiting information to the local, the number of information transmission in the middle process is not required to be increased, the process is simple, and excessive response time is not occupied.
In step S120, the limit in the local cache of the micro service is updated according to the cluster total limit and the current operating state information.
In the exemplary embodiment of the present disclosure, as shown in step S110, the micro service periodically obtains the cluster current limiting information from the micro service management module 210 according to a preset time interval, and based on the cluster current limiting information, periodically updates the current limiting limit value unit in the local cache.
In an exemplary embodiment of the present disclosure, the current operating state information of the microservice may include health or unhealthy. Wherein, the health refers to that the microservice can normally run; the unhealthy condition means that the micro service cannot be operated due to the problems of network configuration errors, breakdown and the like. Fig. 3 shows a flowchart of updating the limit amount in the local cache of the micro service according to the cluster total limit and the current operating status information of the micro service in the micro service cluster, as can be seen from fig. 3, the process includes the following steps:
in step S310, the number of healthy microservices within the microservice cluster is determined based on the current operating state information.
In the exemplary embodiment of the present disclosure, in a special case, there may be some micro services in the micro service cluster that cannot normally process traffic due to network configuration error, breakdown, and other problems. In this case, if the traffic is allocated to the micro service, some traffic cannot be normally processed. In order to avoid the above problem, the healthy microservices in the microservice cluster may be determined according to the current operating state of the microservices, and the traffic may be distributed to each healthy microservice.
In step S320, the current limit is calculated according to the total cluster limit and the number of the health micro-services, and the current limit in the local cache is updated according to the current limit.
In an exemplary embodiment of the present disclosure, a current limit credit is calculated based on the number of cluster total current limits and health micro-services in a local cache; optionally, the request allocating module 220 may allocate the requests to different micro services in sequence according to a time sequence for a polling load balancing mechanism, where the obtained flow rates of the micro services are the same, so as to obtain a current limit (i.e., a stand-alone limit corresponding to any healthy micro service in the micro service cluster) by comparing the total current limit of the cluster with the number of the healthy micro services, and update the current limit in the local cache according to the current limit. Through the process, the current limit of any micro service in the micro service cluster is directly synchronized to the local cache, the number of information transmission is small, the response time can be prolonged to a certain extent, meanwhile, because middleware resources for other intermediate information transmission are not required to be increased, the time delay caused by the fault of the middleware resources or excessive requests is avoided, and the cost increase caused by the middleware resources is also reduced to a certain extent.
Optionally, the current limit obtained by each health microservice may also be different, if the request allocation module employs another polling mechanism, for example, a weighted polling mechanism, the current limit corresponding to each health microservice may also be determined according to the weight corresponding to each health microservice and the total cluster current limit, for example, the current health microservice is M, N and Q, and the corresponding weights are 0.5, 0.3, and 0.2, respectively, the total cluster current limit is allocated to the three health microservices according to the weights, optionally, the weight corresponding to each current microservice may be dynamically adjusted according to the current operating condition of each microservice, for example, the weight with a high current operating busy degree is relatively low; optionally, corresponding weights may be randomly assigned to the healthy micro-services, and the like, which are not particularly limited in this disclosure.
In step S130, current limit control is performed according to the current limit amount in the local cache.
In an exemplary embodiment of the present disclosure, after receiving a target request sent by the request allocating module 220 based on the updated network address path of the micro service, and based on the current limit amount in the local cache obtained in the above steps, current limit control is performed through a preset current limit algorithm. Specifically, whether the request frequency corresponding to the target request exceeds the limit in the local cache can be judged; if the current limit value exceeds the preset threshold value, performing current limit processing on the target request, for example, returning to a default value or waiting for retry and performing preset processing modes; and if not, responding the target request to perform corresponding logic processing.
In an alternative embodiment, the preset throttling algorithm may be, for example, an algorithm, such as a token bucket algorithm, a funnel algorithm, a counter algorithm, etc., which is not particularly limited by this disclosure.
In an alternative embodiment, the preset current limiting algorithm may also be a combination of multiple algorithms, and the specific combination mode may be determined according to actual needs.
Fig. 4 is a schematic diagram illustrating a token bucket algorithm based throttling control, and the token bucket algorithm is taken as an example in fig. 4 to describe that any micro-service performs throttling control according to a throttling limit in a local cache.
In the token bucket algorithm, all target requests need to have an available token before being processed. In step S410, tokens are added to the bucket at a rate and a maximum placed token limit (limit) is set for the bucket; based on this, in step S420, when the target request is reached, first, the tokens in the token bucket are obtained through step S430: in step S440, if the token is received, performing other business logic, and directly deleting the token after the processing is completed; in step S450, if the token is not sufficient and not received, the target request fails.
It should be noted that the token bucket algorithm is only an exemplary illustration for performing current limiting control according to a preset algorithm, and other current limiting manners may also be selected according to actual current limiting requirements, which is not listed in this disclosure.
Based on the current limiting limit in the local cache, the current limiting control is carried out locally without depending on other middleware resources, and the stability of the current limiting control is improved to a certain extent.
In addition, when the unhealthy micro-service or service expansion occurs in the micro-service cluster 230, any healthy micro-service in the micro-service cluster 230 dynamically updates the current limit amount in the corresponding local cache according to the cluster current limit information (including the cluster total current limit and the current healthy micro-service) obtained in real time, and performs current limit control according to the updated current limit amount in the local cache, so that the current limit control is more flexible and has high expansibility.
In summary, based on the cluster total current limit and the current operating state information of each micro-service in the micro-service cluster, the current limit amount in the local cache is updated, so that the control of current limit is realized in the local memory according to the current limit amount in the local cache, the excessive information transmission quantity is avoided, and the request delay is reduced; meanwhile, the current limiting limit can be dynamically adjusted according to the change of the number of the healthy micro-services in the micro-service cluster, so that the flexibility of current limiting control is improved, and the expandability is high; in addition, the distributed current limiting method does not need to depend on a database middleware, current limiting is directly carried out in a local cache according to the current limiting amount, the stability of the current limiting process is high, and the distributed current limiting method is an effective micro-service distributed current limiting method for a micro-service cluster or a container cloud environment.
In an exemplary embodiment of the present disclosure, there is also provided a micro-service distributed current limiting apparatus, and fig. 5 shows a block diagram of the micro-service distributed current limiting apparatus in the present disclosure, and as shown in fig. 5, the micro-service distributed current limiting apparatus includes a current limiting information obtaining module 510, a current limiting amount updating module 520, and a current limiting control module 530. In particular, the method comprises the following steps of,
a current limiting information obtaining module 510, configured to obtain cluster current limiting information, where the cluster current limiting information includes a cluster total current limit and current operating state information of each micro service in a micro service cluster;
a current limit updating module 520, configured to update the current limit in the local cache according to the cluster total current limit and the current operation state information;
and a current limit control module 530, configured to perform current limit control according to the current limit in the local cache.
The details of each module in the distributed current limiting apparatus for microservice are already described in detail in the embodiment of the distributed current limiting method for microservice, and therefore are not described again.
In a disclosed exemplary embodiment, there is also provided a micro-service distributed current limiting system, which includes a micro-service cluster, and any micro-service in the micro-service cluster performs the micro-service distributed current limiting method of any one of the above.
In addition, in an exemplary embodiment of the present disclosure, a computer storage medium capable of implementing the above method is also provided. On which a program product capable of implementing the above-described method of the present specification is stored. In some possible embodiments, aspects of the present disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the present disclosure described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device.
Referring to fig. 6, a program product 600 for implementing the above method according to an exemplary embodiment of the present disclosure is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a 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 program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, 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.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a 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 readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like 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 computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided. As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 700 according to such an embodiment of the present disclosure is described below with reference to fig. 7. The electronic device 700 shown in fig. 7 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, electronic device 700 is embodied in the form of a general purpose computing device. The components of the electronic device 700 may include, but are not limited to: the at least one processing unit 710, the at least one memory unit 720, a bus 730 connecting different system components (including the memory unit 720 and the processing unit 710), and a display unit 740.
Wherein the storage unit stores program code that is executable by the processing unit 710 to cause the processing unit 710 to perform steps according to various exemplary embodiments of the present disclosure as described in the above section "exemplary methods" of this specification.
The storage unit 7201 can include readable media in the form of volatile memory units, such as a random access memory unit (RAM)7201 and/or a cache memory unit 7202, and can further include a read only memory unit (ROM) 7203.
The storage unit 720 may also include a program/utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 730 may be any representation of one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 700, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 700 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 750. Also, the electronic device 700 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the internet) via the network adapter 760. As shown, the network adapter 760 communicates with the other modules of the electronic device 700 via the bus 730. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the terms of the appended claims.

Claims (11)

1. A microservice distributed current limiting method, the method comprising:
acquiring cluster current limiting information, wherein the cluster current limiting information comprises cluster total current limiting and current operation state information of each micro service in a micro service cluster;
updating the current limit in the local cache of the micro-service according to the cluster total current limit and the current operation state information;
and carrying out current limiting control according to the current limiting limit in the local cache.
2. The method of claim 1, further comprising:
and when each micro service in the micro service cluster is started, sending registration information to a micro service management module so that the micro service management module determines the current running state information corresponding to each micro service in the micro service cluster according to the registration information.
3. The method of claim 2, wherein obtaining cluster throttling information comprises:
and periodically acquiring the cluster current limiting information from the micro-service management module according to a preset time interval.
4. The method of claim 1, wherein the updating the limit amount in the local cache of the micro-service according to the cluster total limit and the current operating status information comprises:
determining the number of healthy microservices in the microservice cluster according to the current running state information;
and calculating the current limit amount according to the cluster total current limit and the number of the healthy micro-services, and updating the current limit amount in the local cache of the micro-services according to the current limit amount.
5. The method of claim 4, further comprising:
and periodically updating the network address path corresponding to the healthy microservices in the microservice cluster through a request distribution module based on the current running state information corresponding to each microservice in the microservice cluster.
6. The method of claim 5, wherein prior to performing the current limit control based on the current limit value unit in the local cache, the method further comprises:
receiving a target request sent by the request distribution module based on the updated network address path;
the current limit control according to the current limit amount in the local cache comprises the following steps:
judging whether the request frequency corresponding to the target request exceeds the limit in the local cache or not;
if the current limit value exceeds the preset value, performing current limit processing on the target request; and if not, responding to the target request to perform corresponding logic processing.
7. A microservice distributed current limiting apparatus, the apparatus comprising:
the current limiting information acquisition module is used for acquiring cluster current limiting information, wherein the cluster current limiting information comprises cluster total current limiting and current operation state information of each micro service in a micro service cluster;
the current limit updating module is used for updating the current limit in the local cache of the micro-service according to the cluster total current limit and the current operation state information;
and the current limit control module is used for carrying out current limit control according to the current limit in the local cache.
8. A microservice distributed current limiting apparatus, the apparatus comprising:
the micro-service management module is used for managing cluster current limiting information of a micro-service cluster, wherein the cluster current limiting information comprises a cluster total current limit and current operation state information of each micro-service in the micro-service cluster;
the request distribution module is used for distributing the request to be processed to the micro-services in the micro-service cluster based on the current running state information corresponding to each micro-service in the micro-service cluster;
and the micro-service cluster comprises at least one micro-service and is used for carrying out current limit control on the to-be-processed request distributed by the request distribution module according to the cluster total current limit and the current running state information provided by the micro-service management module.
9. A microservice distributed current limiting system comprising a microservice cluster, any microservice within the microservice cluster performing the microservice distributed current limiting method of any of claims 1-6.
10. A storage medium having stored thereon a computer program which, when executed by a processor, implements the microservice distributed current limiting method of any of claims 1 to 6.
11. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the microservice distributed current limiting method of any of claims 1-6 via execution of the executable instructions.
CN201911067292.XA 2019-11-04 2019-11-04 Microservice distributed current limiting method and device, storage medium and electronic equipment Pending CN110753131A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911067292.XA CN110753131A (en) 2019-11-04 2019-11-04 Microservice distributed current limiting method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911067292.XA CN110753131A (en) 2019-11-04 2019-11-04 Microservice distributed current limiting method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN110753131A true CN110753131A (en) 2020-02-04

Family

ID=69282025

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911067292.XA Pending CN110753131A (en) 2019-11-04 2019-11-04 Microservice distributed current limiting method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN110753131A (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367645A (en) * 2020-03-18 2020-07-03 中国建设银行股份有限公司 Real-time task scheduling control method, system, equipment and readable storage medium
CN111930507A (en) * 2020-08-14 2020-11-13 中国工商银行股份有限公司 Current limiting method and device
CN111988355A (en) * 2020-06-29 2020-11-24 汉海信息技术(上海)有限公司 Current limiting method and device, server and server cluster
CN112073329A (en) * 2020-08-25 2020-12-11 北京五八信息技术有限公司 Distributed current limiting method and device, electronic equipment and storage medium
CN112612618A (en) * 2020-12-30 2021-04-06 深圳我家云网络科技有限公司 Interface current limiting method and device, computer equipment and storage medium
CN112929290A (en) * 2021-02-02 2021-06-08 湖南快乐阳光互动娱乐传媒有限公司 Current limiting method, device, system, storage medium, equipment and gateway
CN113518041A (en) * 2021-06-15 2021-10-19 新华三大数据技术有限公司 Message processing method and device
CN113726675A (en) * 2021-08-27 2021-11-30 上海东普信息科技有限公司 Flow management method, device, equipment and storage medium
CN113923216A (en) * 2021-09-29 2022-01-11 阿里巴巴(中国)有限公司 Distributed cluster current limiting system and method and distributed cluster nodes
CN114006871A (en) * 2021-10-25 2022-02-01 北京有竹居网络技术有限公司 Flow control method, flow control device, container and storage medium
CN114064293A (en) * 2021-11-26 2022-02-18 江苏安超云软件有限公司 Lock-free speed limiting method and device based on polling and storage medium
CN114172902A (en) * 2021-11-12 2022-03-11 北京达佳互联信息技术有限公司 Flow control method and system for service cluster
CN114338535A (en) * 2022-01-12 2022-04-12 平安壹钱包电子商务有限公司 Zookeeper-based cluster current limiting method, system, equipment and storage medium
CN114584519A (en) * 2022-05-05 2022-06-03 飞狐信息技术(天津)有限公司 Message middleware and current limiting method thereof
CN114625520A (en) * 2022-05-16 2022-06-14 中博信息技术研究院有限公司 Distributed task scheduling gateway scheduling method based on current limiting
CN115002043A (en) * 2022-05-30 2022-09-02 重庆长安汽车股份有限公司 Distributed current limiting method, device and storage medium based on registration center

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180287902A1 (en) * 2017-03-29 2018-10-04 Juniper Networks, Inc. Multi-cluster dashboard for distributed virtualization infrastructure element monitoring and policy control
CN109639572A (en) * 2018-12-06 2019-04-16 网易(杭州)网络有限公司 Route management method, device and micro services system
CN109787908A (en) * 2018-12-13 2019-05-21 平安普惠企业管理有限公司 Server current-limiting method, system, computer equipment and storage medium
CN109995669A (en) * 2019-04-09 2019-07-09 深圳前海微众银行股份有限公司 Distributed current-limiting method, device, equipment and readable storage medium storing program for executing
CN110048907A (en) * 2019-03-29 2019-07-23 苏宁易购集团股份有限公司 Global flow control method and device under a kind of cluster environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180287902A1 (en) * 2017-03-29 2018-10-04 Juniper Networks, Inc. Multi-cluster dashboard for distributed virtualization infrastructure element monitoring and policy control
CN109639572A (en) * 2018-12-06 2019-04-16 网易(杭州)网络有限公司 Route management method, device and micro services system
CN109787908A (en) * 2018-12-13 2019-05-21 平安普惠企业管理有限公司 Server current-limiting method, system, computer equipment and storage medium
CN110048907A (en) * 2019-03-29 2019-07-23 苏宁易购集团股份有限公司 Global flow control method and device under a kind of cluster environment
CN109995669A (en) * 2019-04-09 2019-07-09 深圳前海微众银行股份有限公司 Distributed current-limiting method, device, equipment and readable storage medium storing program for executing

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367645A (en) * 2020-03-18 2020-07-03 中国建设银行股份有限公司 Real-time task scheduling control method, system, equipment and readable storage medium
CN111367645B (en) * 2020-03-18 2023-12-22 中国建设银行股份有限公司 Real-time task scheduling control method, system, equipment and readable storage medium
CN111988355A (en) * 2020-06-29 2020-11-24 汉海信息技术(上海)有限公司 Current limiting method and device, server and server cluster
CN111930507A (en) * 2020-08-14 2020-11-13 中国工商银行股份有限公司 Current limiting method and device
CN111930507B (en) * 2020-08-14 2023-09-08 中国工商银行股份有限公司 Current limiting method and device
CN112073329B (en) * 2020-08-25 2023-01-24 北京五八信息技术有限公司 Distributed current limiting method and device, electronic equipment and storage medium
CN112073329A (en) * 2020-08-25 2020-12-11 北京五八信息技术有限公司 Distributed current limiting method and device, electronic equipment and storage medium
CN112612618A (en) * 2020-12-30 2021-04-06 深圳我家云网络科技有限公司 Interface current limiting method and device, computer equipment and storage medium
CN112929290A (en) * 2021-02-02 2021-06-08 湖南快乐阳光互动娱乐传媒有限公司 Current limiting method, device, system, storage medium, equipment and gateway
CN112929290B (en) * 2021-02-02 2023-02-24 湖南快乐阳光互动娱乐传媒有限公司 Current limiting method, device, system, storage medium, equipment and gateway
CN113518041A (en) * 2021-06-15 2021-10-19 新华三大数据技术有限公司 Message processing method and device
CN113518041B (en) * 2021-06-15 2023-05-16 新华三大数据技术有限公司 Message processing method and device
CN113726675A (en) * 2021-08-27 2021-11-30 上海东普信息科技有限公司 Flow management method, device, equipment and storage medium
CN113923216B (en) * 2021-09-29 2023-12-15 阿里巴巴(中国)有限公司 Distributed cluster current limiting system and method and distributed cluster node
CN113923216A (en) * 2021-09-29 2022-01-11 阿里巴巴(中国)有限公司 Distributed cluster current limiting system and method and distributed cluster nodes
CN114006871A (en) * 2021-10-25 2022-02-01 北京有竹居网络技术有限公司 Flow control method, flow control device, container and storage medium
CN114172902A (en) * 2021-11-12 2022-03-11 北京达佳互联信息技术有限公司 Flow control method and system for service cluster
CN114064293B (en) * 2021-11-26 2022-10-04 江苏安超云软件有限公司 Lock-free speed limiting method and device based on polling and storage medium
CN114064293A (en) * 2021-11-26 2022-02-18 江苏安超云软件有限公司 Lock-free speed limiting method and device based on polling and storage medium
CN114338535B (en) * 2022-01-12 2023-09-22 平安壹钱包电子商务有限公司 Zookeeper-based cluster current limiting method, system, equipment and storage medium
CN114338535A (en) * 2022-01-12 2022-04-12 平安壹钱包电子商务有限公司 Zookeeper-based cluster current limiting method, system, equipment and storage medium
CN114584519A (en) * 2022-05-05 2022-06-03 飞狐信息技术(天津)有限公司 Message middleware and current limiting method thereof
CN114625520B (en) * 2022-05-16 2022-08-30 中博信息技术研究院有限公司 Distributed task scheduling gateway scheduling method based on current limiting
CN114625520A (en) * 2022-05-16 2022-06-14 中博信息技术研究院有限公司 Distributed task scheduling gateway scheduling method based on current limiting
CN115002043A (en) * 2022-05-30 2022-09-02 重庆长安汽车股份有限公司 Distributed current limiting method, device and storage medium based on registration center

Similar Documents

Publication Publication Date Title
CN110753131A (en) Microservice distributed current limiting method and device, storage medium and electronic equipment
US10963285B2 (en) Resource management for virtual machines in cloud computing systems
US11455193B2 (en) Method for deploying virtual machines in cloud computing systems based on predicted lifetime
US10771533B2 (en) Adaptive communication control device
US20140282626A1 (en) Processing of application programming interface traffic
US10944581B2 (en) Increasing processing capacity of processor cores during initial program load processing
CN109510878B (en) Long connection session keeping method and device
US20200110631A1 (en) Virtual machine deployment method and omm virtual machine
US9588913B2 (en) Management of allocation for alias devices
US20170147395A1 (en) Dynamic timeout period adjustment of service requests
US10884818B2 (en) Increasing processing capacity of virtual machines
CN107483634B (en) Load balancing method and system
EP4006725A1 (en) Virtual machine migration processing and strategy generation method, apparatus and device, and storage medium
US10956228B2 (en) Task management using a virtual node
US10884845B2 (en) Increasing processing capacity of processor cores during initial program load processing
US11582049B2 (en) Virtual network function management
US10673937B2 (en) Dynamic record-level sharing (RLS) provisioning inside a data-sharing subsystem
US11307889B2 (en) Schedule virtual machines
KR102064466B1 (en) Method for allocationing virtual desktop in virtualization system and virtualization system thereof
JP2017142647A (en) Resource management device and resource management method
US9270530B1 (en) Managing imaging of multiple computing devices
JP6349786B2 (en) Virtual machine management apparatus, virtual machine management method, and virtual machine management program

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200204

RJ01 Rejection of invention patent application after publication