Traffic control method and device, storage medium and electronic device

By acquiring multiple parameter values ​​for comprehensive traffic control, the problem that the Sentinel traffic control framework could not meet the needs of large-scale business systems was solved, and refined traffic management of business units was achieved.

CN119484405BActive Publication Date: 2026-05-05QINGDAO HAIER TECH +3
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QINGDAO HAIER TECH
Filing Date
2024-05-27
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

The existing Sentinel traffic control framework is unable to effectively control traffic to business units and cannot meet the needs of large-scale business systems.

Method used

By obtaining multiple parameter values ​​from the parameter value set, including the number of queries, response time, CPU utilization, and memory usage of business units, and combining them with time points, comprehensive traffic control is performed.

Benefits of technology

It enables fine-grained traffic control for business units, improving the accuracy and flexibility of traffic control and adapting to the needs of large-scale business systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484405B_ABST
    Figure CN119484405B_ABST
Patent Text Reader

Abstract

This application discloses a flow control method, apparatus, storage medium, and electronic device, relating to the field of smart home technology. The flow control method includes: obtaining N parameter values ​​from a set of parameter values, wherein the set of parameter values ​​includes at least two of the following: the number of queries processed by the business unit per time unit, the response time of the business unit, the CPU utilization rate of the target device running the business unit, the memory usage of the business unit, and the time node at which the target device runs the business unit; N is an integer greater than or equal to 2; and performing flow control on the business unit based on the N parameter values. This solution addresses the problem that flow control frameworks cannot effectively control the flow of business units, thus enabling better flow control of business units.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart home technology, and more specifically, to a flow control method and apparatus, a storage medium, and an electronic device. Background Technology

[0002] With the rise of microservices, the stability between services is becoming increasingly important. Sentinel is an open-source traffic control framework whose flow control rules are determined by simple parameters. Specifically, it simply monitors the value of a parameter and determines whether to trigger rate limiting based on whether the parameter value meets preset conditions. However, this type of flow control rule cannot meet the needs of large-scale business systems.

[0003] There is currently no effective solution to the problem that traffic control frameworks in related technologies cannot effectively control traffic to business units.

[0004] Therefore, it is necessary to improve the relevant technology to overcome the aforementioned defects. Summary of the Invention

[0005] This application provides a flow control method, apparatus, storage medium, and electronic device to at least solve the problem that the flow control framework cannot effectively control the flow of business units.

[0006] According to one aspect of the embodiments of this application, a flow control method is provided, comprising: obtaining N parameter values ​​from a parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by a business unit in each time unit, the response time of the business unit, the CPU utilization rate of the target device running the business unit, the memory usage of the business unit, and the time node at which the target device runs the business unit; N is an integer greater than or equal to 2; and performing flow control on the business unit according to the N parameter values.

[0007] In an exemplary embodiment, traffic control of the service unit based on the N parameter values ​​includes: when the response time is greater than or equal to a first response time, traffic control of the service unit based on the CPU utilization rate; and / or when the response time is greater than or equal to a second response time and less than the first response time, traffic control of the service unit based on the number of queries.

[0008] In an exemplary embodiment, traffic control of the service unit based on the CPU utilization rate includes: when the CPU utilization rate is less than a first utilization rate, traffic control of the service unit based on the memory usage; and when the CPU utilization rate is greater than or equal to the first utilization rate, traffic control of the service unit based on the time node.

[0009] In an exemplary embodiment, traffic control of the business unit based on the number of queries includes: when the number of queries is greater than or equal to a preset number of queries, traffic control of the business unit is performed based on the time node; and / or when the number of queries is less than the preset number of queries, no traffic limiting is applied to the business unit.

[0010] In an exemplary embodiment, traffic control of the service unit based on the time node includes: not limiting the traffic of the service unit when the time node is a stress test time node; and / or controlling the traffic of the service unit based on the CPU utilization when the time node is not the stress test time node.

[0011] In an exemplary embodiment, traffic control of the service unit based on the CPU utilization rate includes: determining a preset utilization rate corresponding to the preset time node when the time node is a preset time node; and performing traffic control of the service unit based on the relationship between the CPU utilization rate and the preset utilization rate.

[0012] In an exemplary embodiment, before obtaining N parameter values ​​from the parameter value set, the method further includes: if an update to the traffic control rule is detected in the configuration center, obtaining the traffic control rule from the configuration center; wherein the traffic control rule is used to instruct the obtaining of the N parameter values ​​from the parameter value set, and to perform traffic control on the service unit based on the N parameter values.

[0013] According to another aspect of the embodiments of this application, a flow control device is provided, comprising: an acquisition module, configured to acquire N parameter values ​​from a parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by a business unit in each time unit, the response time of the business unit, the CPU utilization rate of the target device running the business unit, the memory usage of the business unit, and the time node at which the target device runs the business unit; N is an integer greater than or equal to 2; and a control module, configured to perform flow control on the business unit according to the N parameter values.

[0014] In an exemplary embodiment, the control module is configured to perform traffic control on the service unit based on the N parameter values ​​in the following manner: when the response time is greater than or equal to a first response time, perform traffic control on the service unit based on the CPU utilization; and / or when the response time is greater than or equal to a second response time and less than the first response time, perform traffic control on the service unit based on the number of queries.

[0015] In an exemplary embodiment, the control module is configured to perform traffic control on the service unit based on the CPU utilization rate in the following ways: when the CPU utilization rate is less than a first utilization rate, the traffic control is performed on the service unit based on the memory usage; when the CPU utilization rate is greater than or equal to the first utilization rate, the traffic control is performed on the service unit based on the time node.

[0016] In an exemplary embodiment, the control module is configured to perform traffic control on the business unit based on the number of queries in the following manner: when the number of queries is greater than or equal to a preset number of queries, perform traffic control on the business unit based on the time node; and / or when the number of queries is less than the preset number of queries, do not limit the traffic of the business unit.

[0017] In an exemplary embodiment, the control module is configured to perform traffic control on the service unit based on the time node in the following manner: if the time node is a stress test time node, not to limit the traffic of the service unit; and / or if the time node is not the stress test time node, to perform traffic control on the service unit based on the CPU utilization.

[0018] In an exemplary embodiment, the control module is configured to perform traffic control on the service unit based on the CPU utilization rate by: determining a preset utilization rate corresponding to the preset time node when the time node is a preset time node; and performing traffic control on the service unit based on the relationship between the CPU utilization rate and the preset utilization rate.

[0019] In an exemplary embodiment, the acquisition module is further configured to acquire the traffic control rules from the configuration center before acquiring the N parameter values ​​from the parameter value set, provided that the traffic control rules have been updated in the configuration center; wherein the traffic control rules are used to instruct the acquisition of the N parameter values ​​from the parameter value set and to perform traffic control on the service unit based on the N parameter values.

[0020] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored program, wherein the computer program is configured to execute the above-described flow control method at runtime.

[0021] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described flow control method through the computer program.

[0022] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program, which, when executed by a processor, performs the above-described flow control method.

[0023] This application enables traffic control of the business unit based on at least two parameters from the parameter value set, thereby solving the problem that the traffic control framework cannot effectively control the traffic of the business unit, and thus enabling better traffic control of the business unit. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 This is a schematic diagram of the hardware environment for a flow control method according to an embodiment of this application;

[0027] Figure 2 This is a flowchart of a flow control method according to an embodiment of this application;

[0028] Figure 3 This is a schematic diagram of a flow control rule according to an embodiment of this application;

[0029] Figure 4 This is an overall schematic diagram of a flow control method according to an embodiment of this application;

[0030] Figure 5 This is a structural block diagram of a flow control device according to an embodiment of this application. Detailed Implementation

[0031] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0032] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0033] According to one aspect of the embodiments of this application, a flow control method is provided. This flow control method is widely used in whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. Optionally, in this embodiment, the above-mentioned flow control method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0034] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0035] To address the aforementioned issues, this embodiment provides a flow control method, including but not limited to those applied to the Sentinel flow protection framework. Figure 2 This is a flowchart of a flow control method according to an embodiment of this application, the process including the following steps S202-S204:

[0036] Step S202: Obtain N parameter values ​​from the parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by the business unit in each time unit, the response time (RT) of the business unit, the utilization rate of the central processing unit (CPU) of the target device running the business unit, the memory usage of the business unit, and the time node in which the target device runs the business unit; N is an integer greater than or equal to 2;

[0037] It should be noted that the number of queries processed by a business unit in each time unit is called the number of queries per second (QPS) of the business unit.

[0038] It should be noted that business units are used to run business services. Therefore, traffic control of business units is equivalent to traffic control of business services.

[0039] Optionally, the business service is a microservice. A microservice is a software architecture pattern that breaks down an application into small, independent, deployable services, each with its own business functions and data storage. These services collaborate with each other through lightweight communication mechanisms and can be deployed and scaled independently, thereby improving system maintainability, flexibility, and scalability. Microservice architecture allows development teams to develop and deploy new features faster while reducing the overall complexity of the system. By breaking the application down into small services, continuous integration and continuous deployment become easier, enabling rapid iteration and quick response to customer needs.

[0040] Step S204: Perform traffic control on the service unit based on the N parameter values.

[0041] Optionally, traffic control includes: not limiting the rate of a business unit, limiting the rate of a business unit, circuit breaking (i.e., temporarily stopping access to the business unit) for a business unit, and degrading the business unit.

[0042] The above steps perform flow control on the business unit based on at least two parameters from the parameter value set, thereby solving the problem that the flow control framework cannot effectively control the flow of business units, and thus enabling better flow control of business units.

[0043] In an exemplary embodiment, step S204 includes: step S11, or step S12, or steps S11 and S12, or steps S11 and S13, or steps S12 and S13, or steps S11, S12, and S13.

[0044] Step S11: If the response time is greater than or equal to the first response time, perform flow control on the service unit based on the CPU utilization rate;

[0045] Optionally, the first response time is 1000ms.

[0046] Step S12: If the response time is greater than or equal to the second response time and less than the first response time, perform flow control on the business unit based on the number of queries;

[0047] Optionally, the second response time is 20ms.

[0048] Step S13: If the time response is less than the second response time, the service unit is not subject to rate limiting.

[0049] In an exemplary embodiment, traffic control of the service unit based on the CPU utilization includes the following steps S111-S112:

[0050] Step S111: If the CPU utilization rate is less than the first utilization rate, perform flow control on the service unit based on the memory usage.

[0051] Optionally, the initial utilization rate is 90%.

[0052] Optionally, traffic control of the service unit based on the memory usage includes: limiting the traffic of the service unit when the memory usage indicates that the service unit occupies more than or equal to a first size of memory in the target device; and not limiting the traffic of the service unit when the memory usage indicates that the service unit occupies less than the first size of memory in the target device.

[0053] Optionally, the first size is 3G.

[0054] Step S112: If the CPU utilization rate is greater than or equal to the first utilization rate, perform traffic control on the service unit according to the time node.

[0055] Optionally, traffic control of the service unit based on the time node includes: not limiting the traffic of the service unit when the time node is a stress test time node; and limiting the traffic of the service unit when the time node is not a stress test time node.

[0056] In an exemplary embodiment, traffic control of the business unit based on the number of queries includes the following steps S121 and / or S122:

[0057] Step S121: If the number of queries is greater than or equal to the preset number of queries, perform traffic control on the business unit according to the time node;

[0058] Optionally, the preset number of queries is 20.

[0059] Step S122: If the number of queries is less than the preset number of queries, no rate limiting is applied to the business unit.

[0060] In an exemplary embodiment, traffic control of the service unit based on the time node includes the following steps S21 and / or S22:

[0061] Step S21: If the time node is a stress test time node, do not apply rate limiting to the service unit;

[0062] It should be noted that since rate limiting of a business unit will affect the stress test of the business unit, the rate limiting configuration is deleted in advance when the business unit is at the stress test time point, and the business unit is not rate limited.

[0063] Step S22: If the time node is not the stress test time node, perform traffic control on the service unit based on the CPU utilization.

[0064] In an exemplary embodiment, traffic control of the service unit based on the CPU utilization includes the following steps S31-S32:

[0065] Step S31: If the time node is a preset time node, determine the preset utilization rate corresponding to the preset time node;

[0066] Step S32: Perform traffic control on the service unit based on the relationship between the CPU utilization rate and the preset utilization rate.

[0067] Optionally, when the preset time node is an activity day node, a first preset utilization rate corresponding to the activity day node is determined; when the CPU utilization rate is greater than or equal to the first preset utilization rate, the service unit is rate-limited; when the CPU utilization rate is less than the first preset utilization rate, the memory usage of the service unit is determined; when the memory usage indicates that the amount of memory occupied by the service unit on the target device is greater than or equal to a second size, the service unit is rate-limited; when the memory usage indicates that the amount of memory occupied by the service unit on the target device is less than the second size, the service unit is not rate-limited.

[0068] Optionally, the first preset has a utilization rate of 99%, and the second size is 4G.

[0069] Optionally, when the preset time node is a non-active day node, a second preset utilization rate corresponding to the non-active day node is determined; when the CPU utilization rate is greater than or equal to the second preset utilization rate, the service unit is rate-limited; when the CPU utilization rate is less than the first preset utilization rate, the memory usage of the service unit is determined; when the memory usage indicates that the amount of memory occupied by the service unit on the target device is greater than or equal to a third size, the service unit is rate-limited; when the memory usage indicates that the amount of memory occupied by the service unit on the target device is less than the second size, the service unit is not rate-limited.

[0070] Optionally, the second preset has a usage rate of 80%, and the third is 3G in size.

[0071] For a better understanding, please refer to the detailed implementation of step S204 above. Figure 3 The flow control rules shown (represented as a decision tree) are as follows: Figure 3 As shown, when the response time is abnormal, traffic protection will not be triggered directly. Instead, traffic control will be performed in combination with other rule nodes.

[0072] In an exemplary embodiment, prior to step S202 above, the method further includes: upon detecting an update to the traffic control rules in the configuration center, obtaining the traffic control rules from the configuration center; wherein the traffic control rules are used to instruct the acquisition of the N parameter values ​​from the parameter value set, and to perform traffic control on the service unit based on the N parameter values.

[0073] To better understand, such as Figure 4 As shown, users can modify traffic control rules in the configuration center through the console. Then, when the Sentinel traffic protection framework detects an update to the traffic control rules in the configuration center, it retrieves and loads the new rules. It should be noted that a rule engine can be added to Sentinel's core code to execute the retrieved traffic control rules (i.e.,... Figure 3 (The decision tree shown).

[0074] It should be noted that this application is based on the Sentinel traffic protection framework and has been optimized and modified to make the traffic protection function more secure and reliable. It solves the problem that the triggering conditions of the flow control rules are single and cannot be matched and associated with other reference items, and solves the problem of cumbersome and complicated flow control rule configuration. When there are exception scenarios such as stress testing, there is no need to reconfigure the rules.

[0075] It should be noted that traffic control methods can be applied to network traffic control, server load control, API access control, database access control, software license control, and mobile communication traffic control. In general, traffic control methods are suitable for scenarios that require management and restriction of various traffic usage.

[0076] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0077] This embodiment also provides a flow control device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementations, or a combination of software and hardware, are also possible and contemplated.

[0078] Figure 5 This is a structural block diagram of a flow control device according to an embodiment of this application. The device includes:

[0079] The acquisition module 52 is used to acquire N parameter values ​​from the parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by the business unit in each time unit, the response time of the business unit, the CPU utilization rate of the target device running the business unit, the memory usage of the business unit, and the time node in which the target device runs the business unit; N is an integer greater than or equal to 2.

[0080] The control module 54 is used to perform flow control on the service unit based on the N parameter values.

[0081] The aforementioned device performs flow control on the service unit based on at least two parameters from the parameter value set, thereby solving the problem that the flow control framework cannot effectively control the flow of the service unit, and thus can effectively control the flow of the service unit.

[0082] In an exemplary embodiment, the control module 54 is configured to perform traffic control on the service unit based on the N parameter values ​​in the following manner: when the response time is greater than or equal to a first response time, perform traffic control on the service unit based on the CPU utilization; and / or when the response time is greater than or equal to a second response time and less than the first response time, perform traffic control on the service unit based on the number of queries.

[0083] In an exemplary embodiment, the control module 54 is configured to perform traffic control on the service unit based on the CPU utilization rate in the following ways: when the CPU utilization rate is less than a first utilization rate, the traffic control is performed on the service unit based on the memory usage; when the CPU utilization rate is greater than or equal to the first utilization rate, the traffic control is performed on the service unit based on the time node.

[0084] In an exemplary embodiment, the control module 54 is configured to perform traffic control on the business unit based on the number of queries in the following ways: when the number of queries is greater than or equal to a preset number of queries, perform traffic control on the business unit based on the time node; and / or when the number of queries is less than the preset number of queries, do not limit the traffic of the business unit.

[0085] In an exemplary embodiment, the control module 54 is configured to perform traffic control on the service unit based on the time node in the following manner: if the time node is a stress test time node, not to limit the traffic of the service unit; and / or if the time node is not the stress test time node, to perform traffic control on the service unit based on the CPU utilization.

[0086] In an exemplary embodiment, the control module 54 is configured to perform traffic control on the service unit based on the CPU utilization rate in the following manner: when the time node is a preset time node, determine a preset utilization rate corresponding to the preset time node; and perform traffic control on the service unit based on the relationship between the CPU utilization rate and the preset utilization rate.

[0087] Optionally, when the preset time node is an activity day node, a first preset utilization rate corresponding to the activity day node is determined; when the CPU utilization rate is greater than or equal to the first preset utilization rate, the service unit is rate-limited; when the CPU utilization rate is less than the first preset utilization rate, the memory usage of the service unit is determined; when the memory usage indicates that the amount of memory occupied by the service unit on the target device is greater than or equal to a second size, the service unit is rate-limited; when the memory usage indicates that the amount of memory occupied by the service unit on the target device is less than the second size, the service unit is not rate-limited.

[0088] Optionally, the first preset has a utilization rate of 99%, and the second size is 4G.

[0089] Optionally, when the preset time node is a non-active day node, a second preset utilization rate corresponding to the non-active day node is determined; when the CPU utilization rate is greater than or equal to the second preset utilization rate, the service unit is rate-limited; when the CPU utilization rate is less than the first preset utilization rate, the memory usage of the service unit is determined; when the memory usage indicates that the amount of memory occupied by the service unit on the target device is greater than or equal to a third size, the service unit is rate-limited; when the memory usage indicates that the amount of memory occupied by the service unit on the target device is less than the second size, the service unit is not rate-limited.

[0090] In an exemplary embodiment, the acquisition module 52 is further configured to acquire the traffic control rules from the configuration center before acquiring the N parameter values ​​from the parameter value set, provided that the traffic control rules have been updated in the configuration center; wherein the traffic control rules are used to instruct the acquisition of the N parameter values ​​from the parameter value set and to perform traffic control on the service unit based on the N parameter values.

[0091] Embodiments of this application also provide a computer-readable storage medium comprising a stored program configured to execute the above-described flow control method at runtime.

[0092] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0093] S1, obtain N parameter values ​​from the parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by the business unit in each time unit, the response time of the business unit, the CPU utilization rate of the target device running the business unit, the memory usage of the business unit, and the time node when the target device runs the business unit; N is an integer greater than or equal to 2;

[0094] S2, perform traffic control on the service unit based on the N parameter values.

[0095] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0096] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0097] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described flow control method via the computer program.

[0098] Optionally, in this embodiment, the electronic device can be configured to perform the following steps via a computer program:

[0099] S1, obtain N parameter values ​​from the parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by the business unit in each time unit, the response time of the business unit, the CPU utilization rate of the target device running the business unit, the memory usage of the business unit, and the time node when the target device runs the business unit; N is an integer greater than or equal to 2;

[0100] S2, perform traffic control on the service unit based on the N parameter values.

[0101] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0102] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program, which, when executed by a processor, performs the above-described flow control method.

[0103] Optionally, in this embodiment, the above-mentioned computer program product can be configured to perform the following steps via a computer program:

[0104] S1, obtain N parameter values ​​from the parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by the business unit in each time unit, the response time of the business unit, the CPU utilization rate of the target device running the business unit, the memory usage of the business unit, and the time node when the target device runs the business unit; N is an integer greater than or equal to 2;

[0105] S2, perform traffic control on the service unit based on the N parameter values.

[0106] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0107] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0108] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A flow control method, characterized in that, include: Obtain N parameter values ​​from a parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by the business unit per time unit, the response time of the business unit, the CPU utilization of the target device running the business unit, the memory usage of the business unit, and the time node at which the target device runs the business unit; N is an integer greater than or equal to 2; perform flow control on the business unit based on the N parameter values; The step of performing traffic control on the service unit based on the N parameter values ​​includes: If the response time is greater than or equal to the first response time, traffic control is performed on the service unit based on the CPU utilization. If the response time is greater than or equal to the second response time and less than the first response time, traffic control is performed on the business unit based on the number of queries. Before obtaining N parameter values ​​from the parameter value set, the method further includes: If the traffic control rules are updated in the configuration center, the traffic control rules are retrieved from the configuration center. The traffic control rule is used to instruct the acquisition of the N parameter values ​​from the parameter value set, and to perform traffic control on the service unit based on the N parameter values; The step of controlling the traffic of the service unit based on the CPU utilization rate further includes: If the CPU utilization rate is less than the first utilization rate, traffic control is performed on the service unit based on the memory usage. If the CPU utilization rate is greater than or equal to the first utilization rate, traffic control is performed on the service unit according to the time node.

2. The flow control method according to claim 1, characterized in that, Traffic control of the business unit based on the number of queries includes: If the number of queries is greater than or equal to the preset number of queries, traffic control is applied to the business unit based on the time point; and / or If the number of queries is less than the preset number of queries, no rate limiting will be applied to the business unit.

3. The flow control method according to claim 2, characterized in that, Traffic control of the service unit based on the time node includes: If the specified time point is a stress test time point, no rate limiting will be applied to the service unit; and / or If the specified time point is not the same as the stress test time point, traffic control is applied to the service unit based on the CPU utilization.

4. The flow control method according to claim 3, characterized in that, Traffic control of the service unit based on the CPU utilization includes: If the time node is a preset time node, determine the preset utilization rate corresponding to the preset time node; Traffic control is performed on the service unit based on the relationship between the CPU utilization rate and the preset utilization rate.

5. A flow control device, characterized in that, include: The acquisition module is used to acquire N parameter values ​​from a parameter value set, wherein the parameter value set includes at least two of the following: the number of queries processed by the business unit in each time unit, the response time of the business unit, the CPU utilization rate of the target device running the business unit, the memory usage of the business unit, and the time node in which the target device runs the business unit; N is an integer greater than or equal to 2; The control module is used to perform flow control on the service unit based on the N parameter values; The control module is further configured to: If the response time is greater than or equal to the first response time, traffic control is performed on the service unit based on the CPU utilization. If the response time is greater than or equal to the second response time and less than the first response time, traffic control is performed on the business unit based on the number of queries. The acquisition module is further configured to: Upon detecting an update to the traffic control rules in the configuration center, the traffic control rules are retrieved from the configuration center; wherein, the traffic control rules are used to instruct the retrieval of the N parameter values ​​from the parameter value set, and to perform traffic control on the business unit based on the N parameter values; The control module is further configured to: If the CPU utilization rate is less than the first utilization rate, traffic control is performed on the service unit based on the memory usage. If the CPU utilization rate is greater than or equal to the first utilization rate, traffic control is performed on the service unit according to the time node.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 4.

7. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 4 through the computer program.

Citation Information

Patent Citations

  • Flow control method and device, computer equipment and storage medium

    CN110996352A

  • Multi-dimensional access flow control system

    CN113765821A