CN117319310A - Interface current limiting method, device, electronic equipment and readable medium - Google Patents

Interface current limiting method, device, electronic equipment and readable medium Download PDF

Info

Publication number
CN117319310A
CN117319310A CN202311236751.9A CN202311236751A CN117319310A CN 117319310 A CN117319310 A CN 117319310A CN 202311236751 A CN202311236751 A CN 202311236751A CN 117319310 A CN117319310 A CN 117319310A
Authority
CN
China
Prior art keywords
interface
token
token pool
type
cpu
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
CN202311236751.9A
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.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Information Technology 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 Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202311236751.9A priority Critical patent/CN117319310A/en
Publication of CN117319310A publication Critical patent/CN117319310A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/20Traffic policing
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The disclosure provides an interface current limiting method, an interface current limiting device, electronic equipment and a readable medium, wherein the interface current limiting method comprises the following steps: determining the query quantity per second of any one of the interfaces, and acquiring the weight corresponding to any one interface; determining the estimated resource quantity of the corresponding CPU occupied by a plurality of interfaces according to the query quantity and the weight of each second; and determining whether to limit the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU. By the embodiment of the disclosure, the reliability of interface current limiting processing is improved, and the reliability of interface data interaction is improved.

Description

Interface current limiting method, device, electronic equipment and readable medium
Technical Field
The disclosure relates to the technical field of current limiting, in particular to an interface current limiting method, an interface current limiting device, electronic equipment and a readable medium.
Background
At present, along with the development of the Internet, massive Internet users are gradually accumulated, the scene of flow surge is more and more, and the time is also more and more uncontrollable.
In the related art, the current limiting scheme is usually to perform pressure measurement according to the magnitude of the flow, so that the cpu and the load of the machine reach a critical value, and the critical value is used as a current limiting standard.
However, when a high concurrent flow occurs in multiple interfaces, the current limit threshold of the cpu may be exceeded, so that the multiple interfaces are limited, which not only affects the flow interaction of the important interfaces and reduces the fluency and reliability of the system data interaction, but also causes the waste of server resources.
It should be noted that the information disclosed in the above background section is only for enhancing 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
An object of the present disclosure is to provide an interface current limiting method, apparatus, electronic device, and readable medium for overcoming, at least to some extent, the problem of poor reliability of interface current limiting due to limitations and disadvantages of the related art.
According to a first aspect of an embodiment of the present disclosure, there is provided an interface current limiting method, including: determining the query quantity per second of any one of the interfaces, and acquiring the weight corresponding to any one of the interfaces; determining the estimated resource quantity of the corresponding CPU occupied by a plurality of interfaces according to the query quantity per second and the weight; and determining whether to limit the flow of the interface based on a token pool according to the estimated resource amount and the resource utilization threshold of the CPU.
In one exemplary embodiment of the present disclosure, determining whether to throttle the interface based on a token pool according to the estimated amount of resources and a resource utilization threshold of the CPU includes:
acquiring a corresponding relation between the token pool and the resource utilization threshold;
and determining the residual token number of the token pool based on the corresponding relation and the estimated resource amount, and determining whether to limit the flow of the interface according to the residual token number.
In an exemplary embodiment of the present disclosure, determining whether to throttle the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU further includes:
acquiring a corresponding relation between the token pool and the resource utilization threshold, wherein the token pool comprises a first type token pool and a second type token pool;
determining that the interface is a first type interface or a second type interface according to the configuration information of the interface;
if the interface is determined to be a first type interface, requesting a token from the first type token pool based on the first type interface preferentially;
if the token request from the first type token pool based on the interface fails, requesting a token from the second type token pool based on the first type interface;
and determining whether to limit the first type interface according to the residual token number of the second type token pool.
In an exemplary embodiment of the present disclosure, determining whether to throttle the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU further includes:
and if the request of the token from the second class token pool based on the first class interface fails, determining to limit the flow of the first class interface.
In an exemplary embodiment of the present disclosure, determining whether to throttle the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU further includes:
if the interface is determined to be a second type interface, requesting a token from the second type token pool based on the second type interface;
and determining whether to limit the flow of the second class interface according to the residual token number of the second class token pool.
In an exemplary embodiment of the present disclosure, determining whether to throttle the interface based on the token pool further includes:
and if the fact that the request of the second class of the token from the second class of the token pool based on the second class of the interfaces fails is determined, determining to limit the flow of the second class of the interfaces.
In an exemplary embodiment of the present disclosure, determining, based on the query volume per second and the weights, an estimated amount of resources occupied by the plurality of interfaces by the corresponding CPUs includes:
converting the query quantity per second into the resource occupancy rate of the CPU;
calculating a weighted sum of all the interfaces according to the resource occupancy rate and the weight;
and calculating the estimated resource amount according to the weighted sum.
According to a second aspect of embodiments of the present disclosure, there is provided an interface current limiting device, comprising:
a determining module configured to determine an amount of queries per second for any of the plurality of interfaces;
the determining module is configured to determine the weight of any interface according to the query quantity per second;
the determining module is configured to determine the estimated resource quantity of the corresponding CPU occupied by the interfaces according to the query quantity per second and the weight;
the comparison module is used for comparing the magnitude relation between the estimated resource quantity and the resource utilization threshold value of the CPU;
and the current limiting module is used for determining whether the interface is limited based on the token pool according to the size relation.
According to a third aspect of the present disclosure, there is provided an electronic device comprising: a memory; and a processor coupled to the memory, the processor configured to perform the method of any of the above based on instructions stored in the memory.
According to a fourth aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a program which, when executed by a processor, implements an interface throttling method as set forth in any of the preceding claims.
According to the method and the device, the query quantity per second of any one of the interfaces is determined, the weight of any one of the interfaces is determined according to the query quantity per second, the weight is used for defining the importance degree of interface interaction, the estimated resource quantity of the corresponding CPU occupied by the interfaces is further determined according to the query quantity per second and the weight, after the magnitude relation between the estimated resource quantity and the resource utilization threshold of the CPU is compared, whether the interfaces are limited based on the token pool is determined continuously according to the magnitude relation, the interaction fluency of the interfaces is preferentially guaranteed even if the current limiting treatment is carried out, the reliability of interface current limiting treatment is improved, and the utilization rate of server resources is improved.
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 accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort.
FIG. 1 illustrates a schematic diagram of an exemplary system architecture to which an interface throttling scheme of embodiments of the present invention may be applied;
FIG. 2 is a flow chart of an interface flow-limiting method in an exemplary embodiment of the present disclosure;
FIG. 3 is a flow chart of another interface throttling method in an exemplary embodiment of the present disclosure;
FIG. 4 is a flow chart of another interface throttling method in an exemplary embodiment of the present disclosure;
FIG. 5 is a flow chart of another interface throttling method in an exemplary embodiment of the present disclosure;
FIG. 6 is a flow chart of another interface throttling method in an exemplary embodiment of the present disclosure;
FIG. 7 is a flow chart of another interface throttling method in an exemplary embodiment of the present disclosure;
FIG. 8 is a flow chart of another interface throttling method in an exemplary embodiment of the present disclosure;
FIG. 9 is a schematic architecture diagram of an interface current limiting scheme in an exemplary embodiment of the present disclosure;
FIG. 10 is a flowchart of another interface throttling method in an exemplary embodiment of the present disclosure;
FIG. 11 is a schematic diagram of a token pool for another interface throttling scheme in an exemplary embodiment of the present disclosure;
FIG. 12 is a flowchart of another interface throttling method in an exemplary embodiment of the present disclosure;
FIG. 13 is a block diagram of an interface current limiting device in an exemplary embodiment of the present disclosure;
fig. 14 is a block diagram of an electronic device in an exemplary embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many 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 the example embodiments to those skilled in the art. 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 present disclosure. One skilled in the relevant art will recognize, however, that the aspects of the disclosure may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are only schematic illustrations of the present disclosure, in which the same reference numerals denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
FIG. 1 illustrates a schematic diagram of an exemplary system architecture to which an interface throttling scheme of embodiments of the present invention may be applied.
As shown in fig. 1, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, the server 105 may be a server cluster formed by a plurality of servers.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. The terminal devices 101, 102, 103 may be various electronic devices with display screens including, but not limited to, smartphones, tablet computers, portable computers, desktop computers, and the like.
In some embodiments, the interface current limiting method provided by the embodiments of the present invention is generally performed by the server 105, and accordingly, the interface current limiting device is generally disposed in the terminal device 103 (may also be the terminal device 101 or 102). In other embodiments, some terminals may have similar functionality as server devices to perform the method.
The following describes example embodiments of the present disclosure in detail with reference to the accompanying drawings.
Fig. 2 is a flow chart of an interface flow-limiting method in an exemplary embodiment of the present disclosure.
Referring to fig. 2, the interface current limiting method may include:
step S202, determining the query amount per second of any one of the interfaces, and acquiring the weight corresponding to any one of the interfaces.
And step S204, determining the estimated resource quantity of the corresponding CPU occupied by the interfaces according to the query quantity per second and the weight.
And S206, determining whether to limit the flow of the interface based on a token pool according to the estimated resource amount and the resource utilization threshold of the CPU.
According to the method and the device, the query quantity per second of any one of the interfaces is determined, the weight of any one of the interfaces is determined according to the query quantity per second, the weight is used for defining the importance degree of interface interaction, the estimated resource quantity of the corresponding CPU occupied by the interfaces is further determined according to the query quantity per second and the weight, after the magnitude relation between the estimated resource quantity and the resource utilization threshold of the CPU is compared, whether the interfaces are limited based on the token pool is determined continuously according to the magnitude relation, the interaction fluency of the interfaces is preferentially guaranteed even if the current limiting treatment is carried out, the reliability of interface current limiting treatment is improved, and the utilization rate of server resources is improved.
Next, each step of the interface flow limiting method will be described in detail.
In an exemplary embodiment of the present disclosure, as shown in fig. 3, determining whether to throttle the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU includes:
step S302, obtaining a correspondence between the token pool and the resource utilization threshold.
And step S304, determining the residual token number of the token pool based on the corresponding relation and the estimated resource amount, and determining whether to limit the interface according to the residual token number.
In an exemplary embodiment of the present disclosure, the data interaction priority of the first type of interface is higher than the data interaction priority of the second type of interface, and the first type of interface and the second type of interface may be updated according to real-time traffic or user configuration, so that reliability of data interaction of the first type of interface is preferentially ensured.
In an exemplary embodiment of the present disclosure, as shown in fig. 4, determining whether to limit the flow of the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU further includes:
step S402, obtaining a correspondence between the token pool and the resource utilization threshold, where the token pool includes a first type token pool and a second type token pool.
Step S404, determining that the interface is a first type interface or a second type interface according to the configuration information of the interface.
In step S406, if the interface is determined to be the first type interface, the token is preferentially requested from the first type token pool based on the first type interface.
Step S408, if it is determined that the request for the token from the first type token pool based on the interface fails, requesting a token from the second type token pool based on the first type interface.
Step S410, determining whether to limit the first class interface according to the remaining token number of the second class token pool.
In an exemplary embodiment of the present disclosure, the first class token pool provides tokens only to the first class interface, and the first class interface requests tokens to the second class token pool after preferentially requesting tokens to the first class token pool fails, and the second class token pool may provide tokens to the first class interface and the second class interface.
In an exemplary embodiment of the present disclosure, as shown in fig. 5, determining whether to limit the flow of the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU further includes:
step S502, if it is determined that the request for the token from the second class token pool based on the first class interface fails, determining to limit the flow of the first class interface.
In an exemplary embodiment of the present disclosure, as shown in fig. 6, determining whether to limit the flow of the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU further includes:
step S602, if it is determined that the interface is the second type interface, requesting a token from the second type token pool based on the second type interface.
Step S602, determining whether to limit the flow of the second class interface according to the remaining token number of the second class token pool.
In an exemplary embodiment of the present disclosure, as shown in fig. 7, according to a result of the interface obtaining the token, determining whether to throttle the interface based on the token pool further includes:
step S702, if it is determined that the request for the token from the second class token pool based on the second class interface fails, determining to limit the flow of the second class interface.
In an exemplary embodiment of the present disclosure, as shown in fig. 8, determining, according to the query volume per second and the weights, the estimated amounts of resources occupied by the plurality of interfaces by the corresponding CPUs includes:
and step S802, converting the query quantity per second into the resource occupancy rate of the CPU.
Step S804, calculating the weighted sum of all the interfaces according to the resource occupancy rate and the weight.
Step S806, calculating the estimated resource amount according to the weighted sum.
In one exemplary embodiment of the present disclosure, the current limit threshold of embodiments of the present disclosure is set according to CPU utilization, with each token reduction being the CPU utilization consumed by a single call of the interface.
The flow limit calculation 904 of the flow limit and bypass of the interface invocation 902 in the flow limit and flow limit architecture 900 presented in this disclosure is specifically described below in connection with fig. 9-12.
(1) Interface call throttling:
and when the service system receives the request of interface call, obtaining a token from the token pool, if the token is obtained, normally executing service logic, otherwise, executing logic of the current limit.
(2) Bypass limit flow calculation 904:
as shown in fig. 9, the bypass flow limit calculation 904 is mainly used for calculating parameters such as a rate of producing tokens according to the execution condition of a system history, and specifically includes:
and (2.1) the data acquisition platform is used for acquiring interface information of a service system, call quantity of each interface, CPU utilization information of a server and the like.
(2.2)QPSThe CPU relation calculating module calculates the relation between QPS (query-per-second) and CPU based on the historical data, and stores the weight of the nth interface increased compared with CPU n
Wherein weight is n Identification interface n call volume qps n The weight of (2) can be calculated by adopting a least square fitting mode, and a specific calculation formula is shown in the following formula (1):
cpu=weight 1 ×qps 1 +weight 2 ×qps 2 +…+weight n ×qps n equation (1).
(2.3) as shown in fig. 10, the flow of the flow limiting module includes:
step S1002, configuring CPU to limit CPU per time unit limit And identifying the CPU utilization rate of the largest occupied interface of the configuration, and calling the nth interface.
Step S1004, obtaining weight parameter weight of the nth interface n
Step S1006, calculating CPU loss CPU of nth interface call 1 time use =weight n
Step S1008, judging cpu limit >cpu use If yes, step S1010 is executed, and if no, step S1010 is executed.
Step S1010, if CPU limit Less than or equal to cpu use The current limit is triggered and the current limit threshold configured by the current limit algorithm is typically QPS of the interface.
Step S1012, if CPU limit Greater than cpu use Cpu then limit Reducing cpu use
Step S1014, executing business logic.
In summary, the present disclosure uses CPU utilization as a condition for triggering current limiting, and the improvement of the current limiting algorithm includes: the set current limiting threshold is CPU utilization rate; the number of tokens per token reduction is the CPU utilization consumed for 1 call of the interface.
As shown in fig. 11, token pool 1100 refers to a pool of resources (which in this disclosure can be understood as remaining CPU utilization that can be used) for holding tokens, from which tokens are acquired each time an interface requests. Because the importance of each interface is inconsistent, the priorities of the current limits are inconsistent, the present disclosure divides the token pool 1100 according to the priorities, which specifically includes the following two ways:
(1) There is no priority, only a CPU threshold throttling manner, i.e., a unified token pool 1100 is used, i.e., the first-invoked interface preferentially obtains tokens.
(2) And meanwhile, a flow protection and CPU threshold current limiting mode is supported, the flow protection means that certain important interfaces (a post Wen Jian weighing protection interface) are guaranteed, tokens can be obtained certainly in the set flow protection threshold, for example, interface A needs to be guaranteed to be executed at least 1000 times per second, at least 1000 tokens are set, and the whole token pool 1100 is split into an interface re-protection thread pool and a shared thread pool.
Where the overall token pool 1100 configures a total CPU threshold, when the CPU exceeds the threshold, a throttling is triggered that is equal to the sum of the re-protection token pool and the shared token pool 110n+1 of the respective interface configurations, e.g., the re-protection token pool includes interface 1 re-protection token pool 1101, interface 2 re-protection token pools 1102, … …, interface n re-protection token pool 110n.
The calculation mode of the interface re-protection token pool 1100 is shown in the following formula (2):
when the interface call of the flow protection is configured, the token is preferentially acquired from the reinsurance thread pool, and if the token cannot be acquired, the token is acquired from the shared token pool 1100.
As shown in fig. 12, the token acquisition process specifically includes the following steps:
step S1202, a call request of the interface i is received.
Step S1204, an attempt is made to fetch a token from the pool of interface i re-security tokens.
Step S1206, it is determined whether or not a token is acquired, if yes, step S1208 is executed, and if no, step S1210 is executed.
Step S1208, interface i executes.
Step S1210, an attempt is made to fetch tokens from a pool of non-reinsurance tokens.
Step S1212, judging whether the token is taken, if so, executing step S1214, and if not, executing step S1216
In step S1214, the interface i executes.
Step S1216, current limiting.
Corresponding to the above method embodiments, the present disclosure further provides an interface current limiting device, which may be used to perform the above method embodiments.
Fig. 13 is a block diagram of an interface current limiting device in an exemplary embodiment of the present disclosure.
Referring to fig. 13, the interface flow restricting device 1300 may include:
the determining module 1302 is configured to determine an amount of queries per second of any interface of the plurality of interfaces, and obtain a weight corresponding to any of the interfaces.
The determining module 1302 is configured to determine, according to the query volume per second and the weights, estimated amounts of resources occupied by the interfaces corresponding to the CPUs.
The current limiting module 1304 is configured to determine whether to limit the current of the interface based on the token pool according to the estimated amount of resources and the resource utilization threshold of the CPU.
In an exemplary embodiment of the present disclosure, the determining module 1302 is further configured to:
if the estimated resource amount is greater than or equal to the resource utilization threshold of the CPU, determining that the interface is a first type interface or a second type interface according to the configuration information of the interface;
controlling the interface to request tokens from the corresponding token pools so that the interface realizes data interaction based on the tokens;
and determining whether to limit the flow of the interface based on a token pool according to the result of the token acquired by the interface.
In an exemplary embodiment of the present disclosure, the determining module 1302 is further configured to:
acquiring a corresponding relation between the token pool and the resource utilization threshold, wherein the token pool comprises a first type token pool and a second type token pool;
determining that the interface is a first type interface or a second type interface according to the configuration information of the interface;
if the interface is determined to be a first type interface, requesting a token from the first type token pool based on the first type interface preferentially;
if the token request from the first type token pool based on the interface fails, requesting a token from the second type token pool based on the first type interface;
and determining whether to limit the first type interface according to the residual token number of the second type token pool.
In one exemplary embodiment of the present disclosure, the current limit module 1304 is further configured to:
determining whether to limit the flow of the interface based on the token pool according to the estimated resource amount and the resource utilization threshold of the CPU further comprises:
and if the request of the token from the second class token pool based on the first class interface fails, determining to limit the flow of the first class interface.
In an exemplary embodiment of the present disclosure, the determining module 1302 is further configured to:
if the interface is determined to be a second type interface, requesting a token from the second type token pool based on the second type interface;
and determining whether to limit the flow of the second class interface according to the residual token number of the second class token pool.
In one exemplary embodiment of the present disclosure, the current limit module 1304 is further configured to:
and if the fact that the request of the second class of tokens to the second class of token pool based on the second class of interfaces fails is determined, limiting the second class of interfaces is determined.
In an exemplary embodiment of the present disclosure, the determining module 1302 is further configured to:
converting the query quantity per second into the resource occupancy rate of the CPU;
calculating a weighted sum of all the interfaces according to the resource occupancy rate and the weight;
and calculating the estimated resource amount according to the weighted sum.
Since the functions of the apparatus 1300 are described in detail in the corresponding method embodiments, the disclosure is not repeated here.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
Those skilled in the art will appreciate that the various aspects of the invention may be implemented as a system, method, or program product. Accordingly, aspects of the invention may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system.
An electronic device 1400 according to such an embodiment of the invention is described below with reference to fig. 14. The electronic device 1400 shown in fig. 14 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 14, the electronic device 1400 is embodied in the form of a general purpose computing device. Components of electronic device 1400 may include, but are not limited to: the at least one processing unit 1410, the at least one memory unit 1420, and a bus 1430 connecting the different system components (including the memory unit 1420 and the processing unit 1410).
Wherein the storage unit stores program code that is executable by the processing unit 1410 such that the processing unit 1410 performs steps according to various exemplary embodiments of the present invention described in the above section of the "exemplary method" of the present specification. For example, the processing unit 1410 may perform the methods as shown in the embodiments of the present disclosure.
The memory unit 1420 may include readable media in the form of volatile memory units, such as Random Access Memory (RAM) 14201 and/or cache memory 14202, and may further include Read Only Memory (ROM) 14203.
The memory unit 1420 may also include a program/utility 14204 having a set (at least one) of program modules 14205, such program modules 14205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 1430 may be a local bus representing 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 using any of a variety of bus architectures.
The electronic device 1400 may also communicate with one or more external devices 1440 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 1400, and/or any device (e.g., router, modem, etc.) that enables the electronic device 1400 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 1450. Also, electronic device 1400 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 1460. As shown, the network adapter 1460 communicates with other modules of the electronic device 1400 via the bus 1430. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 1400, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, 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 (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, a computer-readable storage medium having stored thereon a program product capable of implementing the method described above in the present specification is also provided. In some possible embodiments, the various aspects of the invention may also be implemented in the form of a program product comprising program code for causing a terminal device to carry out the steps according to the various exemplary embodiments of the invention as described in the "exemplary methods" section of this specification, when said program product is run on the terminal device.
The program product for implementing the above-described method according to an embodiment of the present invention 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 invention is not limited thereto, and in the present disclosure, the 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. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A 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 of the present invention 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, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, 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., connected via the Internet using an Internet service provider).
Furthermore, the above-described drawings are only schematic illustrations of processes included in the method according to the exemplary embodiment of the present invention, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of 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 application is intended to cover any adaptations, 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.

Claims (10)

1. An interface current limiting method, comprising:
determining the query quantity per second of any one of the interfaces, and acquiring the weight corresponding to any one of the interfaces;
determining the estimated resource quantity of the corresponding CPU occupied by a plurality of interfaces according to the query quantity per second and the weight;
and determining whether to limit the flow of the interface based on a token pool according to the estimated resource amount and the resource utilization threshold of the CPU.
2. The interface throttling method of claim 1 wherein determining whether to throttle the interface based on a token pool based on the estimated amount of resources and a resource utilization threshold of the CPU comprises:
acquiring a corresponding relation between the token pool and the resource utilization threshold;
and determining the residual token number of the token pool based on the corresponding relation and the estimated resource amount, and determining whether to limit the flow of the interface according to the residual token number.
3. The interface throttling method of claim 1 wherein determining whether to throttle the interface based on a token pool based on the estimated amount of resources and a resource utilization threshold of the CPU further comprises:
acquiring a corresponding relation between the token pool and the resource utilization threshold, wherein the token pool comprises a first type token pool and a second type token pool;
determining that the interface is a first type interface or a second type interface according to the configuration information of the interface;
if the interface is determined to be a first type interface, requesting a token from the first type token pool based on the first type interface preferentially;
if the token request from the first type token pool based on the interface fails, requesting a token from the second type token pool based on the first type interface;
and determining whether to limit the first type interface according to the residual token number of the second type token pool.
4. The interface throttling method of claim 3 wherein determining whether to throttle the interface based on a token pool based on the estimated amount of resources and a resource utilization threshold of the CPU further comprises:
and if the request of the token from the second class token pool based on the first class interface fails, determining to limit the flow of the first class interface.
5. The interface throttling method of claim 3 wherein determining whether to throttle the interface based on a token pool based on the estimated amount of resources and a resource utilization threshold of the CPU further comprises:
if the interface is determined to be a second type interface, requesting a token from the second type token pool based on the second type interface;
and determining whether to limit the flow of the second class interface according to the residual token number of the second class token pool.
6. The interface throttling method of claim 3 wherein determining whether to throttle the interface based on a token pool based on a result of the interface obtaining the token further comprises:
and if the fact that the request of the second class of the token from the second class of the token pool based on the second class of the interfaces fails is determined, determining to limit the flow of the second class of the interfaces.
7. The interface throttling method of any of claims 1-6, wherein determining an estimated amount of resources of a plurality of said interfaces occupying a corresponding CPU based on said query volume per second and said weights comprises:
converting the query quantity per second into the resource occupancy rate of the CPU;
calculating a weighted sum of all the interfaces according to the resource occupancy rate and the weight;
and calculating the estimated resource amount according to the weighted sum.
8. An interface flow restrictor device, comprising:
a determining module configured to determine an amount of queries per second for any of the plurality of interfaces;
the determining module is configured to determine the weight of any interface according to the query quantity per second;
the determining module is configured to determine the estimated resource quantity of the corresponding CPU occupied by the interfaces according to the query quantity per second and the weight;
the comparison module is used for comparing the magnitude relation between the estimated resource quantity and the resource utilization threshold value of the CPU;
and the current limiting module is used for determining whether the interface is limited based on the token pool according to the size relation.
9. An electronic device, comprising:
a memory; and
a processor coupled to the memory, the processor configured to perform the interface throttling method of any of claims 1-7 based on instructions stored in the memory.
10. A computer readable storage medium having stored thereon a program which when executed by a processor implements the interface throttling method of any of claims 1-7.
CN202311236751.9A 2023-09-22 2023-09-22 Interface current limiting method, device, electronic equipment and readable medium Pending CN117319310A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311236751.9A CN117319310A (en) 2023-09-22 2023-09-22 Interface current limiting method, device, electronic equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311236751.9A CN117319310A (en) 2023-09-22 2023-09-22 Interface current limiting method, device, electronic equipment and readable medium

Publications (1)

Publication Number Publication Date
CN117319310A true CN117319310A (en) 2023-12-29

Family

ID=89254635

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311236751.9A Pending CN117319310A (en) 2023-09-22 2023-09-22 Interface current limiting method, device, electronic equipment and readable medium

Country Status (1)

Country Link
CN (1) CN117319310A (en)

Similar Documents

Publication Publication Date Title
US20170222890A1 (en) Dynamic scaling of storage volumes for storage client file systems
CN110808914A (en) Access request processing method and device and electronic equipment
CN109600384B (en) Flow switching method, system, equipment and storage medium in RPC interface upgrading
CN111737022B (en) Micro-service-based interface calling method, system, equipment and medium
CN104364758A (en) API redirection for limited capability operating systems
CN110717132A (en) Data collection method and pushing method for full-link monitoring system and related equipment
CN113765818A (en) Distributed current limiting method, device, equipment, storage medium and system
CN110460647B (en) Network node scheduling method and device, electronic equipment and storage medium
CN115904761A (en) System on chip, vehicle and video processing unit virtualization method
CN113411400B (en) Information calling method and device, electronic equipment and readable storage medium
CN112835632A (en) Method and device for calling end capability and computer storage medium
CN112799824A (en) Current limiting method, device, equipment and storage medium
CN109308243B (en) Data processing method, data processing device, computer equipment and medium
CN117319310A (en) Interface current limiting method, device, electronic equipment and readable medium
CN108400929B (en) Data processing method, device, computing equipment and medium
CN115437794A (en) I/O request scheduling method and device, electronic equipment and storage medium
CN113946493A (en) Monitoring threshold determination and monitoring alarm method, device, equipment and medium
CN111681093B (en) Method and device for displaying resource page and electronic equipment
CN110990167B (en) Front-end communication method and device, storage medium and electronic equipment
CN111258477B (en) Tab configuration method, system, device and storage medium
CN106484536B (en) IO scheduling method, device and equipment
CN113641966B (en) Application integration method, system, equipment and medium
CN109918209B (en) Method and equipment for communication between threads
CN115470292B (en) Block chain consensus method, device, electronic equipment and readable storage medium
US20170206012A1 (en) Provisioning storage allocation using prioritized storage system capabilities

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