Method and device for adjusting current limiting threshold value, storage medium and electronic equipment
By monitoring and analyzing the container usage of distributed architecture systems, relying on middleware performance and downstream system current limit value information, dynamically adjusting the current limit threshold, solving the problem of low current limit accuracy in the existing technology, and achieving more efficient and stable current limit management.
Patent Information
- Application Number
- CN202311676112.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2025-06-10
AI Technical Summary
When the prior art adjusts the current limit threshold of distributed architecture systems, the accuracy is not high, which can easily lead to the current limit being too conservative or too loose, affecting the stability and efficiency of the system.
By monitoring the container usage information of each server in the distributed architecture system, the performance information that depends on middleware and the downstream system's current limit value information, dynamic adjustment of the current limit threshold value is performed based on these information and pre-set current limit threshold calculation rules.
It realizes automatic adjustment of the current limit threshold according to the distributed architecture system and resource environment conditions, improves the accuracy and rationality of the current limit threshold setting, improves the current limit accuracy and resource utilization, and ensures the stability and efficiency of the system.
Smart Images

Figure CN120128544A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of middleware, and in particular, to a method, apparatus, storage medium, and electronic device for adjusting a current limiting threshold. Background Art
[0002] With the rapid development of Internet applications, distributed architecture systems can achieve load sharing by deploying computer nodes in different geographical locations, thereby effectively improving performance and availability, and becoming the mainstream architecture systems for large amounts of data and large operations. The distributed architecture provides services such as a configuration center, a monitoring center, service governance, and call current limiting, and uses access servers to access requests to implement the service-ification of applications and the application programming interface (API) of application programs.
[0003] In the application development or external service provision of a distributed architecture system, in order to ensure the stability and reliability of the distributed architecture system, it is necessary to limit the number of requests accessing the system according to the operating performance of each server in the system. By current limiting, the number of requests can be controlled to prevent the servers for processing access requests in the distributed architecture system from being overwhelmed by too many requests, protect the normal operation of the application programs for processing access requests in the system, and thus ensure the stability, reliability, and corresponding processing and response speed of the system.
[0004] In the related art, current limiting for a distributed architecture system is mainly applied in system expansion. After the distributed architecture system is expanded, the current limiting rules of the access servers are manually adjusted to adjust the current limiting threshold to expand the number of allowed access requests. When configuring the current limiting rules, the current limiting thresholds of the service instances of each server are evaluated separately and then added up. However, in this current limiting threshold adjustment method, when evaluating the current limiting threshold of a single service instance, the historical business traffic and stress test data of the service instance are mainly referred to, and it is easy to have the adjusted current limiting threshold be too conservative or too loose, resulting in low current limiting accuracy and unable to make the efficiency of the distributed architecture system reach the optimal. For example, an overly conservative current limiting threshold may cause reasonable requests to be rejected, resulting in a misjudgment of service unavailability. And an overly loose current limiting threshold may not be able to effectively control the traffic, resulting in system crashes. Summary of the Invention
[0005] In view of this, the present invention provides a method, apparatus, storage medium, and electronic device for adjusting a current limiting threshold.
[0006] Specifically, the present invention is implemented through the following technical solutions:
[0007] According to a first aspect of the present invention, a method for adjusting a current limiting threshold is provided. The method for adjusting a current limiting threshold includes:
[0008] Monitor the container usage information of each server in the distributed framework system, the performance information of the dependent middleware, and the traffic limiting value information of the downstream system. The dependent middleware is the dependent resource when the server processes requests, and the downstream system is the device that accesses the distributed framework system to send the requests;
[0009] Based on the container usage information, performance information, traffic limiting value information, and the pre-set traffic limiting threshold calculation rule, perform an estimation of the updated traffic limiting threshold;
[0010] According to the current traffic limiting threshold and the pre-estimated value of the updated traffic limiting threshold, determine whether to adjust the current traffic limiting threshold.
[0011] In the method for adjusting the traffic limiting threshold in this technical solution, by monitoring the container usage information of each server in the distributed framework system, the performance information of the dependent middleware, and the traffic limiting value information of the downstream system. The dependent middleware is the dependent resource when the server processes requests, and the downstream system is the device that accesses the distributed framework system to send the requests; based on the container usage information, performance information, traffic limiting value information, and the pre-set traffic limiting threshold calculation rule, perform an estimation of the updated traffic limiting threshold; according to the current traffic limiting threshold and the pre-estimated value of the updated traffic limiting threshold, determine whether to adjust the current traffic limiting threshold. In this way, based on the container usage information of each server, the performance information of the dependent middleware, and the traffic limiting value information of the downstream system, dynamically adjust the traffic limiting threshold, which can automatically adjust the traffic limiting threshold according to the distributed architecture system and the resource environment conditions, thereby improving the accuracy of the traffic limiting threshold setting and the rationality of the traffic limiting threshold, and further improving the traffic limiting accuracy and the resource utilization rate of the distributed architecture system.
[0012] According to the second aspect of the present invention, there is provided a device for adjusting the traffic limiting threshold. The device for adjusting the traffic limiting threshold includes:
[0013] A monitoring service module for monitoring the container usage information of each server in the distributed framework system, the performance information of the dependent middleware, and the traffic limiting value information of the downstream system. The dependent middleware is the dependent resource when the server processes requests, and the downstream system is the device that accesses the distributed framework system to send the requests;
[0014] A threshold estimation module for performing an estimation of the updated traffic limiting threshold based on the container usage information, performance information, traffic limiting value information, and the pre-set traffic limiting threshold calculation rule;
[0015] A traffic limiting adjustment module for determining whether to adjust the current traffic limiting threshold according to the current traffic limiting threshold and the pre-estimated value of the updated traffic limiting threshold.
[0016] According to a third aspect of the present invention, there is provided a storage medium having stored thereon a computer program, and when the program is executed by a processor, the steps of the method for adjusting the current limiting threshold in any possible implementation manner of the first aspect are implemented.
[0017] According to a fourth aspect of the present invention, there is provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the method for adjusting the current limiting threshold in any possible implementation manner of the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present invention and, together with the specification, are used to explain the principles of the present invention.
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or related technologies. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0020] Figure 1 It is a schematic flowchart of a method for adjusting a current limiting threshold provided by an embodiment of the present invention;
[0021] Figure 2 It is a schematic flowchart of step S102 in a method for adjusting a current limiting threshold provided by an embodiment of the present invention;
[0022] Figure 3
[0023] Figure 4 It is a schematic flowchart of step S103 in a method for adjusting a current limiting threshold provided by an embodiment of the present invention; It is a schematic diagram of a processing device for adjusting a current limiting threshold provided by an embodiment of the present invention;
[0024] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
[0026] As the number of access requests from Internet users to the distributed architecture system is increasing, due to the access limit of the throughput of the distributed architecture system, traffic control is required to ensure that the amount of requests received by the distributed architecture system is within a normal range for normal processing. Therefore, it is necessary to set a reasonable flow-limiting threshold for the access server in the distributed architecture system to avoid system crashes caused by traffic peaks, so as to ensure that the system can operate stably under a controllable load. In the related art, the method of flow-limiting for the distributed architecture system is achieved by separately evaluating the flow-limiting thresholds of individual service instances in the access server and then summing them up. When evaluating the flow-limiting threshold of the service instance corresponding to a single server, the historical business traffic and stress test data of the service instance are mainly referred to. However, since the historical business traffic is historical data for a past period, and the stress test data is a value determined by stress testing based on a preset environment, there is a large difference from the actual application environment of the distributed architecture system. For example, the flow-limiting threshold determined by stress test data is obtained based on a pre-set stress test, while in the actual application scenario, such as in the financial business, the access requests have large fluctuations (morning peak, afternoon peak), which is quite different from the pre-set stress test scenario. Therefore, it is easy to have the adjusted flow-limiting threshold being too conservative or too loose. An overly conservative flow-limiting threshold may result in reasonable requests being rejected, causing misjudgment of service unavailability, and the available resources of the distributed architecture system cannot be effectively utilized. While an overly loose flow-limiting threshold may not be able to effectively control the traffic, leading to the collapse of the distributed architecture system. The operating reliability of the distributed architecture system is relatively low, resulting in low accuracy of flow-limiting and inability to optimize the efficiency of the distributed architecture system.
[0027] When the distributed architecture system scales in or out, it is necessary to increase / decrease service instances to handle requests (incoming requests), and accordingly adjust the flow limiting rules to adapt to the increased / decreased number of service instances and processing capabilities. For example, after scaling out, the number of service instances increases, and the overall request processing capacity of the distributed architecture system improves. However, since the flow limiting rules are adjusted based on the business traffic and stress test data in the past period, reasonable requests are easily rejected, reducing the availability of the system, resulting in users possibly being unable to access the system normally, affecting business operations, and causing waste of the resources expanded; for the scaling-in operation, after scaling in, the number of service instances decreases, and the overall request processing capacity of the distributed architecture system drops. Adjusting the flow limiting rules based on the business traffic and stress test data in the past period is likely to result in overloading, leading to high load, slow response or even crash of the distributed architecture system. Further, in the scenario of link calls, the flow limiting of the distributed architecture system is also affected by the resource environments of downstream systems and dependent middleware. The adjustment of the flow limiting threshold for accessing services needs to be based on the resource environments of downstream systems and dependent middleware. When the resource environments of downstream systems and dependent middleware change, it will cause the determined flow limiting threshold to not match the current state of the distributed architecture system, and the flow limiting threshold needs to be readjusted to avoid the determined flow limiting threshold being too low or too high, which will not only affect the normal use of the business, but also cause some requests to not get normal responses, or result in waste of resources of the calling party and underutilization of resources of the distributed architecture system.
[0028] In this embodiment, for an access server, a method for adjusting the flow limiting threshold based on a distributed architecture system is proposed. By monitoring monitoring data such as the container usage information (memory, CPU) of each service instance, the performance information of dependent middleware, and the flow limiting value information of downstream systems in real time or according to a monitoring period, dynamic adjustment of the flow limiting threshold is achieved based on the monitoring data, and the flow limiting threshold is automatically adjusted in real time according to the status of the distributed architecture system and the resource environment, thereby improving the accuracy and rationality of the flow limiting threshold setting, further ensuring the stability of the distributed architecture system, improving the resource utilization rate of the distributed architecture system, optimizing the user experience, and enhancing the request processing efficiency.
[0029] See Figure 1 , an embodiment of the present invention provides a method for adjusting the flow limiting threshold, and the method may include the following steps:
[0030] S101, monitor the container usage information of each server in the distributed framework system, the performance information of dependent middleware, and the flow limiting value information of downstream systems, where the dependent middleware is a dependent resource for the server to process requests, and the downstream system is a device that accesses the distributed framework system to send the requests;
[0031] In this embodiment, in a distributed architecture system, the number of requests that an access server can handle is affected by factors such as the performance information of the dependent middleware and the traffic limiting value information of the downstream system, in addition to being related to the performance of each server in the distributed architecture system. Among them, the dependent middleware is the dependent resource when each server in the distributed framework system processes incoming requests, and the downstream system is the device, server, or container that sends requests to the distributed framework system. Taking the dependent middleware as an example, assume that a certain request needs to be processed by obtaining the resources of server a and server b. For example, the processing of the request accessed by the access server depends on the corresponding information extracted from the databases of server a and server b. The number of requests that the access server can handle is affected by the rate of extracting the corresponding information from the databases. Then the processing of this request depends on server a and server b, and server a and server b are the dependent middleware of this request. The number of requests that the access server can handle is affected by the server with lower performance among server a and server b. For another example, the access server is connected to downstream system C and downstream system D to access the requests incoming from downstream system C and downstream system D. Then the number of requests that the access server can handle is jointly affected by downstream system C and downstream system D.
[0032] In this embodiment, as an alternative embodiment, a monitoring tool can be used to monitor the container usage information, the performance information of the dependent middleware, and the traffic limiting value information of the downstream system in each server (container) of the distributed framework system according to a preset monitoring period or in real time.
[0033] In this embodiment, as an alternative embodiment, the container usage information includes but is not limited to: the number of container cores, memory usage information, CPU usage information, the number of disks, network communication rate. The performance information of the dependent middleware includes but is not limited to: dependent resource performance information, for example: the data response rate, read / write rate, etc. of an elasticsearch server (for example, it can be Elasticsearch, but not limited to this), a database, etc. Among them, the database can be selected as the Mysql database, but not limited to this.
[0034] In this embodiment, the container usage information, the performance information of the dependent middleware, and the traffic limiting value information of the server for processing requests are preset monitoring metric items for adjusting the traffic limiting threshold. The monitoring tool collects data on the preset monitoring metric items by calling the monitoring service for subsequent analysis and use.
[0035] In this embodiment, as an alternative embodiment, the monitoring tool includes, but is not limited to, a data collector. Using the data collector, data of preset monitoring metric items is collected according to the set monitoring period or in real time. Among them, the data collector includes, but is not limited to: Telegraf data operation and maintenance collector, StatsD (Statistical Data) collector, and Monitor collector.
[0036] In this embodiment, as an alternative embodiment, the method further includes:
[0037] Persistently store the container usage information, performance information of dependent middleware, and traffic limiting value information of downstream systems obtained by monitoring for each server.
[0038] In this embodiment, as an alternative embodiment, Elasticsearch, InfluxDB, etc. can be used for persistent storage of monitoring data to facilitate subsequent analysis of the operating performance of each server, dependent middleware, and downstream systems based on the persistent storage, but it is not limited thereto.
[0039] S102. Based on the container usage information, performance information, traffic limiting value information, and a preset traffic limiting threshold calculation rule, estimate the update of the traffic limiting threshold;
[0040] In this embodiment, according to the monitoring data including container usage information, performance information, and traffic limiting value information and the preset traffic limiting threshold calculation rule, analyze the status of the current distributed framework system, and obtain the estimated result of the traffic limiting threshold update.
[0041] In this embodiment, as an alternative embodiment, the estimated calculation of the traffic limiting threshold update can be performed by calling an analysis and calculation service based on the monitoring data and the traffic limiting threshold calculation rule.
[0042] Figure 2 It is a flow schematic diagram of step S102 in a method for adjusting a traffic limiting threshold provided by an embodiment of the present invention. As Figure 2 shown, in this embodiment, as an alternative embodiment, based on the monitored container usage information, performance information, traffic limiting value information, and a preset traffic limiting threshold calculation rule, estimate the update of the traffic limiting threshold, including:
[0043] S201. Respectively obtain the average usage information corresponding to the monitored container usage information, the average health status information corresponding to the performance information of the dependent middleware, and the average traffic limiting value information corresponding to the traffic limiting value information of the downstream system;
[0044] In this embodiment, as an alternative embodiment, obtaining the average usage information corresponding to the monitored container usage information includes:
[0045] Obtain the maximum and minimum values of the number of container cores, the maximum and minimum values of memory usage information, the maximum and minimum values of CPU usage information, the maximum and minimum values of the number of disks, and the maximum and minimum values of network communication rates in each server of the distributed framework system, where the maximum and minimum values include the maximum value and the minimum value;
[0046] Based on the number of container cores in the container usage information and the maximum and minimum values of the number of container cores, obtain the normalized number of container cores. Based on the memory usage information in the container usage information and the maximum and minimum values of the memory usage information, obtain the normalized memory usage information. Based on the CPU usage information in the container usage information and the maximum and minimum values of the CPU usage information, obtain the normalized CPU usage information. Based on the number of disks in the container usage information and the maximum and minimum values of the number of disks, obtain the normalized number of disks. And, based on the network communication rate in the container usage information and the maximum and minimum values of the network communication rate, obtain the normalized network communication rate;
[0047] According to the pre-set weight coefficients of the number of container cores, the weight coefficient of memory usage, the weight coefficient of CPU usage, the disk weight coefficient, the network weight coefficient, and the normalized number of container cores, the normalized memory usage information, the normalized CPU usage information, the normalized number of disks, and the normalized network communication rate, calculate the average usage information.
[0048] In this embodiment, taking the number of container cores as an example, based on the number of container cores and the maximum and minimum values of the number of container cores, obtaining the normalized number of container cores can be achieved by calculating the difference between the maximum value of the number of container cores and the minimum value of the number of container cores to obtain the maximum and minimum difference, then calculating the difference between the number of container cores and the minimum value of the number of container cores to obtain the core number difference, and calculating the quotient of the core number difference and the maximum and minimum difference to obtain the normalized number of container cores. In this way, by normalizing the parameters of various dimensions, the influence of different dimension values on the results can be effectively avoided.
[0049] In this embodiment, as an alternative embodiment, for each parameter, multiply the parameter by the corresponding weight coefficient, and then add the products corresponding to each parameter to obtain the average usage information.
[0050] S202. Calculate the first product of the average usage information and the usage weight coefficient corresponding to the container usage information, the second product of the average health status information and the health weight coefficient corresponding to the health status information, and the third product of the average throttling value information and the throttling weight coefficient corresponding to the throttling value information, respectively;
[0051] S203. Obtain the sum value of the first product, the second product, and the third product;
[0052] S204. Query the mapping relationship between the pre-set value and the throttling threshold, and obtain the pre-estimated value of the updated throttling threshold mapped by the sum value.
[0053] In this embodiment, the calculation rules for the current limiting threshold include, but are not limited to: the weight coefficient assignment rule, the calculation rule for the weighted sum value (threshold) of parameters, the mapping relationship between the sum value and the current limiting threshold, the pattern matching calculation rule, etc.
[0054] In this embodiment, as an alternative embodiment, the calculation rules for the current limiting threshold can be defined and managed through a rule engine. Among them, the rule engine includes, but is not limited to: the open-source rule engine (Drools), the framework and distributed processing (Apache Flink) rule engine, or a custom rule engine. In this embodiment, the calculation rules for the current limiting threshold adopt a threshold calculation rule based on the weights of each monitoring metric item.
[0055] In this embodiment, an analysis and calculation service is used to estimate the update of the current limiting threshold. As an alternative embodiment, the analysis and calculation service is a stream processing framework. Using a stream processing framework, such as Apache Flink, the real-time data stream processing tool (Spark Streaming), etc., to obtain monitoring data from the monitoring service, and match and calculate the obtained monitoring data with the preset calculation rules for the current limiting threshold, so as to obtain the pre-estimated value of the current limiting threshold update.
[0056] S103. Determine whether to adjust the current limiting threshold according to the current limiting threshold and the pre-estimated value of the current limiting threshold update.
[0057] In this embodiment, according to the analysis result (the pre-estimated value of the current limiting threshold update), determine whether to dynamically adjust the current limiting threshold.
[0058] Figure 3 It is a schematic flowchart of step S103 in a method for adjusting the current limiting threshold provided by an embodiment of the present invention. As Figure 3 shown, in this embodiment, as an alternative embodiment, determining whether to adjust the current limiting threshold according to the current limiting threshold and the pre-estimated value of the current limiting threshold update includes:
[0059] S301. Calculate the difference between the current limiting threshold and the pre-estimated value of the current limiting threshold update;
[0060] S302. Calculate the quotient of the difference and the current limiting threshold;
[0061] S303. If the quotient is within the preset non-adjustment range, determine not to adjust the current limiting threshold;
[0062] S304. If the quotient is not within the preset non-adjustment range, replace the current limiting threshold with the pre-estimated value of the current limiting threshold update.
[0063] In this embodiment, in order to reduce the performance fluctuations of the distributed architecture system caused by frequent adjustments, if the calculated quotient value is within a pre-set non-adjustment range, for example, the quotient value is 0.08 and the non-adjustment range is (-0.1 to 0.1), then since the quotient value is within this non-adjustment range, the current current-limiting threshold is not adjusted, and the current current-limiting threshold is maintained until the next monitoring period, and a re-judgment is made based on the analysis result calculated according to the monitoring in the next monitoring period.
[0064] In this embodiment, as an alternative embodiment, using the updated pre-estimated value of the current-limiting threshold to replace the current current-limiting threshold includes:
[0065] Modifying the current current-limiting threshold in the configuration file storing the current current-limiting threshold to the updated pre-estimated value of the current-limiting threshold.
[0066] In this embodiment, after determining that the current current-limiting threshold needs to be adjusted, as an alternative embodiment, the current-limiting threshold in the configuration file can be modified by calling an API interface to achieve dynamic adjustment of the current-limiting threshold.
[0067] In this embodiment, as an alternative embodiment, when allocating access requests, based on the load balancing strategy of each server in the distributed architecture system that processes access requests, the access requests are allocated. As another alternative embodiment, when allocating access requests, it can also be based on the optimal resource utilization strategy of the server. Therefore, this method further includes:
[0068] Determining the service current-limiting threshold of the request processing server according to the container usage information of the request processing server for processing requests;
[0069] Determining that the number of access requests being processed by the request processing server is less than the service current-limiting threshold, sending the access request to the request processing server, and obtaining the number of pending access requests of the request processing server;
[0070] If the number of pending access requests exceeds a pre-set request number threshold, sending the next received access request to the next request processing server.
[0071] In this embodiment, for each server of the distributed architecture system, the corresponding service current-limiting threshold is calculated. In the case where the number of access requests being processed by a request server is less than the service current-limiting threshold and the number of pending access requests does not exceed the pre-set request number threshold, the access request is sent to the request server for processing to make full use of the resources of the request server, improve resource utilization efficiency, and reduce the resource overhead required for the operation of other request processing servers. As an alternative embodiment, determining the service current-limiting threshold according to the container usage information can be obtained by calculating the average usage information and querying according to the mapping relationship between the average usage information and the service current-limiting threshold.
[0072] In this embodiment, as an alternative embodiment, by invoking the flow limiting threshold adjustment service, comparing the calculation result (pre-estimated value of flow limiting threshold update) obtained by matching and calculating according to the flow limiting threshold calculation rule with the current flow limiting threshold, and determining whether to adjust the flow limiting threshold based on the comparison result. After determining that the flow limiting threshold needs to be adjusted, invoke the flow limiting threshold adjustment service to adjust the flow limiting threshold by using the API or modifying the distributed architecture configuration file.
[0073] In this embodiment, as an alternative embodiment, after adjusting the flow limiting threshold, perform real-time interaction with the servers related to the access server, such as middleware and downstream systems, to notify the relevant servers to update the corresponding configuration files. For example, after increasing the flow limiting threshold, the increased flow limiting threshold that can be added to the corresponding server can be calculated according to the weight coefficient of each server, and the relevant servers are notified to increase the flow limiting threshold in the corresponding configuration file by the increased flow limiting threshold.
[0074] In this embodiment, in order to avoid large fluctuations in system performance caused by sharp adjustment of the flow limiting threshold, as an alternative embodiment, the flow limiting threshold can be adjusted step by step. Therefore, replacing the current flow limiting threshold with the pre-estimated value of flow limiting threshold update includes:
[0075] Determine the number of adjustment steps and the adjustment value corresponding to each adjustment step according to the difference;
[0076] Increase the current flow limiting threshold by the adjustment value;
[0077] In the next monitoring period, if the quotient is not within the pre-set non-adjustment range, execute the step of increasing the current flow limiting threshold by the adjustment value; if the quotient is within the pre-set non-adjustment range, do not adjust the current flow limiting threshold.
[0078] In this embodiment, the flow limiting threshold adjustment process is executed every preset time (monitoring period). As an alternative embodiment, determining the number of adjustment steps and the adjustment value corresponding to each adjustment step according to the difference includes:
[0079] Obtain the pre-estimated value of flow limiting threshold update in the current monitoring period and the difference in flow limiting threshold in the previous monitoring period;
[0080] Calculate the quotient of the difference and the difference in flow limiting threshold to obtain the number of adjustment steps, and the adjustment value corresponding to each adjustment step is the difference in flow limiting threshold.
[0081] In this embodiment, according to the throttling thresholds characterizing the request processing performance of each server for processing access requests in the distributed architecture system in the current monitoring period and the previous monitoring period before the current monitoring period, as well as the difference between the throttling threshold set in the current monitoring period and the updated estimated value of the throttling threshold calculated in the current monitoring period, the number of steps to be adjusted is determined, and the difference between the updated estimated values of the throttling thresholds in the current monitoring period and the previous monitoring period before the current monitoring period is used as the adjustment value for each step. In this way, a smooth adjustment of the throttling threshold of the access server can be achieved, a smooth transition of the performance of the distributed architecture system can be realized, and large fluctuations in performance can be avoided.
[0082] In this embodiment, when the distributed architecture system is scaled down, in order to ensure that some important access requests are intercepted, resulting in the business of the access request not being processed in time and causing greater business losses. Therefore, as an alternative embodiment, the method further includes:
[0083] After lowering the current throttling threshold, set the processing priority of business processing;
[0084] After the number of access requests exceeds a preset adjustment threshold, determine the service to which the access request belongs, and construct a request processing queue according to the processing priority of the service to which the access request belongs to process according to the processing priority corresponding to the access request in the request processing queue, where the adjustment threshold is less than the throttling threshold.
[0085] In this embodiment, by determining the processing priority of access requests, it can be ensured that access requests with a high processing priority have sufficient resources.
[0086] In this embodiment, as an alternative embodiment, in order to ensure that access requests with a lower processing priority are never processed, the method further includes:
[0087] When placing the access request in the request processing queue, set the timestamp of the access request;
[0088] According to a preset timestamp calculation period, calculate the access requests ranked nth in the request processing queue after sorting, upgrade the processing priority of the access requests ranked nth after sorting by one level, and re-sort the request processing queue according to the access requests with the upgraded processing priority.
[0089] In this embodiment, for access requests in the request processing queue that have not been processed for a long time, by upgrading the processing priority of the access request, the access request can be processed.
[0090] In this embodiment, after the current limiting threshold is increased, since the number of access requests processed by the distributed architecture system increases, each server processing the access requests may encounter anomalies. Thus, as an alternative embodiment, monitoring tools such as a monitoring instrumentation system (Grafana), Prometheus, etc. can be used to monitor the distributed architecture system after the dynamic adjustment of the current limiting threshold, so as to collect and display the real-time status and historical data of the system, and continuously optimize and improve the monitoring threshold calculation rules based on the collected real-time status, thereby improving the accuracy and predictability of the current limiting threshold. This method further includes:
[0091] Detect whether the adjusted current limiting threshold causes an access request processing anomaly in the distributed architecture system and the access request processing anomaly did not occur in the distributed architecture system before the adjustment. If so, perform a downscaling operation on the adjusted current limiting threshold according to a preset current limiting recovery variable value.
[0092] The current limiting threshold adjustment method of this embodiment can dynamically adjust the current limiting threshold in real time according to the distributed architecture system and resource environment conditions, and can be implemented in the form of microservices or components. The method of this embodiment is applicable to distributed frameworks such as a remote procedure call protocol (RPC) service framework.
[0093] Based on the same inventive concept, as Figure 4 shown, an embodiment of the present invention further provides a device for adjusting the current limiting threshold. The device includes:
[0094] A monitoring service module 401, configured to monitor the container usage information of each server in the distributed framework system, the performance information of the dependent middleware, and the current limiting value information of the downstream system. The dependent middleware is a dependent resource when the server processes requests, and the downstream system is a device that accesses the distributed framework system to send the requests;
[0095] In this embodiment, as an alternative embodiment, the container usage information includes but is not limited to: the number of container cores, memory usage information, CPU usage information, the number of disks, network communication rate. The performance information of the dependent middleware includes but is not limited to: dependent resource performance information, for example: the data response rate, read / write rate, etc. of an elastic search server (for example, it can be Elasticsearch, but not limited thereto), a database, etc. Among them, the database can be a Mysql database, but not limited thereto.
[0096] In this embodiment, as an alternative embodiment, the monitoring service module is a monitoring tool that monitors the container usage information, the performance information of the dependent middleware, and the throttling value information of the downstream system in the distributed framework system according to a preset monitoring period or in real time. The monitoring tools include, but are not limited to, Telegraf collector, StatsD collector, and Monitor collector.
[0097] The threshold prediction module 402 is configured to perform a throttling threshold update prediction based on the container usage information, the performance information, the throttling value information, and a preset throttling threshold calculation rule.
[0098] In this embodiment, as an alternative embodiment, the throttling threshold calculation rule can be defined and managed through a rule engine. The rule engines include, but are not limited to, Drools rule engine, Apache Flink rule engine, or a custom rule engine.
[0099] In this embodiment, as an alternative embodiment, the threshold prediction module 402 includes:
[0100] An average value calculation unit (not shown in the figure) is configured to respectively obtain the average usage information corresponding to the monitored container usage information, the average health status information corresponding to the performance information of the dependent middleware, and the average throttling value information corresponding to the throttling value information of the downstream system.
[0101] In this embodiment, taking the example of obtaining the average usage information corresponding to the monitored container usage information, as an alternative embodiment, the average value calculation unit is specifically configured to:
[0102] Obtain the maximum and minimum values of the container cores, memory usage information, CPU usage information, disk numbers, and network communication rates in each server of the distributed framework system, where the maximum and minimum values include the maximum value and the minimum value.
[0103] Based on the container cores in the container usage information and the maximum and minimum values of the container cores, obtain the normalized container cores. Based on the memory usage information in the container usage information and the maximum and minimum values of the memory usage information, obtain the normalized memory usage information. Based on the CPU usage information in the container usage information and the maximum and minimum values of the CPU usage information, obtain the normalized CPU usage information. Based on the disk numbers in the container usage information and the maximum and minimum values of the disk numbers, obtain the normalized disk numbers. And based on the network communication rate in the container usage information and the maximum and minimum values of the network communication rate, obtain the normalized network communication rate.
[0104] Calculate the average usage information based on the pre-set container core number weight coefficient, memory usage weight coefficient, CPU usage weight coefficient, disk weight coefficient, network weight coefficient, and the container normalized core number, memory normalized usage information, CPU normalized usage information, disk normalized number, and network normalized communication rate.
[0105] A weight coefficient application unit for calculating, respectively, a first product of the average usage information and the usage weight coefficient corresponding to the container usage information, a second product of the average health status information and the health weight coefficient corresponding to the health status information, and a third product of the throttling average value information and the throttling weight coefficient corresponding to the throttling value information;
[0106] A sum value calculation unit for obtaining the sum value of the first product, the second product, and the third product;
[0107] A threshold prediction unit for querying the mapping relationship between the pre-set value and the throttling threshold, and obtaining the updated pre-estimated value of the throttling threshold mapped by the sum value.
[0108] A throttling adjustment module 403 for determining whether to adjust the current throttling threshold based on the current throttling threshold and the updated pre-estimated value of the throttling threshold.
[0109] In this embodiment, as an alternative embodiment, the throttling adjustment module 403 includes:
[0110] A first calculation unit for calculating the difference between the current throttling threshold and the updated pre-estimated value of the throttling threshold;
[0111] A second calculation unit for calculating the quotient of the difference and the current throttling threshold;
[0112] A first judgment unit for determining not to adjust the current throttling threshold if the quotient is within the pre-set non-adjustment range;
[0113] A second judgment unit for replacing the current throttling threshold with the updated pre-estimated value of the throttling threshold if the quotient is not within the pre-set non-adjustment range.
[0114] In this embodiment, as an alternative embodiment, the second judgment unit is specifically configured to: modify the current throttling threshold in the configuration file storing the current throttling threshold to the updated pre-estimated value of the throttling threshold.
[0115] In this embodiment, as another alternative embodiment, the second determination unit is specifically configured to: determine the adjustment step number and the adjustment value corresponding to each adjustment step number according to the difference value; increase the current current-limiting threshold by the adjustment value; in the next monitoring period, if the quotient value is not within the pre-set non-adjustment range, execute the step of increasing the current current-limiting threshold by the adjustment value, and if the quotient value is within the pre-set non-adjustment range, do not adjust the current current-limiting threshold.
[0116] In this embodiment, determining the adjustment step number and the adjustment value corresponding to each adjustment step number according to the difference value includes:
[0117] Obtaining the estimated update value of the current-limiting threshold in the current monitoring period and the current-limiting threshold difference of the current-limiting threshold in the previous monitoring period;
[0118] Calculating the quotient of the difference value and the current-limiting threshold difference to obtain the adjustment step number, and the adjustment value corresponding to each adjustment step number is the current-limiting threshold difference.
[0119] In this embodiment, as an alternative embodiment, the device further includes:
[0120] A request allocation module (not shown in the figure), configured to determine the service current-limiting threshold of the request processing server according to the container usage information of the request processing server for processing requests; determine that the number of access requests being processed by the request processing server is less than the service current-limiting threshold, send the access request to the request processing server, and obtain the number of pending access requests of the request processing server; if the number of pending access requests exceeds the pre-set request number threshold, send the next received access request to the next request processing server.
[0121] In this embodiment, as another alternative embodiment, the device further includes:
[0122] A priority setting module, configured to set the processing priority of service processing after reducing the current current-limiting threshold; after the number of access requests exceeds the pre-set adjustment threshold, determine the service to which the access request belongs, and construct a request processing queue according to the processing priority of the service to which the access request belongs to process according to the processing priority corresponding to the access request in the request processing queue, where the adjustment threshold is less than the current-limiting threshold.
[0123] In this embodiment, as an alternative embodiment, the priority setting module is further configured to:
[0124] When placing the access request in the request processing queue, set the timestamp of the access request; calculate the access requests ranked nth in the request processing queue according to a preset timestamp calculation period, increase the processing priority of the access requests ranked nth after sorting by one level, and re-sort the request processing queue based on the access requests with increased processing priority.
[0125] In this embodiment, as another alternative embodiment, the device further includes:
[0126] An anomaly detection module, configured to detect whether the adjusted current limiting threshold causes an access request processing anomaly in the distributed architecture system and the access request processing anomaly has not occurred in the distributed architecture system before adjustment. If so, perform a reduction operation on the adjusted current limiting threshold according to a preset current limiting recovery variable value.
[0127] Based on the same inventive concept, an embodiment of the present invention further provides a storage medium, on which a computer program is stored. When the program is executed by a processor, the steps of the method for adjusting the current limiting threshold in any possible implementation manner described above are implemented.
[0128] Optionally, the storage medium may be a non-temporary computer-readable storage medium. For example, the non-temporary computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0129] Based on the same inventive concept, see Figure 5 , an embodiment of the present invention further provides an electronic device, including a memory 101 (such as a non-volatile memory), a processor 102, and a computer program stored on the memory 101 and executable on the processor 102. When the processor 102 executes the program, the steps of the method for adjusting the current limiting threshold in any possible implementation manner described above are implemented, which is equivalent to the device for adjusting the current limiting threshold as described above. Of course, the processor can also be used to process other data or perform operations. The electronic device may be a device such as a PC, a server, or a terminal.
[0130] As Figure 5 shown, the electronic device generally may further include: a memory 103, a network interface 104, and an internal bus 105. In addition to these components, other hardware may also be included, which will not be elaborated here.
[0131] It should be noted that the above device for adjusting the current limiting threshold may be implemented by software. As a logically meaningful device, it is formed by the processor 102 of the electronic device where it is located reading the computer program instructions stored in the non-volatile memory into the memory 103 and running them.
[0132] The embodiments of the subject matter and the functional operations described in this specification can be implemented in digital electronic circuitry, tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or one or more combinations of them. Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on a tangible non-transitory program carrier to be executed by, or to control the operation of, a data processing apparatus. Alternatively or additionally, the program instructions can be encoded on an artificially generated propagated signal, such as a machine-generated electrical, optical, or electromagnetic signal, generated to encode and transmit information to a suitable receiver apparatus for execution by the data processing apparatus. A computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or one or more combinations of them.
[0133] The processes and logical flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform the functions corresponding by operating on input data and generating output. The processes and logical flows can also be performed by, or the apparatus can be implemented as, special purpose logic circuitry, such as an FPGA (Field Programmable Gate Array) or an ASIC (Application Specific Integrated Circuit).
[0134] Computers suitable for executing a computer program include, by way of example, general and / or special purpose microprocessors, or any other type of central processing unit. Generally, a central processing unit will receive instructions and data from a read only memory and / or a random access memory. Basic components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Generally, a computer will also include one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, etc., or the computer will be operatively coupled to such mass storage devices to receive data from them or to transfer data to them, or both. However, a computer need not have such devices. In addition, a computer may be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device such as a universal serial bus (USB) flash drive, to name just a few.
[0135] Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, such as semiconductor memory devices (e.g., EPROM, EEPROM, and flash memory devices), magnetic disks (e.g., internal hard disks or removable disks), magneto-optical disks, and CD-ROM and DVD-ROM disks. The processor and the memory may be supplemented by, or incorporated in, special purpose logic circuitry.
[0136] Although this specification contains many specific implementation details, these should not be construed as limiting the scope of any invention or the scope of what is claimed, but rather as mainly for describing the features of specific embodiments of a particular invention. Certain features described in multiple embodiments in this specification may also be implemented in combination in a single embodiment. On the other hand, the various features described in a single embodiment may also be implemented separately in multiple embodiments or in any suitable sub-combination. Additionally, although features may operate in certain combinations and even be claimed as such initially, one or more features from a claimed combination may in some cases be removed from that combination, and the claimed combination may be directed to a sub-combination or a variation of a sub-combination.
[0137] Similarly, although operations are depicted in the drawings in a particular order, this should not be understood as requiring that the operations be performed in the particular order shown or sequentially, or that all illustrated operations be performed, to achieve the desired result. In some cases, multitasking and parallel processing may be advantageous. Additionally, the separation of the various system modules and components in the above embodiments should not be understood as required in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product, or packaged into multiple software products.
[0138] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the acts recited in the claims may be performed in a different order and still achieve the desired result. Additionally, the processes depicted in the drawings are not necessarily in the particular order or sequential order shown, to achieve the desired result. In some implementations, multitasking and parallel processing may be advantageous.
[0139] It should be noted that, in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0140] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for adjusting the current limiting threshold, characterized in that, it includes: monitoring the container usage information of each server in the distributed framework system, the performance information of the dependent middleware, and the current limiting value information of the downstream system, where the dependent middleware is the dependent resource when the server processes requests, and the downstream system is the device that accesses the distributed framework system to send the requests; estimating the update of the current limiting threshold based on the container usage information, performance information, current limiting value information, and the pre-set current limiting threshold calculation rule; determining whether to adjust the current limiting threshold according to the current limiting threshold and the pre-estimated value of the current limiting threshold update.
2. The method for adjusting the current limiting threshold according to claim 1, characterized in that, the estimating the update of the current limiting threshold based on the monitored container usage information, performance information, current limiting value information, and the pre-set current limiting threshold calculation rule includes: respectively obtaining the average usage information corresponding to the monitored container usage information, the average health condition information corresponding to the performance information of the dependent middleware, and the average current limiting value information corresponding to the current limiting value information of the downstream system; respectively calculating the first product of the average usage information and the usage weight coefficient corresponding to the container usage information, the second product of the average health condition information and the health weight coefficient corresponding to the health condition information, and the third product of the average current limiting value information and the current limiting weight coefficient corresponding to the current limiting value information; obtaining the sum value of the first product, the second product, and the third product; querying the mapping relationship between the pre-set value and the current limiting threshold, and obtaining the pre-estimated value of the current limiting threshold update mapped by the sum value.
3. The method for adjusting the current limiting threshold according to claim 2, characterized in that, the obtaining the average usage information corresponding to the monitored container usage information includes: obtaining the maximum and minimum values of the container core number, memory usage information, CPU usage information, disk number, and network communication rate in each server of the distributed framework system, where the maximum and minimum values include the maximum value and the minimum value; based on the container core number in the container usage information and the maximum and minimum values of the container core number, obtaining the normalized container core number, based on the memory usage information in the container usage information and the maximum and minimum values of the memory usage information, obtaining the normalized memory usage information, based on the CPU usage information in the container usage information and the maximum and minimum values of the CPU usage information, obtaining the normalized CPU usage information, based on the disk number in the container usage information and the maximum and minimum values of the disk number, obtaining the normalized disk number, and based on the network communication rate in the container usage information and the maximum and minimum values of the network communication rate, obtaining the normalized network communication rate; calculating the average usage information according to the pre-set container core number weight coefficient, memory usage weight coefficient, CPU usage weight coefficient, disk weight coefficient, network weight coefficient, and the normalized container core number, normalized memory usage information, normalized CPU usage information, normalized disk number, and normalized network communication rate.
4. The method for adjusting the current limiting threshold according to claim 1, characterized in that, Determining whether to adjust the current current-limiting threshold according to the current current-limiting threshold and the updated estimated value of the current-limiting threshold includes: Calculating the difference between the current current-limiting threshold and the updated estimated value of the current-limiting threshold; Calculating the quotient of the difference and the current current-limiting threshold; If the quotient is within a pre-set non-adjustment range, determining not to adjust the current current-limiting threshold; If the quotient is not within the pre-set non-adjustment range, replacing the current current-limiting threshold with the updated estimated value of the current-limiting threshold.
5. The method for adjusting the current-limiting threshold according to claim 4, wherein, The replacing the current current-limiting threshold with the updated estimated value of the current-limiting threshold includes: Modifying the current current-limiting threshold in the configuration file storing the current current-limiting threshold to the updated estimated value of the current-limiting threshold.
6. The method for adjusting the current-limiting threshold according to claim 4, wherein, The replacing the current current-limiting threshold with the updated estimated value of the current-limiting threshold includes: Determining the adjustment steps and the adjustment value corresponding to each adjustment step according to the difference; Increasing the current current-limiting threshold by the adjustment value; In the next monitoring period, if the quotient is not within the pre-set non-adjustment range, performing the step of increasing the current current-limiting threshold by the adjustment value, and if the quotient is within the pre-set non-adjustment range, not adjusting the current current-limiting threshold.
7. The method for adjusting the current-limiting threshold according to any one of claims 1 to 6, wherein, It further includes: Determining the service current-limiting threshold of the request processing server according to the container usage information of the request processing server for processing requests; Determining that the number of access requests being processed by the request processing server is less than the service current-limiting threshold, sending the access request to the request processing server, and obtaining the number of pending access requests of the request processing server; If the number of pending access requests exceeds a pre-set request number threshold, sending the next received access request to the next request processing server.
8. The method for adjusting the current-limiting threshold according to any one of claims 1 to 6, wherein, It further includes: After lowering the current current-limiting threshold, setting the processing priority of business processing; After the number of access requests exceeds a pre-set adjustment threshold, determining the service to which the access request belongs, and constructing a request processing queue according to the processing priority of the service to which the access request belongs to process according to the processing priority corresponding to the access requests in the request processing queue, and the adjustment threshold is less than the current-limiting threshold.
9. The method for adjusting the current-limiting threshold according to claim 8, wherein, It further includes: When placing the access request in the request processing queue, setting the timestamp of the access request; Calculating the access requests ranked nth in the request processing queue according to a pre-set timestamp calculation period, increasing the processing priority of the access requests ranked nth by one level, and re-ordering the request processing queue according to the access requests with the increased processing priority.
10. An apparatus for adjusting the current-limiting threshold, wherein, The device for adjusting the current limiting threshold includes: A monitoring service module, configured to monitor the container usage information of each server in the distributed framework system, the performance information of the dependent middleware, and the current limiting value information of the downstream system. The dependent middleware is the dependent resource when the server processes requests, and the downstream system is the device that accesses the distributed framework system to send the requests; A threshold prediction module, configured to perform an update prediction of the current limiting threshold based on the container usage information, performance information, current limiting value information, and a pre-set current limiting threshold calculation rule; A current limiting adjustment module, configured to determine whether to adjust the current current limiting threshold according to the current current limiting threshold and the predicted value of the updated current limiting threshold.
11. A storage medium, characterized in that a program or instruction is stored on the storage medium, and when the program or instruction is run by a processor, the steps of the method for adjusting the current limiting threshold according to any one of claims 1 to 9 are implemented.
12. An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the program, the steps of the method for adjusting the current limiting threshold according to any one of claims 1 to 9 are implemented.