Dynamic current limiting method, device and electronic equipment

By dynamically adjusting the current limiting strategy of request messages in the microservice architecture and adjusting the number of request messages that are not forwarded according to the forwarding success rate, the problem of insufficient flexibility and adaptability of request messages in the microservice architecture is solved, and a more efficient current limiting strategy is achieved.

CN112527524BActive Publication Date: 2025-05-23BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011447522.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-09
Publication Date
2025-05-23
Estimated Expiration
2040-12-09

AI Technical Summary

Technical Problem

In the microservice architecture, how to effectively handle the flow restriction problem of request messages, especially when the current limit mechanism is triggered, how to dynamically adjust the number of request messages that are not forwarded to improve the flexibility and adaptability of the current limiting strategy.

Method used

When the current limiting mechanism is triggered, the target request message in the request message set is forwarded, and the second number of request messages is dynamically adjusted according to the forwarding success rate of the request message forwarding service, dynamic current limiting is achieved.

Benefits of technology

This method can dynamically adjust the number of request messages that are not forwarded, improve the flexibility and adaptability of the current limiting strategy, avoid the downstream being continuously overloaded, and have the ability to heal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112527524B_ABST
    Figure CN112527524B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a dynamic current limiting method, device and electronic device, and relates to the field of data processing technology, and can be used in cloud computing and cloud fields. The specific implementation scheme is: when the current limiting mechanism is triggered, the first target request message in the first request message set received by the request message forwarding service is forwarded, and the first target request message is: the request message remaining after the first number of request messages are removed from the first request message set; if the request message forwarding service meets the preset conditions, the second target request message in the second request message set received by the request message forwarding service is forwarded, and the second target request message is: the request message remaining after the second number of request messages are removed from the second request message set, and the second number is greater than the first number. The above method can dynamically adjust the number of request messages that are not forwarded (i.e., discarded), and improve the flexibility and adaptability of setting the value of request message discard.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of microservices in computer technology, and in particular to a dynamic current limiting method, device, and electronic device. Background Art

[0002] With the rise of microservices, a monolithic service is split into multiple microservices, and the communication between microservices is based on basic middleware, such as service mesh, which can ensure high reliability. The basic middleware can forward upstream requests to downstream. Summary of the invention

[0003] The present disclosure provides a dynamic current limiting method, device and electronic device.

[0004] According to a first aspect of the present disclosure, a dynamic current limiting method is provided, comprising:

[0005] When the current limiting mechanism is triggered, forwarding a first target request message in a first request message set received by the request message forwarding service, wherein the first target request message is: the remaining request message after removing the first number of request messages from the first request message set;

[0006] If the request message forwarding service meets the preset conditions, the second target request message in the second request message set received by the request message forwarding service will be forwarded, and the second target request message is: the request messages remaining after the second request message set is removed from the second number of request messages, and the second number is greater than the first number.

[0007] According to a second aspect of the present disclosure, a dynamic current limiting device is provided, comprising:

[0008] A first forwarding module, configured to forward a first target request message in a first request message set received by a request message forwarding service when a current limiting mechanism is triggered;

[0009] A second forwarding module is used to forward a second target request message in a second request message set received by the request message forwarding service if the request message forwarding service meets a preset condition, and the second number is greater than the first number.

[0010] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0011] at least one processor; and

[0012] a memory communicatively connected to the at least one processor; wherein,

[0013] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.

[0014] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the first aspect.

[0015] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method according to the first aspect.

[0016] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0018] Figure 1 is a flow chart of a dynamic current limiting method provided by an embodiment of the present disclosure;

[0019] Figure 2 is another flow chart of the dynamic current limiting method provided by an embodiment of the present disclosure;

[0020] Figure 3 is a structural diagram of a dynamic current limiting device provided in an embodiment of the present disclosure;

[0021] Figure 4 It is a block diagram of an electronic device used to implement the dynamic current limiting method of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0022] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0023] See also Figure 1 , Figure 1 is a flow chart of a dynamic current limiting method provided by an embodiment of the present disclosure, such as Figure 1 As shown, this embodiment provides a dynamic current limiting method, which is applied to electronic equipment and includes the following steps:

[0024] Step 101: When a current limiting mechanism is triggered, forwarding a first target request message in a first request message set received by a request message forwarding service, wherein the first target request message is: the request messages remaining after removing a first number of request messages from the first request message set.

[0025] The electronic device may be a server or a middleware, and the server or the middleware is used to forward the received request message, for example, forwarding the message sent by the first device to the second device. The current limiting mechanism may also be referred to as a fuse mechanism. When the current limiting mechanism is triggered, the electronic device turns on the current limiting strategy, that is, starts to execute the dynamic current limiting method provided by the present disclosure. The condition for triggering the current limiting mechanism may be based on the forwarding success rate of the electronic device forwarding the request message, or whether the forwarding failure rate is greater than the fuse threshold, or other conditions may be adopted, which may be set according to the actual situation, and the present disclosure does not limit it.

[0026] The first request message set is a set of request messages currently received and not forwarded by the electronic device (ie, when the current limiting mechanism is triggered). The first number can also be set according to actual conditions, such as 10 or 20, which is not limited in this disclosure.

[0027] Step 102: If the request message forwarding service meets the preset conditions, the second target request message in the second request message set received by the request message forwarding service is forwarded, and the second target request message is: the request messages remaining after the second request message set is removed from the second number of request messages, and the second number is greater than the first number.

[0028] The second request message set is a set of request messages that are currently received by the electronic device (ie, when the request message forwarding service meets the preset conditions) and have not been forwarded.

[0029] The request message forwarding service may be a forwarding success rate of the request message, or a forwarding failure rate or other conditions. The preset conditions may be preset, for example, the forwarding success rate is greater than a preset threshold or less than a preset threshold, or the forwarding failure rate is greater than a preset threshold or less than a preset threshold, etc. The preset conditions are goals to be achieved. If the request message forwarding service meets the preset conditions, it means that the number of request messages forwarded to the downstream needs to be further reduced, and the number of discarded request messages needs to be increased.

[0030] The discarded request message can be understood as a request message that is not forwarded, and the request message that is not forwarded is determined randomly. The second number can also be set according to actual conditions, such as 10 or 20, which is not limited in the present disclosure.

[0031] Further, if the request message forwarding service still meets the preset condition, the number of more discarded request messages is increased based on the second number, and so on, until the request message forwarding service does not meet the preset condition.

[0032] In this embodiment, when the current limiting mechanism is triggered, the first target request message in the first request message set received by the request message forwarding service is forwarded, and the first target request message is: the request message remaining after the first number of request messages are removed from the first request message set; if the request message forwarding service meets the preset conditions, the second target request message in the second request message set received by the request message forwarding service is forwarded, and the second target request message is: the request message remaining after the second number of request messages are removed from the second request message set, and the second number is greater than the first number. The above method can dynamically adjust the number of request messages that are not forwarded (i.e., discarded), and improve the flexibility and adaptability of setting the request message discard value.

[0033] In the above, in step 101, when the current limiting mechanism is triggered, after forwarding the first target request message in the first request message set received by the request message forwarding service, in step 102, if the request message forwarding service meets the preset conditions, before forwarding the second target request message in the second request message set received by the request message forwarding service, it also includes:

[0034] Counting the forwarding success rate of the first target request message in the first request message set;

[0035] Step 102: If the request message forwarding service meets a preset condition, forwarding the second target request message in the second request message set received by the request message forwarding service includes:

[0036] If the forwarding success rate is less than a first preset threshold, the second target request message in the second request message set received by the request message forwarding service is forwarded.

[0037] In this embodiment, the request message forwarding service can use the forwarding success rate of the first target request message as a basis for determination. The first preset threshold value can be set according to actual conditions. For example, the first preset threshold value can be 85% or 90%, which is not limited here. The preset condition is that the forwarding success rate of the first target request message is less than the first preset threshold value. When the request message forwarding service meets the preset condition, the number of discarded request messages is increased, that is, the second number is determined, and the request messages in the second request message set are forwarded according to the second number, and the second number is greater than the first number. Furthermore, the difference between the second number and the first number can be a preset difference, that is, when increasing the number of discarded request messages, the number increased each time is the same, for example, 10% each time, or 20 each time, which is not limited here.

[0038] In the above, if the forwarding success rate of the first target request message is less than the first preset threshold, it means that the number of request messages forwarded to the downstream needs to be further reduced, that is, the number of discarded request messages needs to be increased to reduce the downstream overload.

[0039] In the above, the counting of the forwarding success rate of the first target request message in the first request message set includes:

[0040] Receiving a response message to the first request message in the first target request message;

[0041] Counting the number of the first request messages;

[0042] The forwarding success rate is determined according to the number of first request messages and the number of the first target request messages.

[0043] Specifically, if the electronic device forwards the first target request message to the downstream successfully, it will receive a response message fed back by the downstream. If the electronic device receives the response message, it indicates that the first target request message is forwarded successfully. Based on this, the number of request messages that are forwarded successfully can be determined based on the value of the response message to the received first request message, and then the forwarding success rate can be determined based on the proportion of the number of first request messages to the number of first target request messages. Among them, the first request message is the message that receives the response message in the first target request message.

[0044] Furthermore, the number of first target request messages and the number of first request messages within a preset time period, such as 2 seconds or 5 seconds, may be counted to determine the forwarding success rate within the preset time period.

[0045] In this embodiment, the forwarding success rate is determined by the number of successfully forwarded request messages (i.e., the first request messages) and the number of first target request messages. That is, the forwarding success rate is determined based on the actual forwarding situation, which facilitates dynamic adjustment of the number of discarded request messages and improves the flexibility and adaptability of setting the number of discarded request messages.

[0046] In the above, in step 101, when the current limiting mechanism is triggered, after forwarding the first target request message in the first request message set received by the request message forwarding service, the following is also included:

[0047] If the request message forwarding service does not meet the preset conditions and the first quantity is greater than the second preset threshold, the third target request message in the third request message set received by the request message forwarding service will be forwarded, and the third target request message is: the request messages remaining after removing the third quantity of request messages from the third request message set, and the third quantity is less than the first quantity.

[0048] The preset condition is that the forwarding success rate is less than a first preset threshold value. The first preset threshold value can be set according to actual conditions. For example, the first preset threshold value can be 85% or 90%, which is not limited here.

[0049] When the request message forwarding service does not meet the preset conditions, for example, when the forwarding success rate is greater than or equal to 85%, and the first number is greater than the second preset threshold, the number of discarded request messages is reduced, that is, a third number of randomly discarded request messages is determined, and the third number is less than the first number. Furthermore, the difference between the third number and the first number may be a preset difference. That is, when reducing the number of discarded request messages, the number of reductions is the same each time, for example, 10% each time, or 20 each time, which is not limited here. The second preset threshold can also be set according to actual conditions, for example, 0.

[0050] If the forwarding success rate of the first target request message is greater than or equal to the first preset threshold, it means that the number of request messages forwarded to the downstream can be increased, that is, the number of discarded request messages can be reduced, and as many request messages as possible can be forwarded to improve the forwarding performance of the electronic device.

[0051] In the above, when the current limiting mechanism is triggered, after forwarding the first target request message in the first request message set received by the request message forwarding service, the method further includes:

[0052] If the message forwarding service does not meet the preset conditions and the first number is less than or equal to a second preset threshold, the current limiting mechanism is canceled.

[0053] Specifically, the preset condition is that the forwarding success rate is less than a first preset threshold value, and the first preset threshold value can be set according to actual conditions. For example, the first preset threshold value can be 85% or 90%, which is not limited here.

[0054] When the request message forwarding service does not meet the preset conditions, for example, when the forwarding success rate is greater than or equal to 85%, and the first number is less than or equal to the second preset threshold, it means that the request message forwarding service of the electronic device has been restored and the downstream overload situation has improved. At this time, the current limiting mechanism is canceled and the electronic device resumes normal forwarding of request messages.

[0055] In this embodiment, if the message forwarding service does not meet the preset condition and the first number is less than or equal to the second preset threshold, the current limiting mechanism is canceled. That is, when it is determined that the request information forwarding service of the electronic device is restored, the current limiting mechanism is canceled to improve the forwarding performance of the electronic device.

[0056] like Figure 2 FIG. 1 is another flow chart of the dynamic current limiting method provided by an embodiment of the present disclosure. Figure 2 As shown, the dynamic current limiting method includes:

[0057] Step 21, triggering the fuse mechanism (i.e., current limiting mechanism);

[0058] Step 22, execute fuse current limiting (i.e., dynamic current limiting strategy), that is, randomly discard X% of request messages. This step can be understood as selecting (1-X%) request messages from the received request messages for forwarding, where X is a number greater than 0 and less than 100;

[0059] Step 23, detecting the forwarding success rate of the request message forwarded N times (or pieces), and judging whether the request message forwarding service is restored according to the forwarding success rate;

[0060] Step 24, determining whether the request message forwarding service is restored, for example, if the forwarding success rate is greater than or equal to the first preset threshold, it is restored, and if the forwarding success rate is less than the first preset threshold, it is not restored; if it is not restored, go to step 25 for execution; if it is restored, go to step 26 for execution;

[0061] Step 25, increasing the discard ratio, that is, increasing the preset value based on X, and going to step 22 for execution;

[0062] Step 26, determine whether X is 0, if it is 0, execute step 27; if not 0, execute step 28;

[0063] Step 27, cancel the fuse;

[0064] Step 28, reducing the discard ratio, that is, reducing the preset value based on X, and then going to step 22 for execution.

[0065] The above-mentioned dynamic current limiting method ensures that the downstream will not be in an overload state continuously by adaptively and dynamically adjusting the current limiting ratio, avoids the downstream from being in an overload avalanche state continuously, and has self-healing ability.

[0066] See also Figure 3 , Figure 3 is a structural diagram of a dynamic current limiting device provided in an embodiment of the present disclosure, such as Figure 3 As shown, this embodiment provides a dynamic current limiting device 300, including:

[0067] A first forwarding module 301 is configured to forward a first target request message in a first request message set received by a request message forwarding service when a current limiting mechanism is triggered, wherein the first target request message is: the remaining request message after removing a first number of request messages from the first request message set;

[0068] The second forwarding module 302 is used to forward the second target request message in the second request message set received by the request message forwarding service if the request message forwarding service meets the preset conditions, and the second target request message is: the request messages remaining after removing the second number of request messages from the second request message set, and the second number is greater than the first number.

[0069] Furthermore, the dynamic current limiting device 300 further includes:

[0070] A statistics module, used for counting the forwarding success rate of the first target request message in the first request message set;

[0071] The second forwarding module is used to forward the second target request message in the second request message set received by the request message forwarding service if the forwarding success rate is less than a first preset threshold.

[0072] Furthermore, the statistical module includes:

[0073] A receiving submodule, configured to receive a response message to the first request message in the first target request message;

[0074] A statistics submodule, used to count the number of the first request messages;

[0075] A determination submodule is used to determine the forwarding success rate according to the number of first request messages and the number of the first target request messages.

[0076] Furthermore, the dynamic current limiting device 300 further includes:

[0077] A third forwarding module is used to forward the third target request message in the third request message set received by the request message forwarding service if the request message forwarding service does not meet the preset conditions and the first number is greater than the second preset threshold, wherein the third target request message is: the request message remaining after removing the third number of request messages from the third request message set, and the third number is less than the first number.

[0078] Furthermore, the dynamic current limiting device 300 further includes:

[0079] A cancellation module is used to cancel the current limiting mechanism if the message forwarding service does not meet the preset conditions and the first number is less than or equal to a second preset threshold.

[0080] The dynamic current limiting device 300 of the embodiment of the present disclosure, when the current limiting mechanism is triggered, forwards the first target request message in the first request message set received by the request message forwarding service, the first target request message being: the request message remaining after the first number of request messages are removed from the first request message set; if the request message forwarding service meets the preset conditions, forwards the second target request message in the second request message set received by the request message forwarding service, the second target request message being: the request message remaining after the second number of request messages are removed from the second request message set, the second number being greater than the first number. The above method can dynamically adjust the number of request messages that are not forwarded (i.e., discarded), and improve the flexibility and adaptability of setting the value of request message discard.

[0081] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0082] like Figure 4 , is a block diagram of an electronic device according to a method of dynamic current limiting according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0083] like Figure 4As shown, the electronic device includes: one or more processors 501, a memory 502, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 501 is taken as an example.

[0084] The memory 502 is a non-transient computer-readable storage medium provided by the present disclosure. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the method for dynamic current limiting provided by the present disclosure. The non-transient computer-readable storage medium of the present disclosure stores computer instructions, which are used to enable a computer to perform the method for dynamic current limiting provided by the present disclosure.

[0085] The memory 502 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the dynamic current limiting method in the embodiment of the present disclosure (for example, the attached Figure 3 The processor 501 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 502, that is, the dynamic current limiting method in the above method embodiment is implemented.

[0086] The memory 502 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device with dynamic current limiting, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 502 may optionally include a memory remotely arranged relative to the processor 501, and these remote memories may be connected to the electronic device with dynamic current limiting via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0087] The electronic device of the dynamic current limiting method may further include: an input device 503 and an output device 504. The processor 501, the memory 502, the input device 503 and the output device 504 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0088] The input device 503 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device with dynamic current limiting, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 504 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0089] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0090] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0091] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 can be received in any form (including acoustic input, voice input, or tactile input).

[0092] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0093] The computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The server may be a server of a distributed system or a server combined with a blockchain. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other.

[0094] In the present disclosure, when the current limiting mechanism is triggered, the first target request message in the first request message set received by the request message forwarding service is forwarded, and the first target request message is: the request message remaining after the first number of request messages are removed from the first request message set; if the request message forwarding service meets the preset conditions, the second target request message in the second request message set received by the request message forwarding service is forwarded, and the second target request message is: the request message remaining after the second number of request messages are removed from the second request message set, and the second number is greater than the first number. The above method can dynamically adjust the number of request messages that are not forwarded (i.e., discarded), and improve the flexibility and adaptability of setting the request message discard value.

[0095] If the forwarding success rate of the first target request message is less than the first preset threshold, it means that the number of request messages forwarded to the downstream needs to be further reduced, that is, the number of discarded request messages needs to be increased to reduce the downstream overload.

[0096] The forwarding success rate is determined by the number of successfully forwarded request messages (i.e., the first request messages) and the number of first target request messages, that is, the forwarding success rate is determined based on the actual forwarding situation, which facilitates dynamic adjustment of the number of discarded request messages and improves the flexibility and adaptability of setting the number of request message discards.

[0097] If the forwarding success rate of the first target request message is greater than or equal to the first preset threshold, it means that the number of request messages forwarded to the downstream can be increased, that is, the number of discarded request messages can be reduced, and as many request messages as possible can be forwarded to improve the forwarding performance of the electronic device.

[0098] If the message forwarding service does not meet the preset conditions and the first number is less than or equal to the second preset threshold, the current limiting mechanism is canceled. That is, when it is determined that the request information forwarding service of the electronic device is restored, the current limiting mechanism is canceled to improve the forwarding performance of the electronic device.

[0099] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in this disclosure can be achieved, and this document is not limited here.

[0100] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A dynamic current limiting method is applied to an electronic device, wherein the electronic device is a microservice middleware, and is used to forward a request message sent by a first device to a second device. include: When the fuse mechanism of the microservice is triggered, forwarding a first target request message in a first request message set received by a request message forwarding service, wherein the first target request message is: the remaining request message after removing the first number of request messages from the first request message set; The condition for triggering the fuse mechanism is whether the forwarding failure rate of the electronic device forwarding request message is greater than the fuse threshold; If the request message forwarding service meets the preset condition, forwarding the second target request message in the second request message set received by the request message forwarding service, the second target request message being: the remaining request message after removing the second number of request messages from the second request message set, the second number being greater than the first number; If the request message forwarding service does not meet the preset condition and the first number is greater than a second preset threshold, forwarding a third target request message in a third request message set received by the request message forwarding service, wherein the third target request message is: the request message remaining after removing a third number of request messages from the third request message set, and the third number is less than the first number; If the forwarding success rate of the third target request message is greater than or equal to the first preset threshold, and the third number is less than or equal to the second preset threshold, canceling the fuse mechanism; Among them, the preset condition is that the forwarding success rate of the first target request message is less than a first preset threshold.

2. The method according to claim 1, in, In the case where the fuse mechanism is triggered, after forwarding the first target request message in the first request message set received by the request message forwarding service, and before forwarding the second target request message in the second request message set received by the request message forwarding service if the request message forwarding service meets the preset condition, it also includes: The forwarding success rate of the first target request message in the first request message set is counted.

3. The method according to claim 2, in, The counting of the forwarding success rate of the first target request message in the first request message set includes: receiving a response message to a first request message in the first target request message, wherein the first request message is a message in which a response message is received in the first target request message; Counting the number of the first request messages; The forwarding success rate is determined according to the number of the first request messages and the number of the first target request messages.

4. A dynamic current limiting device, the device being a microservice middleware, configured to forward a request message sent by a first device to a second device, include: A first forwarding module, configured to forward a first target request message in a first request message set received by a request message forwarding service when a fuse mechanism of the microservice is triggered, wherein the first target request message is: the remaining request message after removing the first number of request messages from the first request message set; The condition for triggering the fuse mechanism is whether the forwarding failure rate of the middleware forwarding request message is greater than the fuse threshold; A second forwarding module, configured to forward a second target request message in a second request message set received by the request message forwarding service if the request message forwarding service meets a preset condition, wherein the second target request message is: the remaining request message after removing a second number of request messages from the second request message set, and the second number is greater than the first number; a third forwarding module, configured to forward a third target request message in a third request message set received by the request message forwarding service if the request message forwarding service does not meet a preset condition and the first quantity is greater than a second preset threshold, wherein the third target request message is: the request message remaining after the third number of request messages is removed from the third request message set, and the third number is less than the first number; A cancellation module, configured to cancel the fuse mechanism if the forwarding success rate of the third target request message is greater than or equal to a first preset threshold, and the third number is less than or equal to a second preset threshold; Among them, the preset condition is that the forwarding success rate of the first target request message is less than a first preset threshold.

5. The device according to claim 4, in, Also includes: A statistics module is used to count the forwarding success rate of the first target request message in the first request message set.

6. The device according to claim 5, in, The statistical module comprises: A receiving submodule, configured to receive a response message to a first request message in the first target request message, wherein the first request message is a message in which a response message is received in the first target request message; A statistics submodule, used to count the number of the first request messages; A determination submodule is used to determine the forwarding success rate according to the number of the first request messages and the number of the first target request messages.

7. An electronic device, in, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 3.

8. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 3.

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 3.

Citation Information

Patent Citations

  • Overload protection method and apparatus

    CN107995127A

  • Service adjustment method and device, equipment and storage medium

    CN111324471A

  • Method and system for realizing business flow control

    CN1937587A