Traffic control method and device, electronic equipment, medium and program product
By combining current and historical business request volumes and reasonably limiting upstream nodes, the problem of low accuracy in rate limiting in distributed systems is solved, and the utilization rate of traffic resources is improved.
Patent Information
- Application Number
- CN202111650835.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2041-12-30
AI Technical Summary
In existing technologies, the accuracy of rate limiting methods for distributed systems is low, resulting in low utilization of traffic resources.
By receiving the business request volume and historical request volume from upstream business nodes, the request volume growth ratio or growth amount can be determined, and the upstream business nodes can be reasonably rate-limited, including setting the probability of rejecting requests and limiting the traffic.
It improves the accuracy of rate limiting, makes full use of the traffic resources of current business nodes, avoids unnecessary rate limiting, and improves resource utilization.
Smart Images

Figure CN116418751B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of Internet technology, and in particular to a flow control method, apparatus, electronic device, medium, and program product. Background Technology
[0002] With the development of the internet, business traffic is increasing daily. Currently, distributed systems can provide better services to users. Distributed systems typically consist of multiple interdependent modules, with one module usually depended on by several other modules. To ensure module stability, rate limiting is usually implemented based on the module's capacity.
[0003] In related technologies, when the access of multiple modules exceeds their own capacity, rate limiting is applied to each module based on the rate limiting quota allocated to each module. However, this method has low accuracy in rate limiting and reduces the utilization rate of traffic resources. Summary of the Invention
[0004] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a flow control method, apparatus, electronic device, medium, and program product.
[0005] According to a first aspect of this disclosure, a flow control method is provided, applied to a current service node, the method comprising:
[0006] Receive service requests sent by multiple upstream service nodes of the current service node, and determine the first service request volume corresponding to each of the multiple upstream service nodes at the current time;
[0007] If the business request is determined to have failed based on the first business request volume, the historical business request volumes corresponding to the plurality of upstream business nodes are determined respectively.
[0008] Rate limiting is applied to the multiple upstream business nodes based on the first business request volume and the historical business request volume corresponding to each of the multiple upstream business nodes.
[0009] Optionally, the step of rate limiting the multiple upstream service nodes based on the first service request volume corresponding to each of the multiple upstream service nodes and the historical service request volume includes:
[0010] Based on the first service request volume corresponding to the multiple upstream service nodes and the historical service request volume, determine the request volume growth ratio corresponding to the multiple upstream service nodes.
[0011] Based on the requested volume growth rate, rate limiting is applied to the multiple upstream service nodes; or...
[0012] Based on the first service request volume corresponding to the multiple upstream service nodes and the historical service request volume, determine the request volume growth amount corresponding to the multiple upstream service nodes.
[0013] Based on the increase in the request volume, rate limiting is applied to the multiple upstream business nodes.
[0014] Optionally, the step of rate limiting the multiple upstream service nodes based on the request volume growth ratio or the request volume growth amount includes:
[0015] Based on the request volume growth ratio or the request volume growth amount, determine the probability of rejecting the service requests sent by the multiple upstream service nodes;
[0016] Based on the probability, rate limiting is applied to the multiple upstream service nodes.
[0017] Optionally, the step of performing rate limiting on the plurality of upstream service nodes based on the probability includes:
[0018] Determine the difference between the sum of the first service request volumes and the service request capacity of the current service node;
[0019] Based on the difference and the probability, the traffic limit for the upstream service node is determined, and the traffic limit is applied to the upstream service node according to the traffic limit.
[0020] Optionally, the method further includes:
[0021] If the moment when the rate limiting is applied to the multiple upstream business nodes is the first moment, and the moment after a preset time period is the second moment, then the second business request volume corresponding to the multiple upstream business nodes at the second moment is determined.
[0022] If the sum of the second service request volumes corresponding to the multiple upstream service nodes is less than the preset request volume, then the traffic restriction on the upstream service nodes is lifted, wherein the preset request volume is less than the service request capacity of the current service node.
[0023] Optionally, determining the historical service request volume corresponding to each of the plurality of upstream service nodes includes:
[0024] Determine the historical service request volume corresponding to the multiple upstream service nodes at the first historical moment; wherein the first historical moment and the current moment correspond to the same moment on different dates;
[0025] For a single upstream service node, the first historical service request volume corresponding to the upstream service node at the first historical moment is determined as the historical service request volume corresponding to the upstream service node; or,
[0026] Determine the second historical service request volume corresponding to the multiple upstream service nodes at multiple second historical moments;
[0027] For a single upstream service node, the average of multiple second historical service request volumes is determined as the historical service request volume corresponding to the upstream service node.
[0028] According to a second aspect of this disclosure, a flow control device is provided for application at a current service node, the device comprising:
[0029] The first service request volume determination module is used to receive service requests sent by multiple upstream service nodes of the current service node and determine the first service request volume corresponding to the multiple upstream service nodes at the current time.
[0030] The historical service request volume determination module is used to determine the historical service request volume corresponding to the plurality of upstream service nodes respectively if the service request is determined to have failed based on the first service request volume.
[0031] The rate limiting module is used to perform rate limiting on the multiple upstream business nodes based on the first business request volume corresponding to each of the multiple upstream business nodes and the historical business request volume.
[0032] Optionally, the rate limiting module is specifically used to determine the request volume growth ratio corresponding to each of the multiple upstream business nodes based on the first business request volume corresponding to each of the multiple upstream business nodes and the historical business request volume; and to perform rate limiting on the multiple upstream business nodes based on the request volume growth ratio; or,
[0033] Based on the first service request volume corresponding to each of the multiple upstream service nodes and the historical service request volume, the request volume growth amount corresponding to each of the multiple upstream service nodes is determined; based on the request volume growth amount, the multiple upstream service nodes are subjected to rate limiting.
[0034] Optionally, the rate limiting module is specifically used to perform rate limiting on the multiple upstream business nodes based on the request volume growth ratio or the request volume growth amount through the following steps:
[0035] Based on the request volume growth ratio or the request volume growth amount, determine the probability of rejecting the service requests sent by the multiple upstream service nodes;
[0036] Based on the probability, rate limiting is applied to the multiple upstream service nodes.
[0037] Optionally, the rate limiting module is specifically used to perform rate limiting on the multiple upstream service nodes according to the probability through the following steps:
[0038] Determine the difference between the sum of the first service request volumes and the service request capacity of the current service node;
[0039] Based on the difference and the probability, the traffic limit for the upstream service node is determined, and the traffic limit is applied to the upstream service node according to the traffic limit.
[0040] Optionally, the flow control device further includes:
[0041] The second service request volume determination module is used to determine the second service request volume corresponding to the multiple upstream service nodes at the second time if the time when the rate limiting processing of the multiple upstream service nodes is the first time and the time after a preset time period is the second time.
[0042] The rate limiting module is further configured to release the traffic restriction on the upstream business nodes if the sum of the second business request volumes corresponding to the plurality of upstream business nodes is less than a preset request volume, wherein the preset request volume is less than the business request capacity of the current business node.
[0043] Optionally, the historical service request volume determination module is specifically used to determine the historical service request volume corresponding to the multiple upstream service nodes at a first historical moment if the service request is determined to have failed based on multiple first service request volumes; wherein the first historical moment and the current moment correspond to the same moment on different dates; for a single upstream service node, the first historical service request volume corresponding to the upstream service node at the first historical moment is determined as the historical service request volume corresponding to the upstream service node; or,
[0044] Determine the second historical service request volume corresponding to the multiple upstream service nodes at multiple second historical moments; for a single upstream service node, determine the average value of the multiple second historical service request volumes as the historical service request volume corresponding to the upstream service node.
[0045] According to a third aspect of this disclosure, an electronic device is provided, comprising: a processor configured to execute a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the method described in the first aspect.
[0046] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0047] According to a fifth aspect of this disclosure, a computer program product is provided that, when run on a computer, causes the computer to perform the method described in the first aspect.
[0048] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0049] When multiple upstream business nodes depend on the current business node, the current business node can determine the first business request volume of each upstream business node at the current moment. If the business request fails based on the first business request volume, the historical business request volume corresponding to each upstream business node is determined. Based on the first business request volume and historical business request volume corresponding to each upstream business node, rate limiting is applied to multiple upstream business nodes. This disclosure applies rate limiting to each upstream business node only when the business request fails based on the first business request volume. Compared to the prior art of allocating rate limiting quotas to each upstream business node, even if the business request volume of some upstream business nodes increases significantly, if the business request volume of other upstream business nodes decreases, rate limiting can be avoided, thus preventing business request failures and fully utilizing the traffic resources of the current business node, improving resource utilization. Simultaneously, rate limiting is performed with reference to the historical business request volume and the first business request volume at the current moment for each upstream business node. For example, rate limiting can be based on the growth of business requests to each upstream business node, making rate limiting more reasonable and improving accuracy. Attached Figure Description
[0050] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0051] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying 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.
[0052] Figure 1 A schematic diagram of a system architecture for an exemplary application environment that can be applied to the flow control method of the embodiments of this disclosure is shown;
[0053] Figure 2 This is a flowchart of a flow control method in an embodiment of this disclosure;
[0054] Figure 3 This is a schematic diagram of flow control in an embodiment of this disclosure;
[0055] Figure 4 This is another flowchart of the flow control method in the embodiments of this disclosure;
[0056] Figure 5 This is a schematic diagram of the flow control device in one embodiment of the present disclosure;
[0057] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. Detailed Implementation
[0058] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0059] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0060] Figure 1 A schematic diagram of a system architecture for an exemplary application environment that can be applied to the flow control method of embodiments of this disclosure is shown.
[0061] like Figure 1 As shown, system architecture 100 may include multiple upstream service nodes 101, 102, and 103, a network 104, and a current service node 105. Network 104 serves as the medium for providing communication links between upstream service nodes 101, 102, 103, and 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables. Upstream service nodes 101, 102, 103, and 105 can be service nodes in a distributed system. Upstream service nodes 101, 102, and 103 depend on and are located upstream of the current service node 105; therefore, they can be called upstream service nodes. It should be understood that... Figure 1 The number of upstream business nodes shown is merely illustrative. Depending on implementation needs, there can be any number of upstream business nodes.
[0062] Upstream service nodes 101, 102, and 103 can send service requests to the current service node 105 according to service needs. In related technologies, a first rate-limiting quota, a second rate-limiting quota, and a third rate-limiting quota can be allocated to upstream service nodes 101, 102, and 103 respectively. If the number of service requests sent by upstream service node 101 exceeds the first rate-limiting quota, rate-limiting is applied to upstream service node 101. Similarly, if the number of service requests sent by upstream service node 102 exceeds the second rate-limiting quota, rate-limiting is applied to upstream service node 102; and if the number of service requests sent by upstream service node 103 exceeds the third rate-limiting quota, rate-limiting is applied to upstream service node 103.
[0063] In this embodiment, when the total number of service requests issued by upstream service nodes 101, 102, and 103 (i.e., the number of service requests received by the current service node 105) is within the capacity of the current service node 105, each service request can be responded to. When the total number of service requests received by the current service node 105 exceeds its capacity, the rate limiting method of this embodiment can be used to rate limit upstream service nodes 101, 102, and 103 to improve the utilization rate of traffic resources of the current service node 105 and improve the accuracy of rate limiting. The traffic control method provided in this embodiment is generally executed by the current service node 105, and correspondingly, a traffic control device can be installed in the current service node 105.
[0064] The flow control method of this disclosure will be described first.
[0065] See Figure 2 , Figure 2 This is a flowchart of a flow control method in an embodiment of this disclosure, applied to the current business node, and may include the following steps:
[0066] Step S210: Receive service requests sent by multiple upstream service nodes of the current service node, and determine the first service request volume corresponding to each of the multiple upstream service nodes at the current time.
[0067] The current business node can be a business node in a distributed system that is depended upon by multiple other business nodes. The other business nodes in the distributed system that depend on the current business node are the upstream business nodes of the current business node. There can be multiple upstream business nodes, and different upstream business nodes can send business requests to the current business node according to their business needs.
[0068] Understandably, when the number of service requests sent by multiple upstream service nodes is large—that is, when the sum of the service requests sent by multiple upstream service nodes exceeds the service request capacity of the current service node, or in other words, when the number of service requests received by the current service node exceeds its service request capacity—the current service node will be unable to process all the service requests from multiple upstream service nodes, resulting in service request failures. Therefore, the current service node can determine the first service request volume corresponding to each of the multiple upstream service nodes at the current moment, and use this first service request volume to determine whether it exceeds its own capacity. The first service request volume may include parameters such as the queries per second.
[0069] Step S220: If the business request fails based on the first business request volume, determine the historical business request volume corresponding to each of the multiple upstream business nodes.
[0070] In this embodiment, if the sum of the first service request volumes of multiple upstream service nodes is less than or equal to the service request capacity of the current service node, it indicates that the current service request is within the capacity of the current service node and can be processed directly. If the sum of the first service request volumes of multiple upstream service nodes is greater than the service request capacity of the current service node, it indicates that the current service request has exceeded the capacity of the current service node, and the service request will fail. In this case, rate limiting can be applied to the upstream service nodes. The service request capacity is the maximum number of service requests that the current service node can handle, and it can be obtained through load testing.
[0071] See Figure 3 , Figure 3 This is a schematic diagram of flow control in an embodiment of this disclosure. Both upstream service node A and upstream service node B send service requests to the current service node C. Assume that the current service node C can handle a total query rate of 100,000 queries per second, while the current query rate of upstream service node A is 50,000 queries per second and the query rate of upstream service node B is 80,000 queries per second. The sum of these two exceeds the capacity of the current service node C, so the current service node C will implement flow limiting for upstream service nodes A and B.
[0072] To achieve more reasonable and accurate rate limiting for various upstream service nodes, this disclosure identifies the historical service request volume corresponding to multiple upstream service nodes and combines this historical service request volume with rate limiting. Since the service request volume corresponding to a user accessing the same service at different times is usually different, in one optional implementation, the historical service request volume corresponding to multiple upstream service nodes at a first historical moment can be identified. For a single upstream service node, the first historical service request volume corresponding to that upstream service node at the first historical moment is determined as the historical service request volume corresponding to that upstream service node. The first historical moment and the current moment can correspond to the same moment on different dates. For example, if the current moment is 20:00, the first historical moment could be 20:00 of the previous day. This results in a more accurate and reliable historical service request volume compared to other moments (e.g., 6:00 of the current day, 23:00 of the previous day, etc.). Consequently, the accuracy of rate limiting can be improved.
[0073] Alternatively, the second historical service request volume corresponding to multiple upstream service nodes at multiple second historical moments can be determined. For a single upstream service node, the average of the multiple second historical service request volumes is determined as the historical service request volume corresponding to the upstream service node. The second historical moment can be any historical moment, or it can be the same moment on a different date than the current moment. For example, if the current moment is 20:00, the second historical moment could be 20:00 of the previous day, two days ago, or three days ago. By calculating the average of the second historical service request volumes corresponding to the three second historical moments and using this average as the historical service request volume corresponding to the upstream service node, the accuracy of determining the historical service request volume can be further improved.
[0074] Step S230: Based on the first service request volume and historical service request volume corresponding to each of the multiple upstream service nodes, rate limiting is applied to the multiple upstream service nodes.
[0075] After obtaining the current first service request volume and the historical service request volume of each upstream service node, the service request situation of each upstream service node can be analyzed to determine how to implement rate limiting for multiple upstream service nodes. For example, when the service request volume of an upstream service node increases significantly, its service requests can be rejected. When the service request volume of an upstream service node increases slightly or is negative, its service requests can be left unrejected. Of course, when rate limiting multiple upstream service nodes, the importance of each upstream service node can also be considered to further improve the accuracy of rate limiting. For example, if upstream service node A is relatively important, and the remaining upstream service nodes are relatively less important, even if the service request volume of upstream service node A increases significantly, rate limiting can be implemented for the remaining upstream service nodes, but not for upstream service node A, or only minimal rate limiting can be implemented for upstream service node A.
[0076] The traffic control method of this disclosure, when multiple upstream service nodes depend on the current service node, allows the current service node to determine the first service request volume of each upstream service node at the current moment. If a service request failure is determined based on multiple first service request volumes, the historical service request volume corresponding to each upstream service node is determined, and rate limiting is applied to multiple upstream service nodes based on the first service request volume and the historical service request volume. This disclosure applies rate limiting to each upstream service node only when a service request failure is determined based on the first service request volume. Compared to the prior art of allocating rate limiting quotas to each upstream service node, even if the service request volume of some upstream service nodes increases significantly, if the service request volume of other upstream service nodes decreases, rate limiting can be avoided, thus preventing service request failures and fully utilizing the traffic resources of the current service node to improve resource utilization. Simultaneously, rate limiting is performed by referring to the historical service request volume and the first service request volume at the current moment for each upstream service node. For example, rate limiting can be performed based on the growth of service requests to each upstream service node, making rate limiting more reasonable and improving the accuracy of rate limiting.
[0077] See Figure 4 , Figure 4 This is another flowchart of the flow control method in this disclosure, applied to the current business node, and may include the following steps:
[0078] Step S410: Receive service requests sent by multiple upstream service nodes of the current service node, and determine the first service request volume corresponding to each of the multiple upstream service nodes at the current time.
[0079] Step S420: If the business request fails based on the first business request volume, determine the historical business request volume corresponding to each of the multiple upstream business nodes.
[0080] Steps S410 to S420 above and Figure 2 Steps S210 to S220 are the same in the embodiment; see details below. Figure 2 The descriptions in the embodiments are sufficient and will not be repeated here.
[0081] Step S430: Based on the first service request volume and historical service request volume corresponding to each of the multiple upstream service nodes, perform rate limiting on the multiple upstream service nodes.
[0082] In this embodiment of the disclosure, by determining the first service request volume of each upstream service node at the current moment and the historical service request volume at historical moments, the service growth of each upstream service node can be analyzed, and rate limiting can be performed on multiple upstream service nodes according to the service growth.
[0083] Since the volume of service requests from different upstream service nodes may vary significantly, and the growth rate of these requests may also differ considerably, rate limiting can be applied fairly and reasonably to the service requests of each upstream service node based on the request growth ratio. In one optional implementation, the request growth ratio for each upstream service node can be determined based on its initial and historical service request volumes, and rate limiting can then be applied to the upstream service nodes according to this ratio.
[0084] For a single upstream business node, the ratio of the difference between the first business request volume and the historical business request volume to the first business request volume can be determined as the request volume growth ratio. The larger the request volume growth ratio for an upstream business node, the more significant the increase in business requests for that upstream business node.
[0085] Optionally, after determining the request volume growth ratio, the probability of rejecting business requests from multiple upstream business nodes can be determined based on the request volume growth ratio, and rate limiting can be applied to these upstream business nodes accordingly. For a single upstream business node, the probability of rejecting a business request from that upstream business node can be determined as the ratio of its corresponding request volume growth ratio to the sum of the request volume growth ratios of all upstream business nodes. It is understandable that a larger request volume growth ratio corresponds to a larger probability.
[0086] For example, Figure 3As shown, if the service request volume of upstream service node A and upstream service node B are on different orders of magnitude, by determining the growth ratio of the request volume of upstream service node A and upstream service node B respectively, and determining the probability of rejecting the service requests sent by upstream service node A and upstream service node B based on the growth ratio of the request volume, the difference in service volume between upstream service node A and upstream service node B can be fully considered, thereby enabling more fair rate limiting for each upstream service node.
[0087] In this embodiment, rate limiting can be applied directly to upstream service nodes based on the probability. For example, if the probability is less than or equal to a preset value (e.g., 0.2, including negative values), no rate limiting is applied to the upstream service node corresponding to that probability. If the probability is greater than the preset value, rate limiting is applied to the upstream service node corresponding to that probability.
[0088] In addition, rate limiting can be implemented more reasonably for each upstream business node. Specifically, the difference between the sum of the first number of business requests and the business request capacity of the current business node can be determined. Based on this difference and probability, the rate limit for the upstream business node can be determined, and rate limiting can be applied to the upstream business node accordingly. Here, rate limiting refers to the restricted traffic, that is, the amount of business requests rejected, which is a different concept from the aforementioned rate limiting quota.
[0089] For example, the difference can be directly multiplied by the probability corresponding to each upstream service node to obtain the traffic limit for each upstream service node. Alternatively, weights can be pre-assigned to each upstream service node, and then the difference can be multiplied by the probability, followed by multiplication by the assigned weights to obtain the traffic limit for each upstream service node. Of course, the sum of the traffic limits for each upstream service node must be greater than or equal to the difference.
[0090] In another optional implementation, the request volume growth rate corresponding to each of the multiple upstream business nodes can be determined based on the first and historical service request volumes. Rate limiting can then be applied to these upstream business nodes based on the request volume growth rate. For example, the request volume growth rates can be sorted in descending order, and the upstream business nodes corresponding to the top N request volume growth rates can be rate-limited, while the remaining upstream business nodes are not rate-limited. N can be less than the total number of upstream business nodes. Alternatively, rate limiting can be applied to a single upstream business node if its request volume growth rate exceeds a certain threshold. Using the request volume growth rate can also improve the accuracy of rate limiting to some extent.
[0091] Similarly, the probability of rejecting business requests from multiple upstream business nodes can be determined based on the increase in request volume, and rate limiting can be applied to these upstream business nodes based on this probability. This probability can be positively correlated with the increase in request volume; that is, the greater the increase in request volume, the more traffic can be limited.
[0092] It should be noted that, in addition to determining the traffic limits for each upstream business node using the methods described above, traffic limits can also be pre-set for each upstream business node. For example, the larger the initial and historical service request volumes of an upstream business node, the more important that upstream business node is, and the smaller its traffic limit can be. Furthermore, the traffic limit can vary with the difference between the sum of the initial service request volumes and the current service node's service request capacity. The larger this difference, the more service requests each upstream business node currently receives, and correspondingly, the larger its traffic limit can be.
[0093] Step S440: If the moment when rate limiting is applied to multiple upstream business nodes is the first moment, and the moment after a preset time period is the second moment, determine the second business request volume corresponding to each of the multiple upstream business nodes at the second moment.
[0094] It should be noted that since business requests are constantly changing over time, the current total volume of business requests may exceed the system's capacity, but the total volume of business requests after a certain period may fall within its capacity. Therefore, after a preset time period, the second volume of business requests corresponding to multiple upstream business nodes at the second moment can be determined. Based on the first volume of business requests, it can be determined whether to lift the traffic restrictions on the upstream business nodes. The preset time period can be a pre-set time period based on experience, such as 5 minutes, 10 minutes, etc., and is not limited here.
[0095] Step S450: If the sum of the second service request volumes corresponding to multiple upstream service nodes is less than the preset request volume, then the traffic restriction on the upstream service nodes is lifted.
[0096] If the sum of the second set of service requests is less than the preset request volume, and the preset request volume is less than the service request capacity of the current service node, it indicates that after a preset time period, the reduction in service requests from the upstream service node is significant. Therefore, the traffic restriction on the upstream service node can be lifted to improve the utilization rate of the current service node's traffic resources. The preset request volume can be 90% of the service request capacity, etc.
[0097] The traffic control method of this disclosure does not require allocating traffic limiting quotas to each upstream service node. Instead, it performs traffic limiting by referencing the historical service request volume of each upstream service node and the first service request volume at the current moment. Traffic limiting can be based on the growth rate or increase in service requests of each upstream service node. For example, the probability of rejecting service requests from multiple upstream service nodes can be determined based on the request volume growth rate, and traffic limiting can be applied to multiple upstream service nodes based on this probability. This disclosure provides a more reasonable approach to traffic limiting for each upstream service node, improving its accuracy. Furthermore, after a preset time period, the second service request volume corresponding to each of the multiple upstream service nodes can be further determined. If the sum of the second service request volumes is less than a preset request volume, the traffic restriction on the upstream service nodes can be lifted, thereby improving the utilization rate of the current service node's traffic resources.
[0098] Corresponding to the above method embodiments, this disclosure also provides a flow control device applied to the current service node, see [link to relevant documentation]. Figure 5 The flow control device 500 includes:
[0099] The first service request volume determination module 510 is used to receive service requests sent by multiple upstream service nodes of the current service node and determine the first service request volume corresponding to the multiple upstream service nodes at the current time.
[0100] The historical business request volume determination module 520 is used to determine the historical business request volume corresponding to multiple upstream business nodes if the business request determination based on multiple first business request volumes fails.
[0101] The rate limiting module 530 is used to perform rate limiting on multiple upstream business nodes based on the first business request volume and historical business request volume corresponding to each upstream business node.
[0102] Optionally, the rate limiting module 530 is specifically used to determine the request volume growth ratio for each of the multiple upstream business nodes based on the first business request volume and historical business request volume for each of the multiple upstream business nodes; and to perform rate limiting on the multiple upstream business nodes based on the request volume growth ratio; or,
[0103] Based on the first business request volume and historical business request volume corresponding to each of the multiple upstream business nodes, determine the request volume growth for each of the multiple upstream business nodes; and perform rate limiting on the multiple upstream business nodes based on the request volume growth.
[0104] Optionally, the rate limiting module 530 is specifically used to perform rate limiting on multiple upstream business nodes based on the request volume growth ratio or request volume growth amount through the following steps:
[0105] Based on the request volume growth ratio or request volume growth amount, determine the probability of rejecting business requests sent by multiple upstream business nodes;
[0106] Based on probability, rate limiting is applied to multiple upstream business nodes.
[0107] Optionally, the rate limiting module 530 is specifically used to perform rate limiting on multiple upstream service nodes based on probability through the following steps:
[0108] Determine the difference between the sum of the first number of service requests and the service request capacity of the current service node;
[0109] Based on the difference and probability, determine the traffic limit for upstream business nodes, and then apply the traffic limit to the upstream business nodes.
[0110] Optionally, the flow control device 500 also includes:
[0111] The second service request volume determination module is used to determine the second service request volume corresponding to the multiple upstream service nodes at the second time if the time when rate limiting is applied to multiple upstream service nodes is the first time and the time after a preset time period is the second time.
[0112] The rate limiting module 530 is also used to lift the traffic limit on the upstream business nodes if the sum of the second business request volume corresponding to multiple upstream business nodes is less than the preset request volume, wherein the preset request volume is less than the business request capacity of the current business node.
[0113] Optionally, the historical service request volume determination module 520 is specifically used to determine the historical service request volume corresponding to multiple upstream service nodes at the first historical moment if the determination of service requests based on multiple first service request volumes fails; wherein, the first historical moment and the current moment correspond to the same moment on different dates; for a single upstream service node, the first historical service request volume corresponding to the upstream service node at the first historical moment is determined as the historical service request volume corresponding to the upstream service node; or,
[0114] Determine the second historical service request volume corresponding to multiple upstream service nodes at multiple second historical moments; for a single upstream service node, determine the average of the multiple second historical service request volumes as the historical service request volume corresponding to the upstream service node.
[0115] The specific details of each module or unit in the above-mentioned device have been described in detail in the corresponding methods, so they will not be repeated here.
[0116] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0117] In an exemplary embodiment of this disclosure, an electronic device is also provided, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the flow control method described in this exemplary embodiment.
[0118] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. It should be noted that... Figure 6 The electronic device 600 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0119] like Figure 6 As shown, the electronic device 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. The RAM 603 also stores various programs and data required for system operation. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0120] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a local area network (LAN) card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.
[0121] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit 601, it performs various functions defined in the apparatus of this disclosure.
[0122] In this embodiment of the disclosure, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the above-described flow control method.
[0123] It should be noted that the computer-readable storage medium disclosed herein can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, radio frequency, etc., or any suitable combination thereof.
[0124] In this embodiment of the disclosure, a computer program product is also provided, which, when run on a computer, causes the computer to execute the above-described flow control method.
[0125] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0126] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A flow control method, characterized by, The method applied to a current service node comprises: receiving service requests sent by a plurality of upstream service nodes of the current service node, determining first service request quantities respectively corresponding to the plurality of upstream service nodes at a current time; if it is determined that the service request fails based on the first service request quantities, determining historical service request quantities respectively corresponding to the plurality of upstream service nodes; determining request quantity growth ratios or request quantity growth amounts of the plurality of upstream service nodes respectively according to the first service request quantities respectively corresponding to the plurality of upstream service nodes and the historical service request quantities; determining a probability of rejecting service requests sent by the plurality of upstream service nodes according to the request quantity growth ratios or the request quantity growth amounts; performing flow limiting processing on the plurality of upstream service nodes according to the probability.
2. The method of claim 1, wherein, The performing flow limiting processing on the plurality of upstream service nodes according to the probability comprises: determining a difference between a sum of the first service request quantities and a service request bearing capacity of the current service node; determining a flow limit of the upstream service node according to the difference and the probability, and performing flow limiting on the upstream service node according to the flow limit.
3. The method of claim 1, wherein, The method further comprises: if a time at which flow limiting processing is performed on the plurality of upstream service nodes is a first time, and a time after a preset time period is a second time, determining second service request quantities respectively corresponding to the plurality of upstream service nodes at the second time; if a sum of the second service request quantities respectively corresponding to the plurality of upstream service nodes is less than a preset request quantity, releasing the flow limit of the upstream service node, wherein the preset request quantity is less than the service request bearing capacity of the current service node.
4. The method of claim 1, wherein, The determining the historical service request quantities respectively corresponding to the plurality of upstream service nodes comprises: determining historical service request quantities respectively corresponding to the plurality of upstream service nodes at a first historical time; wherein the first historical time corresponds to a same time of a different date from the current time; for a single upstream service node, determining a first historical service request quantity corresponding to the upstream service node at the first historical time as the historical service request quantity corresponding to the upstream service node; or determining second historical service request quantities respectively corresponding to the plurality of upstream service nodes at a plurality of second historical times; for a single upstream service node, determining an average of the plurality of second historical service request quantities as the historical service request quantity corresponding to the upstream service node.
5. A flow control device, characterized by The device applied to a current service node comprises: a first service request quantity determination module configured to receive service requests sent by a plurality of upstream service nodes of the current service node, and determine first service request quantities respectively corresponding to the plurality of upstream service nodes at a current time; a historical service request quantity determination module configured to, if it is determined that the service request fails based on the first service request quantities, determine historical service request quantities respectively corresponding to the plurality of upstream service nodes; The flow limiting processing module is configured to: determine a request quantity growth ratio or a request quantity growth amount of each of the plurality of upstream service nodes according to the first service request quantity of each of the plurality of upstream service nodes and the historical service request quantity; determine a probability of rejecting service requests sent by the plurality of upstream service nodes according to the request quantity growth ratio or the request quantity growth amount; and perform flow limiting processing on the plurality of upstream service nodes according to the probability.
6. An electronic device, comprising: The computer program is configured to, when executed by the processor, implement the flow control method according to any one of claims 1-4. The computer program is configured to, when executed by the processor, implement the flow control method according to any one of claims 1-4.
7. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program product, when running on the computer, causes the computer to perform the flow control method according to any one of claims 1-4.
8. A computer program product, characterised in that,
Citation Information
Patent Citations
Traffic prediction method and device
CN110769454A
Access request processing method and device and electronic equipment
CN110808914A