CN115421922A - Current limiting method, device, equipment, medium and product of distributed system - Google Patents

Current limiting method, device, equipment, medium and product of distributed system Download PDF

Info

Publication number
CN115421922A
CN115421922A CN202211190107.8A CN202211190107A CN115421922A CN 115421922 A CN115421922 A CN 115421922A CN 202211190107 A CN202211190107 A CN 202211190107A CN 115421922 A CN115421922 A CN 115421922A
Authority
CN
China
Prior art keywords
target
current limiting
processing
request
current
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
CN202211190107.8A
Other languages
Chinese (zh)
Inventor
李壮壮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202211190107.8A priority Critical patent/CN115421922A/en
Publication of CN115421922A publication Critical patent/CN115421922A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • G06F9/5088Techniques for rebalancing the load in a distributed system involving task migration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Abstract

The invention discloses a current limiting method, a current limiting device, equipment, a storage medium and a product applied to a distributed system. When a service processing request is received, intercepting the service processing request and determining a target processing interface corresponding to the service request; when the target processing interface is configured with a current limiting annotation, determining a target current limiting parameter corresponding to the target processing interface from a pre-established current limiting rule table; acquiring data traffic corresponding to the interface function of the target processing interface, which is stored in the cache, based on a target script; and determining whether to request current-limiting processing for the service processing based on the target current-limiting parameter and the data flow, solving the technical problem that the single machine current-limiting cannot control the overall access flow of the system, realizing the overall current-limiting effect of the distributed system, improving the current-limiting efficiency of the distributed system and ensuring the stability of the distributed system.

Description

Current limiting method, device, equipment, medium and product of distributed system
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, a medium, and a product for limiting a current in a distributed system.
Background
With the rapid development of the mobile internet, the transaction amount processed based on a computer is more and more, and in order to solve the problem of the rapid increase of the transaction amount, the system architecture is also evolved into a distributed architecture from the traditional cluster architecture. For a distributed architecture system configured with many service nodes, each service node may provide multiple services. In specific application, current limiting is an important means for ensuring high efficiency and availability of a system, and is used for limiting the speed of a request in a single time window, so that the system can be ensured to normally provide services to the outside, and once a current limiting threshold is reached, the system can refuse the services or queue for waiting.
In the prior art, a common current limiting method is single service node current limiting, which is also called single machine current limiting, and means that after a request enters a service node, the current limiting threshold is exceeded, and the service node executes a current limiting protection measure.
However, the stand-alone current limiting approach is limited to only a single service node, and does not take into account the integrity of the system. Therefore, the prior art cannot control the overall access flow of the system, has the problem that the overall flow limitation cannot be performed on the system interface, and cannot ensure that the distributed structure system stably and efficiently processes various service requests.
Disclosure of Invention
The invention provides a current limiting method, a current limiting device, equipment, a current limiting medium and a current limiting product of a distributed system, which realize the integral current limiting effect of the distributed system, improve the current limiting efficiency of the distributed system and ensure the stability of the distributed system.
In a first aspect, the present invention provides a current limiting method applied to a distributed system, including:
when receiving a service processing request, intercepting the service processing request and determining a target processing interface corresponding to the service request;
when the target processing interface is configured with the current limiting annotation, determining a target current limiting parameter corresponding to the target processing interface from a pre-established current limiting rule table;
acquiring data traffic corresponding to the interface function of the target processing interface and stored in the cache based on the target script;
and determining whether to request current limiting processing for the service processing based on the target current limiting parameter and the data flow.
In a second aspect, the present invention provides a current limiting apparatus applied to a distributed system, the apparatus including:
the processing interface determining module intercepts the service processing request and determines a target processing interface corresponding to the service request when receiving the service processing request;
the current limiting parameter determining module is used for determining a target current limiting parameter corresponding to the target processing interface from a pre-established current limiting rule table when the target processing interface is configured with a current limiting annotation;
the data flow acquisition module is used for acquiring data flow which is stored in the cache and corresponds to the interface function of the target processing interface based on the target script;
and the current limiting processing determining module is used for determining whether to request current limiting processing for the service processing based on the target current limiting parameter and the data flow.
In a third aspect, the present invention provides an electronic device for a current limiting method applied in a distributed system, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method of any of the embodiments of the present invention applied to a current limiting method for a distributed system.
In a fourth aspect, the present invention provides a computer-readable storage medium storing computer instructions for causing a processor to implement the method for limiting current applied to a distributed system according to any one of the embodiments of the present invention when the computer instructions are executed.
In a fifth aspect, the present invention provides a computer program product comprising a computer program which, when executed by a processor, implements the method of any of the embodiments of the present invention for application in a method of current limiting for a distributed system.
The embodiment of the invention provides a current limiting method applied to a distributed system, which intercepts a service processing request and determines a target processing interface corresponding to the service request when receiving the service processing request, and determines a target current limiting parameter corresponding to the target processing interface from a pre-established current limiting rule table if the target processing interface is configured with a current limiting annotation. And finally, determining whether to request current limiting processing for the service processing based on the target current limiting parameter and the data flow. The technical scheme provided by the invention solves the technical problem that the single machine current limiting can not control the whole access flow of the distributed system in the prior art, limits the whole access flow of the functional interface by combining the target script with the current limiting parameter, realizes the configurable current limiting parameter, supports the beneficial effects of modifying and validating the current limiting parameter in real time, realizes the whole current limiting effect of the distributed system, improves the current limiting efficiency of the distributed system and ensures the stability of the distributed system.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a current limiting method applied to a distributed system according to an embodiment of the present invention;
fig. 2 is a flowchart of a current limiting method applied to a distributed system according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a current limiting method and apparatus applied to a distributed system according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first preset condition", "second preset condition", and the like in the description and the claims of the present invention and the drawings are used for distinguishing similar objects and are not necessarily used for describing a specific order or sequence. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Before the technical solution is introduced, an application scenario of the embodiment of the present invention may be exemplarily described. The distributed structure system is a system which divides a function module into a plurality of services such as user service, account service and investment financing service according to the idea of microservice, and if different services have dependency relationship, a Remote Procedure Call Protocol (RPC) mode is used for interface calling. For a distributed architecture system configured with many service nodes, each service node may provide multiple services, and thus there are multiple functional interfaces for each service node. If a certain functional interface needs to be limited, current limit notes can be preset, so that when a service request is subsequently received, whether integral current limit needs to be carried out can be determined based on whether the current limit notes exist. In order to clearly describe the technical solutions provided by the embodiments of the present invention, one of the functional interfaces is taken as an example for description. For example, the functional interface is a "life payment" functional interface, and the "life payment" functional interface is distributed on a plurality of service nodes, for example, the distributed structure system has 10 service nodes, and all 10 service nodes have "life payment" functional interfaces.
Fig. 1 is a flowchart of a current limiting method applied to a distributed system according to an embodiment of the present invention; the present embodiment is applicable to a case where access traffic of the system as a whole is controlled. The method can be executed by a current limiting device of a distributed system, the current limiting device of the distributed system can be realized in a hardware and/or software mode, and the current limiting device of the distributed system can be configured on a computer device, and the computer device can be a notebook, a desktop computer, an intelligent tablet and the like. As shown in fig. 1, the method includes:
s110, when receiving the service processing request, intercepting the service processing request and determining a target processing interface corresponding to the service request.
The main body of the service processing request is a target user, and for the target user, a certain control can be triggered through an application program configured on the mobile terminal device, or the service processing request is realized through a system front-end entrance. For example, the service processing request may include: the inquiry request provides inquiry functions of 'account balance', 'account details', 'consumption points' and the like, and can inquire balance, transaction details and consumption points of multiple accounts and multiple currencies; transfer request, transfer request of "transfer under the name of oneself" and "transfer to others"; remittance request, remitting the current account fund into the current account of the foreign construction bank; the bank-certificate transfer request realizes fund transfer between a security deposit account and a bank account; the foreign exchange business requests, wherein foreign exchange buying and selling and inquiry transaction are carried out on the mobile terminal equipment at any time and any place, and the requests comprise 'market information inquiry', 'transaction inquiry', 'real-time transaction', 'consignment hang-up order', 'consignment withdraw order' and the like; a life payment request: can handle various payment services of bank agents: such as water payment fee, electric fee, gas fee, telephone fee, traffic violation fee, etc.
The target processing interface is a system interface determined according to the service processing request of the target user. In the application process of the distributed structure system, one system interface can process one type of service, and in order to process a certain service processing request quickly and efficiently, different systems can process a certain service processing request. According to the specific requirement of the service processing request, the number of interfaces for processing the request can be multiple, and one interface for executing the current service processing request is determined from the multiple functional interfaces and is used as a target processing interface.
Specifically, the user sends the service processing request through an application program configured on the mobile terminal device or through a system front-end portal, and at this time, the distributed architecture system server may receive the service processing request. The server system intercepts the received service processing request through an intercept processing program, for example, an Aspect Oriented Programming (AOP) current limiting plane may be used for interception. Meanwhile, the server may determine a target processing interface corresponding to the service request, and in the process of determining the target processing interface, in order to efficiently complete the service request, a certain interface that executes the current service processing request needs to be determined from the plurality of functional interfaces as the target processing interface, and the interface that processes the service request most quickly may be used as the target processing interface, and at this time, other functional interfaces may be occupied, so that the speed of processing the service request is slow.
For example, a user sends a service processing request as a "life payment request" through a front-end portal of the system, and at this time, the distributed structural system server may receive the service processing request of the "life payment request". And then, the server system intercepts the received life payment request through the AOP current-limiting plane. Meanwhile, the server can determine a plurality of target processing interfaces corresponding to the life payment request, and if 10 systems in the distributed structure system server can process the service request of the life payment request, the interface numbered 1 is determined from the 10 functional interfaces, and the current service processing request is executed, and the interface numbered 1 is the target processing interface.
And S120, when the target processing interface is configured with the current limiting annotation, determining a target current limiting parameter corresponding to the target processing interface from a pre-established current limiting rule table.
Wherein the current limit annotation is pre-determined according to some specific rules, e.g. for global current limiting of the current interface, an interface may be accessed 100 times in 1 minute. The current limiting rule table is a mapping relation table created in advance in the database. If the target processing interface is configured with annotations, the corresponding rules may be invoked according to the identifier of the invocation interface. The target current limit parameter is rule information preset in a current limit rule table, and may include a current limit threshold and a current limit expiration time. The current limiting threshold is the maximum customer access amount which can be contained by the target current limiting parameter; the current limit expiry time is a determined unit time, and the amount of customer access is limited in the determined unit time.
Specifically, for a target processing interface corresponding to an intercepted service processing request, if a preconfigured current limit annotation is detected, a corresponding rule may be invoked according to an identifier of the target processing interface, and a current limit threshold and a current limit expiration time corresponding to the target processing interface are determined from a current limit rule table created in advance.
Illustratively, if the service processing request sent by the user is a "life payment request", the server system intercepts the received life payment request, and determines the interface numbered 1 as the target processing interface. For the interface numbered 1, if a pre-configured current limit note is detected, a corresponding rule can be called according to the identification of the target processing interface, and a current limit threshold value and a current limit expiration time corresponding to the interface numbered 1 are determined from a pre-established current limit rule table. For example, if the current limit threshold corresponding to interface number 1 is 100 and the current limit expiration time is 1 minute, it indicates that the current limit threshold corresponding to interface number 1 can be accessed 100 times in 1 minute.
Optionally, if the target current limiting parameter corresponding to the target processing interface cannot be obtained from the pre-created current limiting rule table, the method further includes: if the target current limiting parameter corresponding to the target processing interface is not obtained from the pre-established current limiting rule table, the universal current limiting parameter is called to determine whether to request current limiting processing for the service processing based on the universal current limiting parameter.
The general current limiting parameter is a preset current limiting parameter which can meet the current limiting function of most interfaces, and is set as a default current limiting parameter in the actual application process.
In this embodiment, the preset current limiting rule table may not include the current limiting parameters of all the interfaces corresponding to each functional service, but in the development stage of the program, the current limiting parameters that can satisfy the current limiting functions of most of the interfaces are preset. If the target current limiting parameter corresponding to the target processing interface cannot be acquired in the current limiting rule table, preset current limiting parameters which can meet the current limiting function of most interfaces can be called at the moment, so that whether the current limiting processing is requested for the service processing or not is determined based on the general current limiting parameters.
Optionally, if the target processing interface is not configured with the current-limiting annotation, the method further includes: and if the target processing interface is not configured with the current-limiting annotation, sending the service processing request to the target processing interface, and feeding back response data corresponding to the service processing request based on the target processing interface.
In this embodiment, if it is detected that the target processing interface is not configured with the current limit annotation, indicating that the target processing interface is not configured with the current limit program, the service processing request of the user may be executed. At this time, the service processing request of the user is sent to the target processing interface, and then the target processing interface is called, and the target processing interface processes the service processing request of the user and feeds the service processing request back to the system front end of the user within a preset time.
And S130, acquiring data traffic corresponding to the interface function of the target processing interface, which is stored in the cache, based on the target script.
The target script is preset script information, can provide flexible extension and customization functions for the application program based on a programming language, and can be compiled and run on a common operating system and a common platform. For example, a target script may be created based on the Lua script. Lua is a small script language, can provide flexible extension and customized functions for application programs, has concise and elegant codes, and can be compiled and run on a common operating system and a common platform. The Lua script resembles the stored procedure of a database. The Remote Dictionary Server (Remote Dictionary Server, redis) can well support the Lua script, and the Lua script used in the Redis has the following advantages: in the first aspect, network overhead is reduced: multiple Redis requests can be sent once through the Lua script, multiple requests are not needed, and network transmission can be effectively reduced; in the second aspect, redis executes the whole Lua script as a command, so that the execution process of the Lua script is atomicity, and how to handle concurrence is not considered; third aspect, easy multiplexing: once executed, the Lua script is permanently stored in the Redis, and other clients can well reuse the script. In the actual application process, the Lua script can access the data traffic stored in the cache and corresponding to the interface function of the target processing interface.
Where data traffic is the sum of all functional interface traffic, where a functional interface is essentially an aggregate of multiple interfaces associated with a target processing interface, this data traffic information may be stored in a database of system configurations.
In the actual application process, the server needs to acquire the data traffic of all the functional interfaces corresponding to the target processing interface, so that the data traffic information corresponding to the interface function of the target processing interface in the database can be called based on the preset script information, and the traffic occupied by the functional interfaces in the cache data is determined.
For example, if the service processing request sent by the user is a "life payment request," it is assumed that 10 interfaces in the distributed architecture system server can all process the service request of the life payment request, and the interface numbered 1 determined from the 10 functional interfaces is a target processing interface. Further, the data traffic of 10 functional interfaces is acquired from a database in the system configuration based on the preset script information.
And S140, determining whether to request the flow limiting processing for the service processing based on the target flow limiting parameter and the data flow.
The current limiting process is to limit the speed of the request of the window in unit time, so that the system can normally provide service to the outside, and once the current limiting threshold is reached, the system can refuse service or queue for waiting.
In this embodiment, based on the target current limiting parameter and the data traffic, whether to request a current limiting process for the traffic process may be determined according to a specific rule. Optionally, the process of determining whether to request the flow limiting process for the service process may be: determining data traffic corresponding to the data traffic and the service processing request, and determining data traffic to be used; and determining whether to request flow limiting processing for the service processing or not based on the data flow to be used and the target flow limiting value.
The data traffic to be used is data traffic corresponding to the interface function of the target processing interface. The target flow limiting value is a flow limiting threshold value, that is, a preset maximum client access amount that can be accommodated by the functional interface, and the target flow limiting value of the flow limiting threshold value is a total flow limiting threshold value of all functional interfaces corresponding to the interface function of the target processing interface.
Specifically, the comparison may be performed according to a current limiting threshold in the target current limiting parameter and the obtained data traffic to be used, so as to determine whether to request current limiting processing for the service processing. If the data flow to be used is larger than the flow limiting threshold value within the appointed time, the data flow indicates that all the functional interfaces corresponding to the interface function of the target processing interface occupy the preset maximum customer access amount, the current service processing needs to be subjected to flow limiting processing, and the service can be refused or queue waiting can be carried out; if the data flow to be used is smaller than the current limiting threshold value within the appointed time, the current service processing does not need to carry out the current limiting processing, and the target processing interface processes the service processing request of the user and feeds the service processing request back to the system front end of the user within the preset time.
For example, if the service processing request sent by the user is a "life payment request," it is assumed that there are 10 interfaces that can process the service request of the life payment request. And data traffic to be used of 10 function interfaces is obtained from a database configured in the system based on preset script information and is 1050. Assuming that the current limiting threshold is 1000 in the specified time after reading the target current limiting parameter, because the data traffic 1050 to be used is greater than the current limiting threshold 1000, all functional interfaces corresponding to the interface function of the target processing interface have already occupied the predefined maximum customer access amount, and the current service processing needs to perform current limiting processing.
Optionally, the target current limiting parameter further includes a target current limiting duration corresponding to the target current limiting value, and the determining whether to request current limiting processing for the service processing based on the data traffic to be used and the target current limiting value includes: and if the data flow to be used in the target flow limiting duration is smaller than the target flow limiting value, processing the service processing request.
Wherein the target current limit duration is a determined unit of time, and the amount of customer access is defined within the determined units.
In this embodiment, if the data traffic to be used is smaller than the target traffic limit value, it indicates that all the functional interfaces corresponding to the interface function of the target processing interface do not occupy the predefined maximum client access amount, the current service processing does not need to perform the traffic limit processing, and the target processing interface processes the service processing request of the user and feeds the service processing request back to the system front end of the user within the preset time.
According to the technical scheme, when a service processing request is received, the service processing request is intercepted, a target processing interface corresponding to the service request is determined, and if the target processing interface is configured with a current limiting annotation, a target current limiting parameter corresponding to the target processing interface is determined from a current limiting rule table established in advance. And finally, determining whether to request current-limiting processing for the service processing based on the target current-limiting parameter and the data flow. The technical scheme provided by the invention solves the technical problem that the single machine current limiting can not control the whole access flow of the distributed system in the prior art, limits the whole access flow of the functional interface by combining the target script with the current limiting parameter, realizes the configurable current limiting parameter, supports the beneficial effects of modifying and validating the current limiting parameter in real time, realizes the whole current limiting effect of the distributed system, improves the current limiting efficiency of the distributed system and ensures the stability of the distributed system.
Example two
In the embodiment of the present invention, a specific implementation manner is used to introduce a current limiting method applied to a distributed system, and a flow chart of the current limiting method applied to the distributed system is shown in fig. 2, when a user accesses a functional interface of the distributed system through a front-end page, a target processing interface is determined, a service processing request of the user is intercepted by using a current limiting slice, then the distributed system determines whether the interface is configured with a current limiting annotation, if not, the interface is called to return data, and if configured, a target current limiting parameter corresponding to the target processing interface is read from a database. And then, judging a current limiting threshold value through the Redis script and the Lua script according to the parameters, in the process of executing the Lua script, if the data flow is greater than the current limiting threshold value, performing current limiting error reporting, and if the data flow is less than the current limiting threshold value, calling a background interface, and then returning response data.
The Redis is an open-source database, which is written by C language and can be stored on the basis of key-value pairs (key-value) which can be stored in a memory and can also be persisted. The value (value) supports a variety of storage types, including String (String), hash (Hash), list (List), set (sets), and ordered set (sorted sets), which can be used as database, cache, and message middleware. Lua is a small and exquisite script language, can provide flexible extension and customized functions for application programs, has concise and elegant codes, and can be compiled and run on a common operating system and a common platform.
The method specifically comprises the following steps:
(1) Request service interface: a user accesses a corresponding functional interface through a front-end entrance of the system and determines a target processing interface;
(2) Intercepting a current limiting section: after the user accesses the functional interface of the distributed system through the front-end page, the server system intercepts the received service processing request through an interception processing program, for example, the service processing request may be intercepted by using an AOP current-limiting plane, and the interception by using the AOP current-limiting plane may be understood as: for the service processing request, the service processing request is not processed, but whether the target processing interface corresponding to the service processing request is configured with the current limiting annotation is determined.
(3) Judging whether the target processing interface is configured with current limiting annotation: in the process of judging whether the target processing interface is configured with the current limit annotation, if the current limit annotation is not detected, a background interface is called, and response data are returned; if the configuration current limiting annotation is not detected, reading a current limiting threshold and current limiting expiration time of a calling interface from a current limiting rule table in a database, if an interface which is not provided with the current limiting threshold and the current limiting expiration time exists, taking a default current limiting threshold and the default current limiting expiration time in a configuration file, using a calling interface name as a current limiting key, and limiting current according to the current limiting threshold and the current limiting expiration time.
(4) Executing Lua script content: acquiring input current limiting keys, current limiting thresholds and current limiting expiration times, acquiring current limiting values from Redis through the current limiting keys, setting the values to be 0 if no corresponding current limiting keys exist, and setting the expiration times of the keys as the current limiting expiration times; then judging whether value +1 is greater than a current limiting threshold value or not, if the value +1 is greater than the current limiting threshold value, returning to 0, and indicating that the current is limited when the value +1 exceeds the current limiting threshold value; and if the value +1 does not meet the condition that the current limit value is larger than the current limit threshold value, setting the value of the current limit key to be value +1, and returning to the value +1.
(5) Judging a Lua script return result: comparing the return result based on the Lua script with 0, and if the return result of the Lua script is 0, carrying out current-limiting error-reporting prompt; and if the return result of the Lua script is greater than 0, calling a background interface, and further returning response data.
According to the technical scheme, the effect of integral current limiting of the distributed system can be achieved, the service scene that the system needs to carry out integral current limiting of the functional interface is met, the current limiting parameter can be configured without carrying out a large number of code transformation on the existing system, the beneficial effect that real-time modification is effective is supported, the effect of integral current limiting of the distributed system is achieved, the efficiency of current limiting of the distributed system is improved, and the stability of the distributed system is guaranteed.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a current limiting device applied to a distributed system according to a third embodiment of the present invention, where the device may perform a current limiting method applied to a distributed system according to the third embodiment of the present invention. The device includes: a processing interface determination module 310, a flow limiting parameter determination module 320, a data traffic acquisition module 330, and a data traffic acquisition module 330.
A processing interface determining module 310, which intercepts a service processing request and determines a target processing interface corresponding to the service request when receiving the service processing request;
a current limiting parameter determining module 320, configured to determine a target current limiting parameter corresponding to the target processing interface from a pre-created current limiting rule table when the target processing interface is configured with a current limiting annotation;
a data traffic obtaining module 330, which obtains data traffic corresponding to the interface function of the target processing interface stored in the cache based on the target script;
the current limiting process determining module 330 determines whether to request a current limiting process for the service process based on the target current limiting parameter and the data traffic.
On the basis of the above technical solutions, the current limiting device of the distributed system is further configured to invoke the general current limiting parameter if the target current limiting parameter corresponding to the target processing interface is not obtained from the pre-created current limiting rule table, so as to determine whether to request current limiting processing for service processing based on the general current limiting parameter.
On the basis of the above technical solutions, the current limiting device of the distributed system is further configured to send the service processing request to the target processing interface if the target processing interface is not configured with the current limiting annotation, and feed back response data corresponding to the service processing request based on the target processing interface.
On the basis of the above technical solutions, the current limiting processing determining module 330 includes: a data flow rate determining unit to be used and a flow limiting process determining unit.
The data traffic to be used determining unit is used for determining the data traffic and the data traffic corresponding to the service processing request, and determining the data traffic to be used;
and the flow limiting processing determining unit is used for determining whether to request flow limiting processing for the service processing based on the data flow to be used and the target flow limiting value.
On the basis of the foregoing technical solutions, the flow limiting processing determining module 330 is further configured to process the service processing request if the data traffic to be used in the target flow limiting duration is smaller than the target flow limiting value.
According to the technical scheme, when a service processing request is received, the service processing request is intercepted, a target processing interface corresponding to the service request is determined, if the target processing interface is configured with a current limiting annotation, a target current limiting parameter corresponding to the target processing interface is determined from a pre-established current limiting rule table, then data traffic corresponding to an interface function of the target processing interface and stored in a cache is obtained based on a target script, and finally whether current limiting processing is requested for the service processing is determined based on the target current limiting parameter and the data traffic. The technical scheme provided by the invention solves the technical problem that the single-machine current limiting can not control the overall access flow of the system, realizes the overall current limiting effect of the distributed system, improves the current limiting efficiency of the distributed system, and ensures the stability of the distributed system.
The data processing device provided by the embodiment of the disclosure can execute the video determination method provided by any embodiment of the disclosure, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the apparatus are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only used for distinguishing one functional unit from another, and are not used for limiting the protection scope of the embodiments of the present disclosure.
Example four
Fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the various methods and processes described above, such as a road surface identification method.
In some embodiments, the road surface identification method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the road surface identification method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the road surface identification method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the Internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome. It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired result of the technical solution of the present invention can be achieved. The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for limiting current for a distributed system, comprising:
when a service processing request is received, intercepting the service processing request and determining a target processing interface corresponding to the service request;
when the target processing interface is configured with a current limiting annotation, determining a target current limiting parameter corresponding to the target processing interface from a pre-established current limiting rule table;
acquiring data traffic corresponding to the interface function of the target processing interface, which is stored in the cache, based on a target script;
and determining whether to request current limiting processing for the service processing based on the target current limiting parameter and the data flow.
2. The method of claim 1, further comprising:
if the target current limiting parameter corresponding to the target processing interface is not obtained from a pre-established current limiting rule table, calling a general current limiting parameter to determine whether to request current limiting processing for the service processing based on the general current limiting parameter.
3. The method of claim 1, further comprising:
and if the current-limiting annotation is not configured on the target processing interface, sending the service processing request to the target processing interface, and feeding back response data corresponding to the service processing request based on the target processing interface.
4. The method of claim 1, wherein the target current limit parameter comprises a target current limit value, and wherein determining whether to request a current limit process for the traffic process based on the target current limit parameter and the data traffic comprises:
determining the data traffic and the data traffic corresponding to the service processing request, and determining the data traffic to be used;
and determining whether to request flow limiting processing for the service processing or not based on the data flow to be used and the target flow limiting value.
5. The method of claim 4, wherein the target current limit parameter further comprises a target current limit duration corresponding to the target current limit value, and the determining whether to request current limit processing for the traffic processing based on the data traffic to be used and the target current limit value comprises:
and if the data flow to be used in the target flow limiting duration is smaller than the target flow limiting value, processing the service processing request.
6. A current limiting device for a distributed system, comprising:
the processing interface determining module is used for intercepting a service processing request and determining a target processing interface corresponding to the service request when the service processing request is received;
the current limiting parameter determining module is used for determining a target current limiting parameter corresponding to the target processing interface from a pre-established current limiting rule table when the target processing interface is configured with a current limiting note;
a data flow obtaining module, configured to obtain, based on a target script, data flow stored in the cache and corresponding to an interface function of the target processing interface;
and the current limiting processing determining module is used for determining whether to request current limiting processing for the service processing based on the target current limiting parameter and the data flow.
7. The apparatus of claim 6, wherein the current limit process determination module comprises:
a data traffic determining unit, configured to determine the data traffic and the data traffic corresponding to the service processing request, and determine data traffic to be used;
and the flow limiting processing determining unit is used for determining whether flow limiting processing is requested to the service processing or not based on the data flow to be used and the target flow limiting value.
8. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of current limiting applied to a distributed system of any one of claims 1-5.
9. A computer-readable storage medium storing computer instructions for causing a processor to implement the method for limiting current applied to a distributed system of any one of claims 1 to 5 when executed.
10. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, implements a method of current limiting for application in a distributed system according to any one of claims 1-5.
CN202211190107.8A 2022-09-28 2022-09-28 Current limiting method, device, equipment, medium and product of distributed system Pending CN115421922A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211190107.8A CN115421922A (en) 2022-09-28 2022-09-28 Current limiting method, device, equipment, medium and product of distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211190107.8A CN115421922A (en) 2022-09-28 2022-09-28 Current limiting method, device, equipment, medium and product of distributed system

Publications (1)

Publication Number Publication Date
CN115421922A true CN115421922A (en) 2022-12-02

Family

ID=84206056

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211190107.8A Pending CN115421922A (en) 2022-09-28 2022-09-28 Current limiting method, device, equipment, medium and product of distributed system

Country Status (1)

Country Link
CN (1) CN115421922A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116719582A (en) * 2023-08-07 2023-09-08 北京市大数据中心 Front-end current limiting method of high concurrency system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116719582A (en) * 2023-08-07 2023-09-08 北京市大数据中心 Front-end current limiting method of high concurrency system
CN116719582B (en) * 2023-08-07 2023-11-03 北京市大数据中心 Front-end current limiting method of high concurrency system

Similar Documents

Publication Publication Date Title
JP2012533824A (en) Systems and methods for real-time batch account processing
CN111786895A (en) Method and apparatus for dynamic global current limiting
WO2008037662A2 (en) Generic sequencing service for business integration
CN110706093A (en) Accounting processing method and device
CN111881329A (en) Account balance management method and system
CN115421922A (en) Current limiting method, device, equipment, medium and product of distributed system
CN112948081B (en) Method, device, equipment and storage medium for processing tasks in delayed mode
CN112884181A (en) Quota information processing method and device
CN112615795A (en) Flow control method and device, electronic equipment, storage medium and product
CN114327802B (en) Method, apparatus, device and medium for block chain access to data outside chain
CN115456634A (en) Data processing method and device, electronic equipment and storage medium
CN114090247A (en) Method, device, equipment and storage medium for processing data
CN113726885A (en) Method and device for adjusting flow quota
CN104881491A (en) Software development system based on big data platform
CN110888939A (en) Data management method and device
CN114896322A (en) JSON (Java Server object notation) -based configuration data conversion method, device, equipment and medium
CN114461963A (en) Interface access method and device, electronic equipment and storage medium
EP2891987A1 (en) Request processing system, request processing method, program, and information storage medium
CN115202791A (en) Method and device for determining first screen loading resource, server and storage medium
CN112989250A (en) Web service response method and device and electronic equipment
CN112561321A (en) Capital saving assessment method and system
CN115277765A (en) Cloud platform access method and device, electronic equipment and storage medium
CN116187987A (en) Digital currency transaction method and device
CN115442432A (en) Control method, device, equipment and storage medium
CN115222526A (en) Method and terminal for managing transaction times of digital currency and currency management device

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