Dynamic flow limiting method and device, equipment and storage medium

By calculating the request response time and average response time of the service port and dynamically adjusting the current limit parameters, the problem that the static current limiting strategy cannot adapt to external performance changes is solved, and the system performance and user experience optimization is achieved.

CN120281713APending Publication Date: 2025-07-08THE PEOPLES BANK OF CHINA NAT CLEARING CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510520554.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

The existing static current limiting strategies are difficult to adapt to dynamic changes in external performance such as networks, middleware and databases, resulting in unstable service response time and affecting system performance and user experience.

Method used

By calculating the request response time and average response time of the application service port, the current limit parameter threshold is dynamically adjusted to achieve dynamic current limit.

Benefits of technology

It realizes dynamic adjustment of the current limiting strategy according to the actual service status, optimizes system resource allocation, avoids server crashes, and improves user experience and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120281713A_ABST
    Figure CN120281713A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic flow limiting method and device, equipment and a storage medium. The method comprises the following steps: calculating request response time of a service request received by an application service port; calculating the average request response time of all service requests received by the application service port in the statistical period; and adjusting a current limiting parameter threshold value of the application service port according to the average request response time. According to the scheme provided by the invention, the dynamic flow limiting of the application service port is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network technologies, and in particular, to a dynamic current limiting method, apparatus, device, and storage medium. Background Art

[0002] With the rapid development of Internet applications, especially in scenarios with high concurrency and large amounts of data processing, the access pressure faced by the system has increased sharply. Without control, too many requests may overwhelm the server, resulting in service unavailability, which in turn affects user experience and business operations. Therefore, implementing a reasonable current limiting strategy has become an essential part of system design and operation and maintenance.

[0003] Currently, the common current limiting strategy is to preset a static fixed value to control the number of concurrent requests globally or for specific services. This parameter value is usually considered from multiple dimensions such as the concurrent requirements of the service, the scale of service deployment nodes, the maximum thread pool capacity of each node, and the hardware resource configuration relied on by the service nodes.

[0004] However, in application scenarios highly dependent on external performances such as networks, middleware, and databases, the response time of the service becomes a key factor in measuring the overall application efficiency. A longer response time often means that internal resources of the application (such as connection pools, Central Processing Unit (CPU), memory, Input / Output (I / O) ports, etc.) are occupied for a long time, thus limiting the number and rate of concurrent requests that the system can process simultaneously. On the contrary, if the response time is shortened, it indicates that the system resources respond quickly and the externally dependent services are also efficient. At this time, the concurrent request processing ability can be appropriately improved. The average response time of the service is the result of the combined action of various internal and external factors in the entire service chain and is the average performance reflection of the comprehensive resources in the entire service chain. However, considering that the performances of external components such as networks, middleware, and databases will change dynamically with the running time, it is difficult to ensure the optimization of the current limiting strategy by using the method of configuring fixed current limiting parameter values. Summary of the Invention

[0005] The present invention provides a dynamic current limiting method, apparatus, device, and storage medium, which realizes dynamic current limiting of application service ports.

[0006] According to one aspect of the present invention, there is provided a dynamic current limiting method, including:

[0007] Calculating the request response time of a service request received by an application service port;

[0008] Calculating the average request response time of all service requests received by the application service port within a statistical period;

[0009] Adjust the threshold of the current limiting parameter of the application service port according to the average request response time.

[0010] In one embodiment, calculating the request response time of the service requests received by the application service port includes:

[0011] Obtain the request reception time and the request end time of each service request received by the application service port;

[0012] Calculate the request response time of each service request according to the request reception time and the request end time of each service request.

[0013] In one embodiment, adjusting the threshold of the current limiting parameter of the application service port according to the average request response time includes:

[0014] Calculate the new threshold of the current limiting parameter of the application service port according to the current threshold of the current limiting parameter of the application service port and the average request response time;

[0015] Modify the threshold of the current limiting parameter of the application service port to the new threshold of the current limiting parameter.

[0016] In one embodiment, the method further includes:

[0017] When the current traffic of the application service port reaches the current threshold of the current limiting parameter of the application service port, process the service requests of the application service port according to the preset current limiting measures.

[0018] In one embodiment, the threshold of the current limiting parameter includes a request response time threshold and / or a request quantity threshold.

[0019] According to another aspect of the present invention, there is provided a dynamic current limiting device, including:

[0020] A calculation module, configured to calculate the request response time of the service requests received by the application service port; calculate the average request response time of all service requests received by the application service port within a calculation statistical period;

[0021] An adjustment module, configured to adjust the threshold of the current limiting parameter of the application service port according to the average request response time.

[0022] In one embodiment, the calculation module is specifically configured to obtain the request reception time and the request end time of each service request received by the application service port; calculate the request response time of each service request according to the request reception time and the request end time of each service request.

[0023] In one embodiment, the adjustment module is specifically configured to calculate the new threshold of the current limiting parameter of the application service port according to the current threshold of the current limiting parameter of the application service port and the average request response time; modify the threshold of the current limiting parameter of the application service port to the new threshold of the current limiting parameter.

[0024] In one embodiment, the apparatus further includes:

[0025] A current-limiting module, configured to, when the current traffic of the application service port reaches the current current-limiting parameter threshold of the application service port, process the service request of the application service port according to a preset current-limiting measure.

[0026] In one embodiment, the current-limiting parameter threshold includes a request response time threshold and / or a request quantity threshold.

[0027] According to another aspect of the present invention, there is provided an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0028] The memory stores computer-executable instructions;

[0029] The processor executes the computer-executable instructions stored in the memory to implement the above dynamic current-limiting method.

[0030] According to another aspect of the present invention, there is provided a computer program product, including a computer program, which is stored in a computer-readable storage medium, and at least one processor can read the computer program from the computer-readable storage medium, and when the at least one processor executes the computer program, the above dynamic current-limiting method is implemented.

[0031] The technical solution of the embodiment of the present invention, after calculating the request response time of the service request received by the computing application service port, calculates the average request response time of all service requests received by the application service port within a statistical period, and adjusts the current-limiting parameter threshold of the application service port according to the average request response time, and can adjust the current-limiting strategy of the service port based on the relevant attributes of the service request received by the application service port, realizing dynamic current-limiting of the application service port.

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

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0034] Figure 1 A flowchart of a dynamic current-limiting method provided by an embodiment of the present invention;

[0035] Figure 2Schematic flowchart of another dynamic current limiting method provided by an embodiment of the present invention;

[0036] Figure 3 Schematic flowchart of a specific process of the dynamic current limiting method provided by an embodiment of the present application;

[0037] Figure 4 Schematic structural diagram of a dynamic current limiting device provided by an embodiment of the present invention;

[0038] Figure 5 Schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0039] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention. The acquisition, storage, use, processing, etc. of data in the technical solution of the present application all comply with the relevant regulations of national laws and regulations.

[0040] Figure 1 Schematic flowchart of a dynamic current limiting method provided by an embodiment of the present invention. As Figure 1 shown, the dynamic current limiting method provided in this embodiment includes:

[0041] Step S110, calculate the request response time of the service requests received by the application service port.

[0042] The dynamic current limiting method provided by an embodiment of the present application is applied to a server or service node that provides application services. The server can be centrally or dispersedly deployed at a service provider that provides application services, or can be deployed in the cloud. The dynamic current limiting method provided by an embodiment of the present application can be executed by a dedicated dynamic current limiting device, or can be executed by a hardware module or software module deployed on the server or service node. Preferably, the dynamic current limiting method can be executed by a software module deployed in the server or service node.

[0043] For a server or service node that provides application services, after receiving a service request sent by a client, it provides the application service to the client and returns the application service result to the client. However, in the scenario of a large number of concurrent service requests, when the server may receive a large number of service requests within a short period of time, it needs to consume a large amount of processing resources to process the service requests, which will lead to an increase in the response time for service requests, and it may not be able to respond to all service requests in a timely manner. Therefore, it may be difficult for the service requests sent by the client to be responded to in a timely manner, and it may even lead to the server crashing and the application service becoming unavailable. Therefore, it is necessary to limit the traffic on the application service port of the server. Rate Limiting is a commonly used technical means for controlling the access rate of the system to resources to ensure the stability and reliability of the system. In scenarios such as distributed system QWeb services and API interfaces, traffic limiting is particularly important. By restricting the frequency or quantity of requests, it can effectively prevent problems such as system overload, crashing, or resource exhaustion caused by sudden traffic. Traffic limiting not only protects the interests of service providers but also improves the user experience. However, how to determine a reasonable traffic limiting strategy, on the basis of avoiding a decrease in system performance caused by excessive traffic, serve as many service requests as possible, and adjust the traffic limiting strategy according to the actual situation is a problem that needs to be solved.

[0044] Therefore, the embodiments of the present application provide a dynamic traffic limiting method. By statistically analyzing the response time of service requests on the application service port, the traffic limiting strategy of the application service port is dynamically adjusted to avoid the impact on the user experience caused by a large number of concurrent service requests not being processed in a timely manner. First, for each service request received by the application service port, calculate its request response time. The request response time of a service request is the time from when the application service port receives the service request to when it sends the service request response. The length of the request response time varies according to the actual business corresponding to the service request.

[0045] The request response time can be calculated in real time when the application service port receives and processes each service request, or it can be calculated based on the logs or cache records recorded when the application service port receives and processes each service request.

[0046] Specifically, to calculate the request response time of the service requests received by the application service port, first obtain the request reception time and request end time of each service request received by the application service port, and then calculate the request response time of each service request based on the request reception time and request end time of each service request. The request reception time of each service request is the time when the application service port receives the service request, and the request end time is the time when the server sends the service request response corresponding to the service request through the application service port after processing the service request. The difference between the request end time and the request reception time is the request response time of the service request.

[0047] Step S120: Calculate the average request response time of all service requests received by the application service port within the statistical period.

[0048] Since the request response times of the service requests received by the application service port may vary due to differences in the operations of different service requests and the resource usage of the servers processing the service requests may fluctuate, it is difficult for the request response time of a single service request received by the application service port to reflect the actual state of the application service port. Therefore, for the traffic limiting strategy of an application service port that receives a large number of service requests, the traffic limiting strategy can be adjusted according to a certain statistical period. For all service requests received by the application service port within the statistical period, calculate the average request response time. The average request response time of all service requests of the application service port within the statistical period can accurately reflect the actual operating state of the application service port.

[0049] The average request response time of all service requests received by the application service port can be the arithmetic mean of the request response times of all service requests received by the application service port, or a weighted average or an average calculated by other algorithms.

[0050] Step S130: Adjust the traffic limiting parameter threshold of the application service port according to the average request response time.

[0051] After calculating the average request response time of the application service port, it is possible to determine whether the rate limiting policy of the application service port needs to be adjusted. The rate limiting policy of the application service port can be determined according to any one or more rate limiting parameters of service requests. For example, the rate limiting policy of the application service port can be that the average request response time exceeds a preset threshold, or the rate limiting policy can be that the number of service requests within a preset time exceeds a preset threshold, etc. Among them, according to the calculated average request response time of the application service port, the adjustment method of the rate limiting parameter threshold of the application service port can be directly determined, or the rate limiting parameter corresponding to the rate limiting parameter threshold of the application service port can be determined according to the calculated average request response time of the application service port, and then the adjustment method of the rate limiting parameter threshold of the application service port can be determined according to the calculated rate limiting parameter. If the calculated average request response time of the application service port is lower than the average request response time threshold configured for the application service port, then the average request response time threshold of the application service port may not be adjusted. Taking the rate limiting parameter threshold as the average request response time as an example, for example, the rate limiting parameter threshold of the application service port is 200 milliseconds (ms). When the calculated average request response time is 250 ms, it means that in the current statistical period, the response times of service requests are all relatively long. Then, in order to improve the rate limiting parameter threshold of the application service port, for example, the rate limiting parameter threshold of the application service port is adjusted to 250 ms. This means that the service request response times of this application service port are all relatively high. Correspondingly, the number of parallel service requests that this application service port can serve simultaneously needs to be reduced accordingly. Based on this, after adjusting the rate limiting parameter threshold of the application service port, the adjustment of the rate limiting policy of the application service port can be achieved.

[0052] In one embodiment, the update of the rate limiting policy includes: calculating a new rate limiting parameter threshold of the application service port according to the current rate limiting parameter threshold of the application service port and the average request response time; modifying the rate limiting parameter threshold of the application service port to the new rate limiting parameter threshold. The new rate limiting parameter threshold can be directly calculated according to the current rate limiting parameter threshold of the application service port and the average response time of service requests within the statistical period, or can be a new rate limiting parameter threshold calculated after calculating an intermediate result according to the current rate limiting parameter threshold of the application service port and the average response time of service requests within the statistical period.

[0053] The initial rate limiting parameter threshold can be pre-configured in the server. The initial rate limiting parameter threshold includes the type of rate limiting parameter and the threshold corresponding to the type of rate limiting parameter. The application service port can first perform rate limiting according to the initial rate limiting parameter threshold, and after one statistical period, adjust the initial rate limiting parameter threshold according to the average request response time of service requests received in this statistical period.

[0054] In one embodiment, the current limiting parameter threshold includes a request response time threshold and / or a request quantity threshold. That is, the current limiting parameter threshold can be the request response time threshold, and the service requests are current-limited according to the current response time of the received service requests. Or the current limiting parameter threshold can be the request quantity threshold, and the service requests are current-limited according to the quantity of service requests received per unit time.

[0055] The dynamic current limiting method provided by the embodiments of the present application calculates the average request response time of all service requests received by the application service port within a statistical period after calculating the request response time of the service requests received by the application service port, and adjusts the current limiting parameter threshold of the application service port according to the average request response time. It can adjust the current limiting policy of the service port based on the relevant attributes of the service requests received by the application service port, and realizes the dynamic current limiting of the application service port.

[0056] Figure 2 For the flowchart of another dynamic current limiting method provided by the embodiments of the present invention, as Figure 2 shown, the dynamic current limiting method provided in this embodiment includes:

[0057] Step S210, calculate the request response time of the service requests received by the application service port.

[0058] Step S220, calculate the average request response time of all service requests received by the application service port within a statistical period.

[0059] Step S230, adjust the current limiting parameter threshold of the application service port according to the average request response time.

[0060] Step S240, when the current traffic of the application service port reaches the current current limiting parameter threshold of the application service port, process the service requests of the application service port according to the preset current limiting measures.

[0061] The current limiting parameter threshold of the application service port is the limiting value of the current limiting policy. The application service port is current-limited according to the current limiting parameter threshold of the application service port. After the current limiting parameter threshold of the application service port is adjusted, the application service port is current-limited according to the adjusted current limiting parameter threshold.

[0062] That is, according to Figure 1After the dynamic current limiting method provided by the illustrated embodiment dynamically adjusts the current limiting parameters, when a service request is received again at the application service port, the current traffic of the application service port is judged according to the adjusted current limiting parameter threshold. When the current traffic of the application service port reaches the current current limiting parameter threshold of the application service port, the service request of the application service port is processed according to the preset current limiting measure. The preset current limiting measure is to reduce the traffic of the application service port and avoid server crashes. The preset current limiting measure can be, for example, rejecting the response, returning a retry prompt, prompting to queue and wait, performing a degraded service, etc. That is, when the current traffic of the application service port reaches the current current limiting parameter threshold of the application service port, if the application service port receives a service request again, the service request is rejected and a rejection response message is returned; or a retry prompt message is returned; or a queue waiting message is returned, and when the current traffic of the application service port is lower than the current current limiting parameter threshold, the queued application requests are processed; or a degraded service is performed on the service request, and fewer resources are used to process the service request; or only a part of the content of the service request is processed, that is, a degraded process is performed on the service request.

[0063] The purpose of current limiting for service requests is to avoid the service avalanche effect during peak business hours. After the concurrent requests exceed the number of requests that the system can handle, the requests of all users may face problems such as timeout failures or very slow responses. After current limiting, the experience of non-current-limited users can be guaranteed, and the users whose requests are current-limited can also get a quick response after retrying, so as to avoid the avalanche effect of the system service during the request peak period. Although the service requests of some users are not current-limited, the experience of most users is guaranteed at the expense of the experience of some users.

[0064] The following uses a specific example to elaborate in detail on the dynamic current limiting method provided by the embodiments of the present application. Figure 3 This is a specific process schematic diagram of the dynamic current limiting method provided by the embodiments of the present application. Taking the example that the dynamic current limiting method provided by the embodiments of the present application is implemented by a software module deployed in a server. In this example, taking the dynamic current limiting tool provided in the form of a code package as an example, it integrates comprehensive dynamic current limiting functions to ensure the optimization of current limiting tests and ensure the overall service performance and stability of the system.

[0065] The Dynamic Req Limit Tool has a configuration function that can flexibly set the statistical period (AvgReqCalPeriod) of the rate limit parameters for the global or specific service interfaces, set the expected average response time of the interface (AvgReqTime, default unit: ms), the rate limit service type (ReqLimitType), its default rate limit threshold (ReqLimitValue), and the rate limit measure (LimitStrategy). The default rate limit threshold is optional and can default to the global configuration value. The rate limit threshold can be, for example, the number of application requests that can be accessed simultaneously. The rate limit measures can include, for example, returning a retry prompt, executing a degraded service, etc., and storing various configured parameters in the rate limit parameter set (ReqLimitValueMap).

[0066] For example, the following rate limit configurations are pre-configured in the rate limit parameter set:

[0067] The rate limit type is "app / req1", which is request type 1. The default rate limit threshold is "5", the expected average response time of the interface is "200 ms", and the rate limit measure is "return a retry prompt";

[0068] The rate limit type is "app / req2", which is request type 2. The default rate limit threshold is "4", the expected average response time of the interface is "250 ms", and the rate limit measure is "return a retry prompt";

[0069] The rate limit type is "app / req3", which is request type 3. The default rate limit threshold is "2", the expected average response time of the interface is "500 ms", and the rate limit measure is "return a retry prompt".

[0070] Furthermore, a data collection queue (ReqLimitDataQue) is initialized for each rate limit configuration to ensure the effective collection and processing of data.

[0071] The Dynamic Req Limit Tool has a rate limit interception function. A rate limit interceptor (ReqLimitInterceptor) is configured to automatically intercept all interface requests configured with dynamic rate limits. For all requests, the key information of the request (such as the request reception time, the URL of the request, the request end time) is recorded, and after calculating the request response time (request end time - request reception time), it is stored in the data collection queue to provide data support for subsequent analysis.

[0072] The dynamic flow-limiting tool has an automatic startup function. When the application starts, it loads all the configurations of dynamic flow-limiting, initializes the configuration information into the flow-limiting parameter set, initializes the operation information collection queue for each flow-limiting configuration, and starts the flow-limiting monitoring thread at the same time. This thread will regularly collect and calculate the operation information of the interfaces according to the flow-limiting information of each interface configured in the flow-limiting parameter set based on the cycle time set by the average request response cycle.

[0073] The dynamic flow-limiting tool has an intelligent flow-limiting parameter adjustment function. According to the flow-limiting parameter statistical cycle, it regularly obtains the interface request processing information from the data collection queue, calculates the new average response time (NewAvgReqTime), and adjusts the flow-limiting parameters downward proportionally and rounds down accordingly. At the same time, it sets the average request response time to the new average request response time to achieve the dynamic optimization of the flow-limiting strategy.

[0074] The application service (AppService) is equipped with the functions of receiving service requests and processing service requests.

[0075] For the above dynamic flow-limiting tool, the request processing flow is as follows:

[0076] 1. In the code writing stage, the application service introduces the dynamic flow-limiting tool, combines the business characteristics for flow-limiting design, determines the interfaces to be flow-limited and the initial flow-limiting values, and configures the flow-limiting information for the interfaces that need to be flow-limited according to the configuration requirements, including the statistical cycle, flow-limiting parameter type, flow-limiting threshold, and flow-limiting measures, etc.

[0077] 2. In the application startup stage: After the application service starts, the dynamic flow-limiting tool will initialize the flow-limiting parameter set and the data collection queue object, load all the configurations in the configuration file, put the flow-limiting information configured for the interfaces into the flow-limiting parameter set, and automatically start the built-in flow-limiting interceptor to intercept the flow-limited interface requests. At the same time, it starts the flow-limiting monitoring thread to calculate and dynamically adjust the flow-limiting test for the collected operation information regularly according to the cycle.

[0078] 3. In the application running stage: When a request is sent to the application service, the flow-limiting interceptor of the dynamic flow-limiting tool will intercept the request. If it does not exceed the flow-limiting threshold, the interceptor will continue to pass the request to the service layer of the application service for processing and record the request response time at the same time. After the request is processed, the dynamic flow-limiting tool collects and calculates the response time of this request, and puts the result into the data collection queue. The self-started thread of the dynamic flow-limiting tool will analyze and calculate the new flow-limiting threshold after a statistical cycle ends (new flow-limiting threshold = round down [flow-limiting threshold * average response time / new average response time]). If the flow-limiting threshold changes, the next request will be flow-limited according to the new flow-limiting threshold, and at the same time, the average response time is set to the new average response time.

[0079] The above solution captures the changing trend of interface service performance in real time by collecting the response time of the interface within a statistical period, and dynamically adjusts the flow limit threshold according to the calculation formula to ensure that system resources can be allocated and utilized more reasonably and efficiently, and to ensure that the application can provide services to the outside world to the greatest extent.

[0080] Next, the dynamic flow limit method provided by the embodiments of the present application will be applied to an actual scenario to further elaborate on the dynamic flow limit method provided by the embodiments of the present application.

[0081] For the banking industry, bank statistical analysis services are an essential part of modern bank operations. By collecting, organizing, analyzing, and presenting vast amounts of financial data, they provide in-depth insights and decision-making support for bank management, business departments, and branches. Users can flexibly set query conditions according to their own needs and easily obtain detailed statistical analysis reports covering different time periods and various business types. Due to the different data volumes generated by different business types, the lengths of the selected time periods, and the server environments for processing requests, there will be significant differences in the interface response time.

[0082] Taking the statistical analysis service of a certain bank's identity verification business as an example, the service interface provides statistical analysis data for querying two types of services: resident identity information verification (with a daily average verification volume of up to 30 million transactions) and non-resident identity information verification (with a daily average verification volume of approximately 50,000 transactions). The service is deployed on server nodes in Center A (sas_a) and Center B (sas_b), and requests are sent to sas_a and sas_b in a round-robin manner through a load balancing device.

[0083] 1. During the service development process, developers introduced a dynamic flow limit tool, set the statistical period of the interface flow limit information to 1 hour, and configured the flow limit parameters for the interface. The configuration information for sas_a and sas_b is as follows:

[0084] avgReqTime = 250ms indicates that the default average request response time for this interface is 250ms.

[0085] reqLimitType = " / sas / infoQuery" indicates that the flow limit service type is information query.

[0086] The reqLimitValue = 4 means that according to the calculation of the current limiting parameter, the average response time is 250 ms, and 4 requests can be processed in one second. When the number of requests exceeds 4, the service interface will perform service current limiting, and subsequent requests will no longer be processed, returning that the service is busy and try again later. The purpose of current limiting requests is to avoid the service avalanche effect during peak business hours. After the number of concurrent requests exceeds the number of requests that the system can handle, all users' requests may face problems such as timeout failures or very slow responses. After current limiting, the experience of non-current-limited users can be guaranteed, and users who are current-limited can also get a quick response after retrying. Thus, the avalanche effect of the system service during the request peak period can be avoided. Sacrificing the experience of some users to guarantee the experience of most users.

[0087] 2. During the actual operation process, due to the differences in business characteristics, the interface performances of the two central nodes show significant differences. Within a statistical period of 1 hour, most of the requests assigned to sas_b are to query the statistical analysis results of resident identity information verification, and the query time period is more than 6 months, resulting in the average response time of the sas_b interface being around 500 ms. Most of the requests assigned to sas_a are to query the statistical analysis results of non-resident identity information verification, and the query time period is within 1 week, and the average response time of the sas_a interface is around 150 ms.

[0088] 3. According to the new current limiting parameter NewReqLimitValue = floor[ReqLimitValue * AvgReqTime / NewAvgReqTime] formula, where AvgReqTime is the average request response time and NewAvgReqTime is the new average request response time. The current limiting thresholds of the two nodes are recalculated and adjusted as follows:

[0089] sas_b node: NewReqLimitValue_wx = 4 * 250 / 500 = 2

[0090] sas_a node: NewReqLimitValue_bj = 4 * 250 / 150 = 6.66

[0091] Finally, the current limiting threshold of the sas_b node is optimized to when reqLimitValue = 2 and avgReqTime = 500 to better adapt to its longer response cycle;

[0092] While the current limiting threshold of the sas_a node is increased to reqLimitValue = 6 and avgReqTime = 150 to give full play to its high processing capacity.

[0093] Figure 4 It is a schematic structural diagram of a dynamic current limiting device provided by an embodiment of the present invention, asFigure 4 As shown in the figure, the dynamic current limiting device provided in this embodiment includes:

[0094] A calculation module 41, configured to calculate the request response time of service requests received by the application service port; calculate the average request response time of all service requests received by the application service port within a calculation statistical period; an adjustment module 42, configured to adjust the current limiting parameter threshold of the application service port according to the average request response time.

[0095] The dynamic current limiting device provided in this embodiment is used to implement Figure 1 the dynamic current limiting method provided in the embodiment shown in the figure. Its implementation principle and technical effects are similar and will not be elaborated here.

[0096] In one embodiment, the calculation module 41 is specifically configured to obtain the request reception time and request end time of each service request received by the application service port; calculate the request response time of each service request according to the request reception time and request end time of each service request.

[0097] In one embodiment, the adjustment module 42 is specifically configured to calculate a new current limiting parameter threshold of the application service port according to the current current limiting parameter threshold and the average request response time of the application service port; modify the current limiting parameter threshold of the application service port to the new current limiting parameter threshold.

[0098] In one embodiment, the dynamic current limiting device may further include a current limiting module 43, configured to, when the current traffic of the application service port reaches the current current limiting parameter threshold of the application service port, process the service requests of the application service port according to a preset current limiting measure.

[0099] In one embodiment, the current limiting parameter threshold includes a request response time threshold and / or a request quantity threshold.

[0100] Figure 5 It is a schematic structural diagram of an electronic device provided in an embodiment of the present application. As Figure 5 shown in the figure, the electronic device may include: a transceiver 51, a processor 52, and a memory 53.

[0101] The processor 52 executes the computer execution instructions stored in the memory, so that the processor 52 executes the solution in the above embodiment. The processor 52 may be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it may also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0102] The memory 53 is connected to the processor 52 through a system bus and completes mutual communication. The memory 53 is used to store computer program instructions.

[0103] The transceiver 51 can be used to obtain the tasks to be run and the configuration information of the tasks to be run.

[0104] The system bus can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to implement communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include a Random Access Memory (RAM), and may also include a non-volatile memory.

[0105] The electronic device provided by the embodiment of the present application can be a computer or a server on which the dynamic current limiting device in the above embodiment is deployed.

[0106] The embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions run on a computer, the computer is caused to execute the technical solution of the dynamic current limiting method in the above embodiment.

[0107] The embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when at least one processor executes the computer program, the technical solution of the dynamic current limiting method in the above embodiment can be implemented.

[0108] It should be understood that various forms of the flow shown above can be used, steps can be reordered, added, or deleted. For example, the steps described in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.

[0109] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims

1. A dynamic current limiting method, characterized in that, including: calculating the request response time of service requests received by the application service port; calculating the average request response time of all service requests received by the application service port within a statistical period; adjusting the throttling parameter threshold of the application service port according to the average request response time.

2. The method according to claim 1, characterized in that, The calculating the request response time of service requests received by the application service port includes: obtaining the request reception time and request end time of each service request received by the application service port; calculating the request response time of each service request according to the request reception time and request end time of each service request.

3. The method according to claim 1, characterized in that, The adjusting the throttling parameter threshold of the application service port according to the average request response time includes: calculating a new throttling parameter threshold of the application service port according to the current throttling parameter threshold of the application service port and the average request response time; modifying the throttling parameter threshold of the application service port to the new throttling parameter threshold.

4. The method according to any one of claims 1 to 3, characterized in that It further includes: when the current traffic of the application service port reaches the current throttling parameter threshold of the application service port, processing the service requests of the application service port according to a preset throttling measure.

5. The method according to any one of claims 1 to 3, characterized in that The throttling parameter threshold includes a request response time threshold and / or a request quantity threshold.

6. A dynamic current limiting device, characterized in that, including: a calculation module for calculating the request response time of service requests received by the application service port; calculating the average request response time of all service requests received by the application service port within a statistical period; an adjustment module for adjusting the throttling parameter threshold of the application service port according to the average request response time.

7. The device according to claim 6, characterized in that, The calculation module is specifically configured to obtain the request reception time and request end time of each service request received by the application service port; calculate the request response time of each service request according to the request reception time and request end time of each service request.

8. The device according to claim 6, characterized in that The adjustment module is specifically configured to calculate a new throttling parameter threshold of the application service port according to the current throttling parameter threshold of the application service port and the average request response time; modify the throttling parameter threshold of the application service port to the new throttling parameter threshold.

9. The device according to any one of claims 6 to 8, characterized in that It further includes: a throttling module for, when the current traffic of the application service port reaches the current throttling parameter threshold of the application service port, processing the service requests of the application service port according to a preset throttling measure.

10. The device according to any one of claims 6 to 8, characterized in that, The throttling parameter threshold includes a request response time threshold and / or a request quantity threshold.

11. An electronic device, characterized in that, including: a processor and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the method according to any one of claims 1-5.

12. A computer-readable storage medium, characterized in that, Computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, they are used to implement the method according to any one of claims 1-5.

13. A computer program product, characterized in that, including a computer program, which is stored in a computer-readable storage medium, at least one processor can read the computer program from the computer-readable storage medium, and when at least one processor executes the computer program, the technical solution of the dynamic throttling method in the above embodiments can be implemented.