Window-based current limiting processing method, device, storage medium and electronic device

By acquiring and switching different window current limiting methods, the problem that existing current limiting processing methods cannot be automatically switched is solved, flexible current limiting processing is realized, and the needs of different application scenarios are met, and the server's response speed and current limiting accuracy are improved.

CN114428926BActive Publication Date: 2025-06-06BEIJING JINTI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111652037.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2025-06-06
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

The existing window-based current limiting processing method cannot be switched automatically and flexibly, and cannot take into account performance and accuracy, resulting in the server being downtime during peak hours.

Method used

A window-based current limiting processing method is provided to obtain at least two pre-set window current limiting methods. Each current limiting method corresponds to a statistical time interval and a request amount limiting, and switches the current limiting method according to the current conditions to realize automatic and flexible current limiting processing.

Benefits of technology

It realizes automatic and flexible switching of the current limiting method in different application scenarios, meets different needs, reduces server idle time, and ensures fast response and refined current limiting processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114428926B_ABST
    Figure CN114428926B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a window-based current limiting processing method and device, as well as a storage medium and an electronic device. The method includes: obtaining at least two pre-set window current limiting modes, each window current limiting mode corresponds to at least a statistical time interval, a request amount limited within a statistical time interval, and a current limiting operation performed when the request amount exceeds the limit within the statistical time interval; applying one of the window current limiting modes to the received request; and when the current condition meets the switching condition for switching the window current limiting mode, performing the window current limiting mode switching operation to apply another window current limiting mode to the received request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a window-based current limiting processing method, device, storage medium, electronic device and computer program product. Background Art

[0002] Take the risk query website for companies as an example. The server of this website does not have a high request volume at ordinary times. Assuming the request volume per second is 100, the maximum peak volume that the server can withstand is 500 requests per second. The requests at ordinary times only account for 20% of the maximum peak volume, which can fully meet the daily needs. But if a company goes bankrupt one day, it will cause a large number of users to flock to the risk query website in the same time period to query the company's risks. The request volume per second will exceed the extreme peak volume of 500, which may cause the server to crash.

[0003] To avoid this, such website servers often limit the maximum number of requests, and delay or discard requests that exceed the limit. However, such limiting methods are not flexible enough and cannot balance performance and accuracy. Summary of the invention

[0004] Based on this, it is necessary to provide a window-based current limiting processing method, device, storage medium, electronic device and computer program product to address the problem that different existing window-based current limiting processing methods cannot be switched automatically and flexibly.

[0005] In a first aspect, an embodiment of the present application provides a window-based current limiting processing method, the method comprising:

[0006] Obtain at least two preset window current limiting modes, each of which corresponds to at least a statistical time interval, a request amount limited within a statistical time interval, and a current limiting operation performed when the request amount exceeds the limit within the statistical time interval;

[0007] Applying one of the window current limiting methods to the received request;

[0008] When the current condition satisfies the switching condition for switching the window current limiting mode, the window current limiting mode switching operation is performed to apply another window current limiting mode to the received request.

[0009] In a second aspect, an embodiment of the present application provides a window-based current limiting processing device, the device comprising:

[0010] An acquisition module is used to acquire at least two preset window current limiting modes, each of which corresponds to at least a statistical time interval, a request amount limited within a statistical time interval, and a current limiting operation performed when the request amount exceeds the limit within the statistical time interval;

[0011] An application module, used for applying one of the window current limiting modes obtained by the obtaining module to the received request;

[0012] The switching module is used to perform a window current limiting mode switching operation when a current condition satisfies a switching condition for switching the window current limiting mode, so as to apply another window current limiting mode to the received request.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising:

[0014] processor;

[0015] a memory for storing instructions executable by the processor;

[0016] The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the above method steps.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to execute the above-mentioned method steps.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the above-mentioned method steps when executed by a processor.

[0019] In an embodiment of the present application, at least two pre-set window current limiting modes are obtained, each window current limiting mode corresponds to at least a statistical time interval, a request amount limited within a statistical time interval, and a current limiting operation corresponding to the request amount exceeding the limit within the statistical time interval; one of the window current limiting modes is applied to the received request; and when the current condition meets the switching condition for switching the window current limiting mode, the window current limiting mode switching operation is performed to apply another window current limiting mode to the received request. The current limiting processing method provided in the embodiment of the present application performs a window current limiting mode switching operation to apply another window current limiting mode to the received request when the current condition meets the switching condition for switching the window current limiting mode, and can automatically and flexibly switch between different window current limiting modes; in this way, the current limiting requirements in different application scenarios can be met, not only a quick response can be achieved, but also refined current limiting processing can be achieved, and the time the server is in an idle state can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] By referring to the following drawings, the exemplary embodiments of the present invention can be more completely understood. The drawings are used to provide a further understanding of the embodiments of the present application, and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present invention and do not constitute a limitation of the present invention. In the drawings, the same reference numerals generally represent the same parts or steps.

[0021] Figure 1 A flowchart of a window-based current limiting processing method provided according to an exemplary embodiment of the present application;

[0022] Figure 2 A schematic diagram of a current limiting processing method based on a rolling time window in a specific application scenario provided according to an exemplary embodiment of the present application;

[0023] Figure 3 A schematic diagram of a current limiting processing method based on a sliding time window in a specific application scenario provided according to an exemplary embodiment of the present application;

[0024] Figure 4 It is a structural schematic diagram of a window-based current limiting processing device 400 provided according to an exemplary embodiment of the present application;

[0025] Figure 5 A schematic diagram of an electronic device provided by an exemplary embodiment of the present application is shown;

[0026] Figure 6 A schematic diagram of a computer-readable medium provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0027] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0028] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.

[0029] In addition, the terms "first" and "second" etc. are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0030] In actual application scenarios, within a certain period of time, when a large number of data requests are received that exceed the processing range that the server can bear, in order to avoid possible downtime, the interface from the front end to the back end is limited. This not only ensures that the server does not crash, but also ensures the availability of the server.

[0031] The embodiments of the present application provide a window-based current limiting processing method and device, an electronic device, and a computer-readable medium, which are described below in conjunction with the accompanying drawings.

[0032] Please refer to Figure 1 , which shows a flow chart of a window-based current limiting processing method provided by some embodiments of the present application. As shown in the figure, the window-based current limiting processing method may include the following steps:

[0033] Step S101: Obtain at least two pre-set window current limiting modes, each window current limiting mode corresponds to at least a statistical time interval, a request amount limited within a statistical time interval, and a current limiting operation performed when the request amount exceeds the limit within the statistical time interval.

[0034] In an embodiment of the present application, at least two pre-set window current limiting modes include a first window current limiting mode that performs current limiting based on a rolling time window, and the statistical time interval corresponding to the first window current limiting mode is the first time interval.

[0035] Specifically, if the current window current limiting mode is the first window current limiting mode based on the rolling time window, the corresponding first time interval may be 10 seconds, and the corresponding request amount limited in the first time interval is 3000.

[0036] like Figure 2 As shown, it is a schematic diagram of a current limiting processing method based on a rolling time window in a specific application scenario provided according to an exemplary embodiment of the present application.

[0037] like Figure 2 As shown in the figure, the current limiting processing method based on the rolling time window is described as follows:

[0038] Through Figure 2The circle shown in the figure rolls on the time axis shown by the arrow. The rolling method is: only forward rolling is allowed, backward rolling is not allowed, and forward rolling can only be done once in each time period. Figure 2 The circle shown in the figure rotates once every 10 seconds. In response to each new request received, the current request count is increased by one. When the number of requests within 10 seconds is greater than 3000, the current limiting operation is started and the user requests subject to current limiting are forwarded to the corresponding static page. Figure 2 The circle shown ends the original scrolling and begins the next 10 seconds of scrolling.

[0039] In this example, each 10 seconds of scrolling corresponds to a statistical time interval of the window current limiting method. The number of requests limited to 3000 within 10 seconds corresponds to the number of requests limited by the window current limiting method in a statistical time interval. The operation of forwarding the limited user requests to the corresponding static page corresponds to the first current limiting operation performed when the request volume exceeds the limit.

[0040] In a possible implementation, if the current window current limiting mode is the first window current limiting mode based on the rolling time window, in order to achieve accurate statistics of the request volume, the current limiting processing method provided in the embodiment of the present application further includes the following steps:

[0041] When it is determined that the window current limiting mode is the first window current limiting mode, in response to the first statistical request, the request amount of the received requests is counted in real time, and the request amount is re-counted every first time interval.

[0042] In actual application scenarios, if the current window limiting mode is the first window limiting mode based on the rolling time window, when the rolling time is 10 seconds to 20 seconds, the request volume counted in 0-10 seconds will be cleared and the statistics will be restarted; this not only saves storage space, but also ensures the accuracy of the statistical request volume data.

[0043] In an embodiment of the present application, the at least two pre-set window current limiting methods also include a second window current limiting method based on a sliding time window, wherein the statistical time interval corresponding to the second window current limiting method is the second time interval, and the first time interval is greater than the second time interval.

[0044] Specifically, if the current window current limiting mode is the second window current limiting mode based on the sliding time window, the corresponding second time interval may be 1 second, and the request amount limited in the corresponding second time interval is 400.

[0045] like Figure 3As shown, it is a schematic diagram of a current limiting processing method based on a sliding time window in a specific application scenario provided according to an exemplary embodiment of the present application.

[0046] like Figure 3 As shown in the figure, the current limiting processing method based on the sliding time window is described as follows:

[0047] The maximum number of requests per second corresponding to the current limiting processing method based on the sliding time window is 400.

[0048] like Figure 3 In the current limiting processing method shown, the sliding window time can be set, for example, the sliding window time is set to 10 seconds; the minimum sliding time can also be set, for example, the minimum sliding time is 1 second.

[0049] Through Figure 3 When the sliding time window shown is used for current limiting, the first sliding time is 10 seconds, and the requests within 10 seconds are counted. When the counted requests are greater than 3000, the current limiting operation is performed, and the user requests whose current is limited are forwarded to the corresponding static page.

[0050] Assume that 400 requests are counted within 0-1 seconds. When sliding forward 1 second for the second time, 400 new requests can continue to be received between 10th and 11th seconds, and so on.

[0051] In this example, each forward slide of 1 second corresponds to a statistical time interval of the window current limiting method, and the number of requests limited to 400 within each forward slide of 1 second corresponds to the number of requests limited by the window current limiting method in a statistical time interval. The operation of forwarding the limited user requests to the corresponding static pages corresponds to the second current limiting operation performed when the request volume exceeds the limit.

[0052] In a possible implementation, if the current window current limiting mode is a second window current limiting mode based on a sliding time window, in order to achieve accurate statistics of the request volume, the current limiting processing method provided in the embodiment of the present application further includes the following steps:

[0053] When it is determined that the window limiting mode is the second window limiting mode, in response to the second statistical request, the request volume of the received requests is counted in real time, and the request volume is re-counted every second time interval; in this way, not only storage space can be saved, but also the accuracy of the statistical request volume data can be guaranteed.

[0054] Step S102: Apply one of the window current limiting modes to the received request.

[0055] In an embodiment of the present application, one of the window current limiting methods applied to the received request includes the first window current limiting method based on the rolling time window and the second window current limiting method based on the sliding time window. For a detailed description of the above two window current limiting methods, please refer to the description of the same or similar parts above, which will not be repeated here.

[0056] Step S103: When the current condition satisfies the switching condition for switching the window current limiting mode, a window current limiting mode switching operation is performed to apply another window current limiting mode to the received request.

[0057] In a possible implementation, when the current condition satisfies the switching condition for switching the window current limiting mode, performing the window current limiting mode switching operation includes the following steps:

[0058] Acquire a switching condition, where the switching condition includes a first switching condition for switching a current current limiting processing mode from a first window current limiting mode to a second window current limiting mode;

[0059] When the current window current limiting mode is the first window current limiting mode, determining whether the current condition satisfies the first switching condition;

[0060] In response to determining that the current conditions satisfy the first switching condition, the first window current limiting mode switching operation is executed to switch the currently applied window current limiting mode from the first window current limiting mode to the second window current limiting mode; in this way, when the current conditions satisfy the first switching condition, the currently applied window current limiting mode is automatically and intelligently switched from the first window current limiting mode to the second window current limiting mode.

[0061] In an embodiment of the present application, the first switching condition includes: the number of times the first current limiting operation is continuously performed under the current condition is greater than or equal to a third preset value.

[0062] In actual application scenarios, there is no specific limitation on the third preset value. The third preset value can be set to 2 times, 3 times, or 4 times.

[0063] In a possible implementation, before obtaining the switching condition, the current limiting method provided in the embodiment of the present application further includes the following steps:

[0064] configuring a first switching condition;

[0065] The first switching condition includes:

[0066] The number of times the first current limiting operation is continuously performed under the current condition is greater than or equal to a third preset value.

[0067] In actual application scenarios, there is no specific limitation on the third preset value. The third preset value can be set to 2 times, 3 times, or 4 times.

[0068] In a specific application scenario, when the first current limiting operation is performed twice in succession, if the first switching condition is met, the first window current limiting mode (current limiting mode based on a rolling window) is switched to the second window current limiting mode (current limiting mode based on a sliding window).

[0069] In a possible implementation, when the current condition satisfies the switching condition for switching the window current limiting mode, performing the window current limiting mode switching operation includes the following steps:

[0070] Acquire a switching condition, where the switching condition includes a second switching condition for switching the current current limiting processing mode from the second window current limiting mode to the first window current limiting mode;

[0071] When the current window current limiting mode is the second window current limiting mode, determining whether the current condition satisfies the second switching condition;

[0072] In response to determining that the current condition meets the second switching condition, the second window current limiting mode switching operation is performed; in this way, when the current condition meets the second switching condition, the currently applied window current limiting mode is automatically and intelligently switched from the second window current limiting mode to the first window current limiting mode.

[0073] In the embodiment of the present application, the second preset condition includes: the number of times the second current limiting operation is continuously performed under the current condition is less than or equal to a fourth preset value.

[0074] In actual application scenarios, there is no specific limitation on the fourth preset value. The fourth preset value can be set to 2 times, 3 times, or 4 times.

[0075] In a possible implementation, before obtaining the switching condition, the current limiting method provided in the embodiment of the present application further includes the following steps:

[0076] configuring a second switching condition;

[0077] The second switching condition includes:

[0078] The number of times the second current limiting operation is continuously performed under the current condition is less than or equal to a fourth preset value.

[0079] In actual application scenarios, there is no specific limitation on the third preset value. The third preset value can be set to 2 times, 3 times, or 4 times.

[0080] In a specific application scenario, when the second current limiting operation is not performed for three consecutive times and the second switching condition is met, the second window current limiting mode (current limiting mode based on sliding window) is switched to the first window current limiting mode (current limiting mode based on rolling window).

[0081] The first window current limiting method mentioned above corresponds to the rolling time window, and the second window current limiting method corresponds to the sliding time window method. For example, the current limiting process can be performed by converting the sliding time window to the rolling time window.

[0082] In the early stage, rolling time windows are used for flow control, and rolling time windows have higher performance. However, rolling time windows have disadvantages. For example, if the flow is limited to 1000 within 10 seconds, if the user request reaches 1000 within 1 second, then the server is in flow control for the remaining 9 seconds, and no request is missed, and the server is idle. Therefore, when the rolling time window meets the switching conditions (for example, 2 times in a row, the user request reached 1000 in the last 10 seconds, and the user request also reached 1000 in this 10 seconds). Switch to the sliding time window for more refined management.

[0083] The sliding time window can be set to a sliding time of 1 second, for example. Each time it slides forward by 1 second, the flow is limited to 400. If the number of requests during the 0th to 1st second exceeds 400, the number will be counted again from 0 to the 1st to 2nd second, and the flow will continue to be limited to 400, which can minimize the idle time of the server. If the number of requests does not exceed 400 for two consecutive times, the sliding time window will be switched back to the rolling time window.

[0084] The advantage of the rolling time window is that it has higher performance and faster request processing. Therefore, in daily situations where the above conditions are not met (current limiting operations are performed more than 2 times in a row), rolling time windows are used for current limiting. The advantage of the sliding time window is more refined management. During periods of large request volumes, you can switch to the sliding time window for more refined current limiting management, and switch back to the rolling time window after the request volume has leveled off. In this way, both performance and accuracy in the current limiting process can be taken into account.

[0085] In the above-mentioned embodiment, a window-based current limiting processing method is provided, and correspondingly, the present application also provides a window-based current limiting processing device. The window-based current limiting processing device provided in the embodiment of the present application can implement the above-mentioned window-based current limiting processing method, and the window-based current limiting processing device can be implemented by software, hardware, or a combination of software and hardware. For example, the window-based current limiting processing device can include integrated or separate functional modules or units to perform the corresponding steps in the above-mentioned methods.

[0086] Please refer to Figure 4, which shows a schematic diagram of a window-based current limiting processing device provided by some embodiments of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.

[0087] like Figure 4 As shown, the window-based current limiting processing device 400 may include:

[0088] The acquisition module 401 is used to acquire at least two preset window current limiting modes, each of which corresponds to at least a statistical time interval, a request amount limited within a statistical time interval, and a current limiting operation performed when the request amount exceeds the limit within the statistical time interval;

[0089] An application module 402 is used to apply one of the window current limiting modes obtained by the acquisition module 401 to the received request;

[0090] The switching module 403 is used to perform a window current limiting mode switching operation when the current condition meets the switching condition for switching the window current limiting mode, so as to apply another window current limiting mode to the received request.

[0091] In some implementations of the embodiments of the present application, the pre-set at least two window current limiting methods include a first window current limiting method based on a rolling time window, and the statistical time interval corresponding to the first window current limiting method is the first time interval.

[0092] In some implementations of the embodiments of the present application, the device 400 may further include:

[0093] The first statistics module (in Figure 4 ), for, when it is determined that the window current limiting mode is the first window current limiting mode, responding to the first statistical request, counting the request amount of the received requests in real time, and re-counting the request amount at each first time interval.

[0094] In some implementations of the embodiments of the present application, the pre-set at least two window current limiting methods also include a second window current limiting method based on a sliding time window, wherein the statistical time interval corresponding to the second window current limiting method is the second time interval, and the first time interval is greater than the second time interval.

[0095] In some implementations of the embodiments of the present application, the device 400 may further include:

[0096] The second statistics module (in Figure 4), is used to, when it is determined that the window current limiting mode is the second window current limiting mode, respond to the second statistical request, count the request amount of the received requests in real time, and re-count the request amount every second time interval.

[0097] In some implementations of the embodiments of the present application, the switching module 403 is specifically used to:

[0098] Acquire a switching condition, where the switching condition includes a first switching condition for switching a current current limiting processing mode from a first window current limiting mode to a second window current limiting mode;

[0099] When the current window current limiting mode is the first window current limiting mode, determining whether the current condition satisfies the first switching condition;

[0100] In response to determining that the current condition satisfies the first switching condition, a first window current limiting mode switching operation is performed to switch the currently applied window current limiting mode from the first window current limiting mode to the second window current limiting mode.

[0101] In some implementations of the embodiments of the present application, the device 400 may further include:

[0102] The first configuration module (in Figure 4 ), which is used to configure the first switching condition before obtaining the switching condition; wherein the first switching condition configured by the first configuration module includes: the number of times the first current limiting operation is continuously performed under the current condition is greater than or equal to a third preset value.

[0103] In some implementations of the embodiments of the present application, the switching module 403 is specifically used to:

[0104] Acquire a switching condition, where the switching condition includes a second switching condition for switching the current current limiting processing mode from the second window current limiting mode to the first window current limiting mode;

[0105] When the current window current limiting mode is the second window current limiting mode, determining whether the current condition satisfies the second switching condition;

[0106] In response to determining that the current condition satisfies the second switching condition, a second window current limiting mode switching operation is performed to switch the currently applied window current limiting mode from the second window current limiting mode to the first window current limiting mode.

[0107] In some implementations of the embodiments of the present application, the device 400 may further include:

[0108] The second configuration module (in Figure 4), which is used to configure the second switching condition before obtaining the switching condition; the second switching condition configured by the second configuration module includes: the number of times the second current limiting operation is continuously performed under the current condition is less than or equal to the fourth preset value.

[0109] In some implementations of the embodiments of the present application, the window-based current limiting processing device 400 provided in the embodiments of the present application is based on the same inventive concept as the window-based current limiting processing method provided in the aforementioned embodiments of the present application and has the same beneficial effects.

[0110] An embodiment of the present application also provides an electronic device corresponding to the window-based current limiting processing method provided in the aforementioned embodiment. The electronic device may be an electronic device used for a server, such as a server, including an independent server and a distributed server cluster, etc., to execute the above-mentioned window-based current limiting processing method; the electronic device may also be an electronic device used for a client, such as a mobile phone, a laptop computer, a tablet computer, a desktop computer, etc., to execute the above-mentioned window-based current limiting processing method.

[0111] Please refer to Figure 5 , which shows a schematic diagram of an electronic device provided by some embodiments of the present application. Figure 5 As shown, the electronic device 40 includes: a processor 400, a memory 401, a bus 402 and a communication interface 403, and the processor 400, the communication interface 403 and the memory 401 are connected via the bus 402; the memory 401 stores a computer program that can be run on the processor 400, and the processor 400 executes the aforementioned window-based current limiting processing method of the present application when running the computer program.

[0112] The memory 401 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0113] The bus 402 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 401 is used to store a program, and the processor 400 executes the program after receiving an execution instruction. The window-based current limiting processing method disclosed in any implementation of the embodiment of the present application may be applied to the processor 400, or implemented by the processor 400.

[0114] The processor 400 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 400. The above processor 400 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 401, and the processor 400 reads the information in the memory 401 and completes the steps of the above method in combination with its hardware.

[0115] The electronic device provided in the embodiment of the present application and the window-based current limiting processing method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.

[0116] The present application also provides a computer-readable medium corresponding to the window-based current limiting processing method provided in the above embodiment. Figure 6 The computer-readable storage medium shown is a CD 50 on which a computer program (ie, a program product) is stored. When the computer program is executed by a processor, the aforementioned window-based current limiting processing method is executed.

[0117] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0118] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the window-based current limiting processing method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0119] It should be noted that the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0120] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0121] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0122] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0123] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0124] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application.

Claims

1. A window-based current limiting processing method, include: Obtain at least two preset window current limiting modes, each of which corresponds to at least a statistical time interval, a request amount limited within a statistical time interval, and a current limiting operation performed when the request amount exceeds the limit within the statistical time interval; Applying one of the window current limiting methods to the received request; When the current condition satisfies the switching condition for switching the window current limiting mode, performing the window current limiting mode switching operation to apply another window current limiting mode to the received request; Among them, the at least two pre-set window current limiting modes include a first window current limiting mode based on a rolling time window for current limiting, the statistical time interval corresponding to the first window current limiting mode is a first time interval, and the current limiting operation corresponding to the first window current limiting mode is a first current limiting operation; Among them, the pre-set at least two window current limiting modes also include a second window current limiting mode based on a sliding time window for current limiting, wherein the statistical time interval corresponding to the second window current limiting mode is a second time interval, the first time interval is greater than the second time interval, and the current limiting operation corresponding to the second window current limiting mode is a second current limiting operation; Wherein, when the current condition satisfies the switching condition for switching the window current limiting mode, performing the window current limiting mode switching operation includes: Acquire the switching condition, where the switching condition includes a first switching condition for switching a current current limiting processing mode from the first window current limiting mode to the second window current limiting mode; When the current window current limiting mode is the first window current limiting mode, determining whether the current condition meets the first switching condition; In response to determining that the current condition satisfies the first switching condition, performing a first window current limiting mode switching operation to switch the currently applied window current limiting mode from the first window current limiting mode to the second window current limiting mode; Before obtaining the switching condition, the method further includes: configuring the first switching condition; The first switching condition includes: The number of times the first current limiting operation is continuously performed under the current condition is greater than or equal to a third preset value.

2. The method according to claim 1, It is characterized in that The method further comprises: When it is determined that the window current limiting mode is the first window current limiting mode, in response to the first statistical request, the request amount of the received requests is counted in real time, and the request amount is re-counted every first time interval.

3. The method according to claim 1, It is characterized in that The method further comprises: When it is determined that the window current limiting mode is the second window current limiting mode, in response to the second statistical request, the request amount of the received requests is counted in real time, and the request amount is re-counted every second time interval.

4. The method according to claim 1 or 3, It is characterized in that When the current condition satisfies the switching condition for switching the window current limiting mode, performing the window current limiting mode switching operation includes: Acquire the switching condition, where the switching condition includes a second switching condition for switching the current current limiting processing mode from the second window current limiting mode to the first window current limiting mode; When the current window current limiting mode is the second window current limiting mode, determining whether the current condition meets the second switching condition; In response to determining that the current condition satisfies the second switching condition, a second window current limiting mode switching operation is performed to switch the currently applied window current limiting mode from the second window current limiting mode to the first window current limiting mode.

5. The method according to claim 4, It is characterized in that Before obtaining the switching condition, the method further includes: configuring the second switching condition; The second switching condition includes: The number of times the second current limiting operation is continuously performed under the current condition is less than or equal to a fourth preset value.

6. A window-based current limiting processing device, include: An acquisition module is used to acquire at least two preset window current limiting modes, each of which corresponds to at least a statistical time interval, a request amount limited within a statistical time interval, and a current limiting operation performed when the request amount exceeds the limit within the statistical time interval; An application module, used for applying one of the window current limiting modes obtained by the obtaining module to the received request; A switching module, configured to perform a window current limiting mode switching operation when a current condition satisfies a switching condition for switching the window current limiting mode, so as to apply another window current limiting mode to the received request; Among them, the at least two pre-set window current limiting modes include a first window current limiting mode based on a rolling time window for current limiting, the statistical time interval corresponding to the first window current limiting mode is a first time interval, and the current limiting operation corresponding to the first window current limiting mode is a first current limiting operation; Among them, the pre-set at least two window current limiting modes also include a second window current limiting mode based on a sliding time window for current limiting, wherein the statistical time interval corresponding to the second window current limiting mode is a second time interval, the first time interval is greater than the second time interval, and the current limiting operation corresponding to the second window current limiting mode is a second current limiting operation; Wherein, the switching module is also used for: Acquire the switching condition, where the switching condition includes a first switching condition for switching a current current limiting processing mode from the first window current limiting mode to the second window current limiting mode; When the current window current limiting mode is the first window current limiting mode, determining whether the current condition meets the first switching condition; In response to determining that the current condition satisfies the first switching condition, performing a first window current limiting mode switching operation to switch the currently applied window current limiting mode from the first window current limiting mode to the second window current limiting mode; Before obtaining the switching condition, the method further includes: configuring the first switching condition; The first switching condition includes: The number of times the first current limiting operation is continuously performed under the current condition is greater than or equal to a third preset value.

7. An electronic device, It is characterized in that The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is used to execute the method according to any one of claims 1 to 5.

9. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Service request processing method and device, equipment and storage medium

    CN113037862A