Distributed system and flow control method, device, equipment and medium

By adopting the distributed system's traffic statistics method and current limiting policy generation mechanism in the cloud computing system, the problem of inaccurate global traffic statistics and system instability under high business volumes is solved, and efficient traffic control is achieved.

CN117240855BActive Publication Date: 2025-01-21BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311055675.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-21
Publication Date
2025-01-21
Estimated Expiration
2043-08-21

AI Technical Summary

Technical Problem

When the prior art deals with high traffic volume, it is difficult to accurately count global traffic, resulting in system instability and lack of effective flow control solutions.

Method used

A distributed system is used to conduct traffic statistics through proxy service clusters, local service clusters and global service clusters, and when the global traffic exceeds the preset threshold, a current limiting policy is generated for traffic control.

Benefits of technology

It achieves accurate global traffic statistics in high business volume scenarios, reduces statistical complexity, and improves system stability through current limiting processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117240855B_ABST
    Figure CN117240855B_ABST
Patent Text Reader

Abstract

The present disclosure provides a distributed system and a flow control method, device, equipment and storage medium, which relate to the field of artificial intelligence technology, specifically to the technical fields of cloud computing, cloud storage, etc. The distributed system includes: a proxy service cluster, which is used to count the service requests sent by the client to obtain the first flow of the target service; and, based on the flow limiting strategy, the target service is flow limited; a local service cluster, which is used to count the first flow sent by the proxy service cluster in the same deployment area to obtain the second flow of the target service; and, if the flow limiting strategy has been generated, the flow limiting strategy is sent to the proxy service cluster; a global service cluster, which is used to count the second flow sent by the local service cluster to obtain the global flow of the target service, and send the global flow to the local service cluster. The present disclosure can improve system stability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to cloud computing, cloud storage and other technical fields, and in particular to a distributed system and a flow control method, device, equipment and medium. Background Art

[0002] The network disk server provides a common cache service for various business requests. As the business volume increases, some businesses may experience a sudden increase in traffic, affecting other businesses. Therefore, it is necessary to solve the problem of how to improve system stability. Summary of the invention

[0003] The present disclosure provides a distributed system and a flow control method, apparatus, device and medium.

[0004] According to one aspect of the present disclosure, a distributed system is provided, including: a proxy service cluster, used to count the service requests sent by the client to obtain a first flow of the target service; and, if there is a flow limiting strategy for the target service, perform flow limiting processing on the target service based on the flow limiting strategy; a local service cluster, used to count the first flow sent by the proxy service clusters in the same deployment area to obtain a second flow of the target service; and, if the flow limiting strategy has been generated, send the flow limiting strategy to the proxy service cluster, wherein the flow limiting strategy is generated when the global flow of the target service is greater than a preset threshold; a global service cluster, used to count the second flow sent by the local service cluster to obtain the global flow of the target service, and send the global flow to the local service cluster.

[0005] According to another aspect of the present disclosure, a traffic control method is provided, including: receiving a first traffic of a target business sent by a proxy service cluster in the same deployment area, the first traffic being obtained after the proxy service cluster counts the service requests sent by a client; counting the first traffic to obtain a second traffic of the target business, and sending the second traffic to a global service cluster; receiving a global traffic of the target business sent by the global service cluster, the global traffic being obtained after the global service cluster counts the second traffic; if the global traffic is greater than a preset threshold, generating a flow limiting strategy for the target business; and sending the flow limiting strategy to the proxy service cluster so that the proxy service cluster performs flow limiting processing on the target business based on the flow limiting strategy.

[0006] According to another aspect of the present disclosure, a traffic control method is provided, including: receiving a first traffic of a target business sent by a proxy service cluster in the same deployment area, the first traffic being obtained after the proxy service cluster counts the service requests sent by a client; counting the first traffic to obtain a second traffic of the target business, and sending the second traffic to a global service cluster; receiving a global traffic of the target business sent by the global service cluster, the global traffic being obtained after the global service cluster counts the second traffic; if the global traffic is greater than a preset threshold, generating a flow limiting strategy for the target business; and sending the flow limiting strategy to the proxy service cluster so that the proxy service cluster performs flow limiting processing on the target business based on the flow limiting strategy.

[0007] According to another aspect of the present disclosure, a flow control method is provided, including: counting service requests sent by a client to obtain a first flow of a target service; sending the first flow to a local service cluster in the same deployment area, so that the local service cluster counts the first flow to obtain a second flow of the target service, and the second flow is sent by the local service cluster to a global service cluster, so that the global service cluster counts the second flow to obtain a global flow of the target service; receiving a flow limiting strategy for the target service sent by the local service cluster, the flow limiting strategy being generated by the local service cluster when the global flow is greater than a preset threshold; and performing flow limiting processing on the target service based on the flow limiting strategy.

[0008] According to another aspect of the present disclosure, a flow control device is provided, including: a first receiving module, used to receive a first flow of a target service sent by a proxy service cluster in the same deployment area, the first flow is obtained after the proxy service cluster counts the service requests sent by the client; a counting module, used to count the first flow to obtain a second flow of the target service, and send the second flow to a global service cluster; a second receiving module, used to receive the global flow of the target service sent by the global service cluster, the global flow is obtained after the global service cluster counts the second flow; a generating module, used to generate a flow limiting strategy for the target service if the global flow is greater than a preset threshold; a sending module, used to send the flow limiting strategy to the proxy service cluster, so that the proxy service cluster performs flow limiting processing on the target service based on the flow limiting strategy.

[0009] According to another aspect of the present disclosure, a flow control device is provided, including: a receiving module, used to receive a second flow of a target service sent by a local service cluster, the second flow is obtained after the local service cluster counts the first flow, and the first flow is obtained after the proxy service cluster counts the service requests sent by the client; a statistical module, used to count the second flow to obtain the global flow of the target service; a sending module, used to send the global flow to the local service cluster, so that the local service cluster generates a flow limiting strategy for the target service when the global flow is greater than a preset threshold, and the flow limiting strategy is sent by the local service cluster to the proxy service cluster, so that the proxy service cluster performs flow limiting processing on the target service.

[0010] According to another aspect of the present disclosure, a flow control device is provided, including: a statistical module, used to count the service requests sent by the client to obtain a first flow of the target service; a sending module, used to send the first flow to a local service cluster in the same deployment area, so that the local service cluster counts the first flow and obtains a second flow of the target service, and the second flow is sent by the local service cluster to a global service cluster, so that the global service cluster counts the second flow and obtains a global flow of the target service; a receiving module, used to receive a flow limiting strategy for the target service sent by the local service cluster, the flow limiting strategy is generated by the local service cluster when the global flow is greater than a preset threshold; a flow limiting module, used to perform flow limiting processing on the target service based on the flow limiting strategy.

[0011] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method as described in any of the above aspects.

[0012] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods according to any one of the above aspects.

[0013] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the methods described in any one of the above aspects.

[0014] According to the technical solution of the present disclosure, system stability can be improved.

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

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

[0017] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;

[0018] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;

[0019] Figure 3 is a schematic diagram of a global service instance provided according to an embodiment of the present disclosure;

[0020] Figure 4 is a schematic diagram according to a third embodiment of the present disclosure;

[0021] Figure 5 is a schematic diagram according to a fourth embodiment of the present disclosure;

[0022] Figure 6 is a schematic diagram according to a fifth embodiment of the present disclosure;

[0023] Figure 7 is a schematic diagram according to a sixth embodiment of the present disclosure;

[0024] Figure 8 is a schematic diagram according to a seventh embodiment of the present disclosure;

[0025] Fig. 9 is a schematic diagram according to an eighth embodiment of the present disclosure;

[0026] Fig.10 is a schematic diagram of an electronic device used to implement the flow control method of an embodiment of the present disclosure. DETAILED DESCRIPTION

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

[0028] In the related art, a global counting center is usually set up. When each node in the cluster receives a service request, it reports the request amount to the counting center, which then summarizes the request. The counting center is usually selected as a single node.

[0029] Since global traffic is counted by a counting center at a single node, in the case of large traffic volume, the statistics may be incomplete and inaccurate, resulting in inaccurate global traffic counting results. In addition, after completing the statistics of global traffic, the related art lacks a traffic control solution. Therefore, it is difficult to solve the problem of system instability in the related art.

[0030] In order to improve system stability, the present disclosure provides the following embodiments.

[0031] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure. This embodiment provides a distributed system. Figure 1 As shown, the distributed system 100 includes: a proxy service cluster, a local service cluster (tokenserver) and a global service cluster (countserver). The proxy service cluster is represented by 101a-101c, the local service cluster is represented by 102a-102b, and the global service cluster is represented by 103.

[0032] Each cluster includes multiple service instances, which are represented by circles. Multiple service instances can be deployed on the same node, or multiple service instances can be deployed on different nodes, which can be servers, processors, etc.

[0033] A service instance within a proxy service cluster may be referred to as a proxy service instance, a service instance within a local service cluster may be referred to as a local service instance, and a service instance within a global service cluster may be referred to as a global service instance.

[0034] The proxy service cluster is used to count the service requests sent by the client to obtain the first flow of the target service; and if there is a flow limiting strategy for the target service, the target service is flow limited based on the flow limiting strategy;

[0035] A local service cluster, configured to count the first traffic sent by the proxy service cluster in the same deployment area to obtain the second traffic of the target service; and, if the flow limiting strategy has been generated, send the flow limiting strategy to the proxy service cluster, wherein the flow limiting strategy is generated when the global traffic of the target service is greater than a preset threshold;

[0036] The global service cluster is used to count the second traffic sent by the local service cluster to obtain the global traffic of the target service, and send the global traffic to the local service cluster.

[0037] The deployment area can be specifically an Internet Data Center (IDC). Generally speaking, one or more proxy service clusters and a local service cluster can be deployed in an IDC. One or more proxy service clusters in the same IDC communicate and interact with the local service cluster in the IDC; a global service cluster is deployed globally, and local service clusters in different IDCs communicate and interact with the global service cluster.

[0038] In addition, this embodiment takes the first-level local service cluster as an example. It can be understood that the local service cluster can also be set to more levels according to actual needs. For example, each IDC corresponds to a first-level local service cluster, and multiple IDCs can correspond to the same second-level local service cluster.

[0039] In this embodiment, distributed statistics can be achieved by using a cluster approach, so that global traffic can still be accurately obtained in a large business volume scenario; statistics of the first traffic, the second traffic and the global traffic are respectively performed by the proxy service cluster, the local service cluster and the global service cluster, and the statistics can be distributed to different levels, which can further improve the accuracy of the global traffic and reduce the statistical complexity, so that accurate and comprehensive global traffic can still be obtained in a large business volume scenario. In addition, by generating a flow limiting strategy through the local service cluster and sending it to the proxy service cluster for execution, the target business can be flow limited to improve system stability.

[0040] Figure 2 It is a schematic diagram according to the second embodiment of the present disclosure. This embodiment provides the execution process of each service instance and the interaction process between service instances.

[0041] like Figure 2 As shown, the proxy service instance is used to receive the service request sent by the client. After receiving the service request, the proxy service instance can, on the one hand, perform statistical counting on the service request to obtain the first flow of the target service corresponding to the service request; on the other hand, it can determine whether the flow limiting strategy of the target service is hit. If it is hit, the flow limiting process is performed, that is, the request is rejected. If it is not hit, the process continues, such as accessing the target service based on the service request. The above-mentioned statistical counting and checking the flow limiting strategy and processing based on the flow limiting strategy can be executed asynchronously, that is, the statistical counting and flow limiting related processing can be processed by independent threads and will not affect each other.

[0042] After obtaining the first traffic, the proxy service instance carries the first traffic in a first reporting request and sends it to the local service instance.

[0043] A local service instance can receive a first reporting request from one or more proxy service instances. After receiving the first reporting request, the local service instance can, on the one hand, perform statistical aggregation on the first traffic carried in the first reporting request to obtain the second traffic of the target business; on the other hand, it can check whether it has generated a current limiting strategy. If a current limiting strategy has been generated, the current limiting strategy is carried in the first response message corresponding to the first reporting request and sent to the corresponding proxy service instance. The above-mentioned statistical aggregation and checking of the current limiting strategy and issuing of the current limiting strategy can be performed asynchronously, that is, the statistical aggregation and current limiting strategy related processing can be processed by independent threads and will not affect each other.

[0044] After the local service instance obtains the second traffic, it carries the second traffic in the second reporting request and sends it to the global service instance. The global service instance counts the second traffic of the target service reported by one or more local service instances, obtains the global traffic of the target service, carries the global traffic in the second response message corresponding to the second reporting request, and sends it to the corresponding local service instance.

[0045] Among them, when the proxy service instance sends the first traffic to the local service instance, it can specifically be sent to a random local service instance in the local service cluster within the IDC where the proxy service instance is located; similarly, when the local service instance sends the second traffic to the global service instance, it can specifically be sent to a random global service instance in the global service cluster.

[0046] The following describes the global traffic statistics and the flow limiting strategy.

[0047] Statistics of global traffic: the proxy service instance can obtain the first traffic of the target business based on the business request sent by the client; the proxy service instance can then carry the first traffic of the target business in a first reporting request and send it to the local service instance, and the local service instance counts and aggregates the first traffic of the same target business from at least one proxy service instance to obtain the second traffic of the target business; the local service instance can then carry the second traffic of the target business in a second reporting request and send it to the global service instance, and the global service instance counts the second traffic of the same target business from at least one local service instance to obtain the global traffic of the target business.

[0048] Specifically, the proxy service instance can perform statistics based on a statistical period (time slice), the length of the time slice is preset, such as 100ms, and the proxy service instance can count the traffic of the target service within each 100ms to obtain the first traffic of the target service. The traffic can specifically be request count and / or throughput.

[0049] After each time slice expires, the proxy service instance sends the first traffic it obtains to the local service instance. The first traffic can be expressed in the form of key-value, where the key is the default prefix + timestamp + time slice, such as stat-1685552400-1 (stat- is a fixed prefix, 1685552400 is a unix timestamp accurate to the second, and the last -1 is the first time slice in the second), and the value is a statistical data in json format, including a business identifier (such as app_0, app_1, etc.), and the specific value of the first traffic. Taking the traffic including the request volume (req_cnt) and throughput (bandwidth) as an example, the example is as follows:

[0050]

[0051]

[0052] Local service instance: After receiving the first traffic reported by the proxy service instance, the first traffic reported by each proxy service instance for the same target business is aggregated according to the granularity of the time slice to obtain the second traffic of the corresponding target business. The length of the time slice can also be set, which can be the same as or different from the time slice length of the proxy service instance. Assuming it is also 100ms, the local service instance counts the first traffic within each 100ms to obtain the second traffic, and reports the second traffic to the global service instance after 100ms expires. The local service instance can be specifically selected as a stateless service, that is, it does not record status information, so as to facilitate horizontal expansion to support higher concurrent statistical counts.

[0053] Global service instance: aggregates the second traffic reported by one or more local service instances for the same target business, obtains the global traffic of the corresponding target business, and feeds back the global traffic to the local service instance in real time. The global service instance needs to record the global traffic, so it is a stateful service, but it can be processed in the following way to support horizontal expansion and thus support higher concurrent statistical counts.

[0054] The specific processing method of the global service instance can be to establish multiple queues, each queue maintains the statistical count of a corresponding global service instance, so as to facilitate horizontal expansion. For example, if the global service cluster includes N (N is a positive integer) global service instances, then N queues are created, and the queues correspond to the global service instances one by one.

[0055] like Figure 3 As shown, assuming that the global service instances in the global service cluster include the first global service instance to the fourth global service instance, and the statistical values ​​of each global service instance are represented by C1 to C4 respectively, then 4 queues can be created, and each queue records the statistical values ​​of the corresponding global service instance.

[0056] Taking the first global service instance as an example, after receiving the second traffic reported by the local service instance, it first updates its own C1 value, that is, the updated C1 value = the C1 value before the update + the C1 increment;

[0057] In addition, the first global service instance can also synchronize the statistical values ​​on other global service instances, calculate the total value of the statistical values ​​of all global service instances, and obtain the global traffic, that is, global traffic = C1 + C2 + C3 + C4.

[0058] Specifically, for a global service instance (represented by countServer), a queue is represented by an item, and the process of obtaining global traffic includes:

[0059] (a) Each countServer uses a certain set period (such as natural seconds) as the time unit to count the global traffic (such as request volume and throughput) of the target business. After crossing natural seconds, all counts are restarted from zero.

[0060] (b) Each countServer maintains a statistical count list for the statistical data of each natural second. Each item in the list stores the statistical value of a countServer at the current moment.

[0061] (c) Each countServer maintains communication with all other countServers, obtains the latest statistics from other countServers according to the granularity of its own time slice (such as 100ms), and then updates the statistical value of the corresponding item in the statistical count list.

[0062] (d) After receiving the reported data from a tokenServer, each countServer will first update the count value in the item that stores its own statistical value in the statistical count list, and then traverse the count values ​​of other items in the list in turn, summarize and calculate the global count value (global traffic) at the current moment, and return it as a response to the local service instance (tokenServer).

[0063] In some embodiments, the global service cluster includes: a target global service instance, and other global service instances other than the target global service instance, and the target global service instance is used to: count the second traffic sent to its own instance to obtain its own statistics of the target business; obtain other statistics of the target business counted by the other global service instances; and obtain the global traffic based on its own statistics and the other statistics.

[0064] The target global service instance refers to the global service instance for which global traffic statistics are currently being collected, and may be any global service instance in the global service cluster.

[0065] by Figure 3 For example, the target global service instance is the first global service instance, and the second to fourth global service instances are other global service instances. The own statistic is C1, and the other statistics are C2 to C4. The global statistics (global traffic) are obtained based on the own statistics and other statistics. For example, global traffic = C1+C2+C3+C4.

[0066] In this embodiment, the global flow is obtained based on the own statistics and other statistics, so that the global flow can be obtained accurately and efficiently.

[0067] In some embodiments, the target global service instance is further used to: count the second traffic sent to its own instance to obtain an increment of the target business; obtain the original statistics of the target business from the target queue corresponding to the target global service instance, and obtain its own statistics based on the increment and the original statistics; obtain the other statistics from other queues corresponding to the other global service instances; wherein the other queues are different from the target queue.

[0068] For example, see Figure 3 , the target global service instance is the first global service instance. After receiving the second traffic, the first global service instance counts the currently received second traffic to obtain the C1 increment, and then obtains the original statistics from the queue corresponding to C1. Based on the increment and the original statistics, the updated statistics of C1 are obtained, that is, the own statistics, and the C1 recorded in the own queue is updated to the latest value. In addition, the latest C2~C4 can be obtained from the queues corresponding to other global service instances, and then the latest C1~C4 are summed to obtain the global traffic.

[0069] In this embodiment, by setting corresponding queues for corresponding global service instances and recording respective statistics in respective corresponding queues, business decoupling is achieved, horizontal expansion is facilitated, and elastic contraction capability is improved.

[0070] Regarding the flow limiting strategy: After the global service instance obtains the global flow of the target business, it carries the global flow in the second response message corresponding to the second reporting request and sends it to the corresponding local service instance. After the local service instance receives the global flow, it compares it with the preset threshold of the target business. If it is greater than the preset threshold, a flow limiting strategy is generated. The flow limiting strategy may include the target business identifier, expiration time, and specific flow limiting content. The specific flow limiting content can be generated according to preset rules. For example, if the global flow of a target business is greater than the first threshold, the specific flow limiting content of the target business is set to reject all business requests; if the global flow of the target business is less than the first threshold and greater than the second threshold, the specific flow limiting content of the target business is set to randomly reject some business requests.

[0071] When responding to the first reporting request, the local service instance can check whether the corresponding target service's current limiting policy has been generated. If it has been generated, the current limiting policy of the target service is carried in the first response message corresponding to the first reporting request and sent to the corresponding proxy service instance.

[0072] After receiving a service request for a certain service, the proxy service instance can check whether it has a flow limiting policy for the service. If so, it performs flow limiting processing on the service according to the flow limiting policy.

[0073] In some embodiments, the proxy service cluster is further used to:

[0074] In response to reaching a preset statistical period, counting the service requests within the statistical period to obtain the first traffic, and carrying the first traffic in a first reporting request to send to the local service cluster;

[0075] Accordingly, the local service cluster is further used for:

[0076] In response to receiving the first reporting request and having generated the current limiting policy, the current limiting policy is carried in a first response message and sent to the proxy service cluster.

[0077] In this embodiment, the proxy service cluster reports the first traffic based on the statistical period, and the local service cluster sends the flow limiting policy to the proxy service cluster through the first response message, so that basic real-time traffic control can be achieved. For example, if the statistical period is 100ms, the discovery and blocking of services with excessive traffic can be completed in hundreds of milliseconds, truly achieving global real-time flow control.

[0078] In some embodiments, the local service cluster is further used to:

[0079] In response to receiving the first reporting request, counting the first traffic within the statistical period to obtain the second traffic, and sending the second traffic to the global service cluster by carrying it in a second reporting request;

[0080] Accordingly, the global service cluster is further used for:

[0081] In response to receiving the second reporting request, the second traffic is counted to obtain the global traffic, and the global traffic is carried in a second response message and sent to the local service cluster.

[0082] In this embodiment, the global service cluster can send the global traffic to the local service instance in real time by responding to the second reporting request and carrying the global traffic in the second response message, so that the local service instance can generate a flow limiting strategy in time to improve processing efficiency.

[0083] In combination with the above-mentioned distributed system, the process executed by each cluster can be shown in the following embodiment.

[0084] Figure 4 is a schematic diagram according to the third embodiment of the present disclosure, and this embodiment provides a flow control method. This embodiment can be applied to a local service cluster, and the method includes:

[0085] 401. Receive a first flow of a target service sent by a proxy service cluster in a same deployment area, where the first flow is obtained by counting service requests sent by a client by the proxy service cluster.

[0086] 402. Count the first traffic to obtain the second traffic of the target service, and send the second traffic to a global service cluster.

[0087] 403. Receive the global traffic of the target service sent by the global service cluster, where the global traffic is obtained after the global service cluster collects statistics on the second traffic.

[0088] 404. If the global traffic is greater than a preset threshold, generate a traffic limiting strategy for the target service.

[0089] 405. Send the current limiting strategy to the proxy service cluster, so that the proxy service cluster performs current limiting processing on the target service based on the current limiting strategy.

[0090] In this embodiment, distributed statistics can be achieved by using a cluster approach, so that global traffic can still be accurately obtained in a large business volume scenario; statistics of the first traffic, the second traffic and the global traffic are respectively performed by the proxy service cluster, the local service cluster and the global service cluster, and the statistics can be distributed to different levels, which can further improve the accuracy of the global traffic and reduce the statistical complexity, so that accurate and comprehensive global traffic can still be obtained in a large business volume scenario. In addition, by generating a flow limiting strategy through the local service cluster and sending it to the proxy service cluster for execution, the target business can be flow limited to improve system stability.

[0091] In some embodiments, the receiving of the first traffic of the target service sent by the proxy service cluster in the same deployment area includes:

[0092] receiving a first reporting request sent by the proxy service cluster after a preset statistical period is reached, wherein the first reporting request carries the first traffic, and the first traffic is obtained after the proxy service cluster counts the service requests sent by the client;

[0093] Correspondingly, sending the current limiting strategy to the proxy service cluster so that the proxy service cluster performs current limiting processing on the target service based on the current limiting strategy includes:

[0094] In response to receiving the first reporting request, a first response message is sent to the proxy service cluster, where the first response message carries the current limiting strategy.

[0095] In this embodiment, the proxy service cluster reports the first traffic based on the statistical period, and the local service cluster sends the flow limiting policy to the proxy service cluster through the first response message, so that basic real-time traffic control can be achieved. For example, if the statistical period is 100ms, the discovery and blocking of services with excessive traffic can be completed in hundreds of milliseconds, truly achieving global real-time flow control.

[0096] In some embodiments, the counting of the first traffic to obtain the second traffic of the target service and sending the second traffic to the global service cluster includes:

[0097] In response to receiving the first reporting request, counting the first traffic within the statistical period to obtain the second traffic, and sending the second traffic to the global service cluster by carrying it in a second reporting request;

[0098] Correspondingly, the receiving the global traffic of the target service sent by the global service cluster includes:

[0099] A second response message sent by the global service cluster is received, where the second response message carries the global traffic, and the second response message is sent by the global service cluster after obtaining the global traffic by performing statistics on the second traffic carried in the second reporting request.

[0100] In this embodiment, the global service cluster can send the global traffic to the local service instance in real time by responding to the second reporting request and carrying the global traffic in the second response message, so that the local service instance can generate a flow limiting strategy in time to improve processing efficiency.

[0101] Figure 5 is a schematic diagram according to the fourth embodiment of the present disclosure, and this embodiment provides a flow control method. This embodiment can be applied to a global service cluster, and the method includes:

[0102] 501. Receive a second flow of a target service sent by a local service cluster, where the second flow is obtained after the local service cluster counts the first flow, and the first flow is obtained after the proxy service cluster counts the service request sent by the client.

[0103] 502. Count the second traffic to obtain the global traffic of the target service.

[0104] 503. Send the global traffic to the local service cluster so that the local service cluster generates a flow limiting strategy for the target business when the global traffic is greater than a preset threshold. The flow limiting strategy is sent by the local service cluster to the proxy service cluster so that the proxy service cluster performs flow limiting processing on the target business.

[0105] In this embodiment, distributed statistics can be achieved by using a cluster approach, so that global traffic can still be accurately obtained in a large business volume scenario; statistics of the first traffic, the second traffic and the global traffic are respectively performed by the proxy service cluster, the local service cluster and the global service cluster, and the statistics can be distributed to different levels, which can further improve the accuracy of the global traffic and reduce the statistical complexity, so that accurate and comprehensive global traffic can still be obtained in a large business volume scenario. In addition, by generating a flow limiting strategy through the local service cluster and sending it to the proxy service cluster for execution, the target business can be flow limited to improve system stability.

[0106] In some embodiments, the counting of the second traffic to obtain the global traffic of the target service includes:

[0107] Collecting statistics on the second traffic sent to the own instance to obtain own statistics of the target service;

[0108] Obtaining other statistics of the target business counted by the other global service instances;

[0109] The global traffic is obtained based on the own statistics and the other statistics.

[0110] In this embodiment, the global flow is obtained based on the own statistics and other statistics, so that the global flow can be obtained accurately and efficiently.

[0111] In some embodiments, the step of collecting statistics on the second traffic sent to the own instance to obtain the own statistics of the target service includes:

[0112] Collecting statistics on the second traffic sent to the own instance to obtain an increase in the target service;

[0113] Obtaining original statistics of the target service from the target queue corresponding to the target global service instance;

[0114] The own statistics are obtained based on the increment and the original statistics.

[0115] In this embodiment, the self-statistics are obtained based on the increments and the original statistics, which can improve the accuracy of the self-statistics, thereby improving the accuracy of the global traffic and the accuracy of subsequent flow limiting processing.

[0116] In some embodiments, the obtaining of other statistics of the target business from the other global service instances includes:

[0117] The other statistics are obtained from other queues corresponding to the other global service instances; wherein the other queues are different from the target queue.

[0118] In this embodiment, by setting corresponding queues for corresponding global service instances and recording respective statistics in respective corresponding queues, business decoupling is achieved, horizontal expansion is facilitated, and elastic contraction capability is improved.

[0119] Figure 6 is a schematic diagram according to the fifth embodiment of the present disclosure, and this embodiment provides a flow control method. This embodiment can be applied to a proxy service cluster, and the method includes:

[0120] 601. Count the service requests sent by the client to obtain the first flow of the target service.

[0121] 602. Send the first traffic to a local service cluster in the same deployment area, so that the local service cluster counts the first traffic and obtains the second traffic of the target business. The second traffic is sent by the local service cluster to a global service cluster, so that the global service cluster counts the second traffic and obtains the global traffic of the target business.

[0122] 603. Receive a flow limiting strategy for the target service sent by the local service cluster, where the flow limiting strategy is generated by the local service cluster when the global flow is greater than a preset threshold.

[0123] 604. Perform flow limiting processing on the target service based on the flow limiting strategy.

[0124] In this embodiment, distributed statistics can be achieved by using a cluster approach, so that global traffic can still be accurately obtained in a large business volume scenario; statistics of the first traffic, the second traffic and the global traffic are respectively performed by the proxy service cluster, the local service cluster and the global service cluster, and the statistics can be distributed to different levels, which can further improve the accuracy of the global traffic and reduce the statistical complexity, so that accurate and comprehensive global traffic can still be obtained in a large business volume scenario. In addition, by generating a flow limiting strategy through the local service cluster and sending it to the proxy service cluster for execution, the target business can be flow limited to improve system stability.

[0125] In some embodiments, sending the first traffic to a local service cluster in the same deployment area includes:

[0126] In response to reaching a preset statistical period, sending a first reporting request to the local service cluster, where the first reporting request carries the first traffic;

[0127] Correspondingly, the receiving the flow limiting strategy for the target service sent by the local service cluster includes:

[0128] A first response message sent by the local service cluster is received, where the first response message is sent by the local service cluster in response to the first reporting request, and the first response message carries the current limiting policy.

[0129] In this embodiment, the proxy service cluster reports the first traffic based on the statistical period, and the local service cluster sends the flow limiting policy to the proxy service cluster through the first response message, so that basic real-time traffic control can be achieved. For example, if the statistical period is 100ms, the discovery and blocking of services with excessive traffic can be completed in hundreds of milliseconds, truly achieving global real-time flow control.

[0130] Figure 7is a schematic diagram according to the sixth embodiment of the present disclosure. This embodiment provides a flow control device. The device can be located in a local service cluster, such as Figure 7 As shown, the device 700 includes: a first receiving module 701, a counting module 702, a second receiving module 703, a generating module 704 and a sending module 705.

[0131] The first receiving module 701 is used to receive the first traffic of the target business sent by the proxy service cluster in the same deployment area, and the first traffic is obtained after the proxy service cluster counts the business requests sent by the client; the statistical module 702 is used to count the first traffic to obtain the second traffic of the target business, and send the second traffic to the global service cluster; the second receiving module 703 is used to receive the global traffic of the target business sent by the global service cluster, and the global traffic is obtained after the global service cluster counts the second traffic; the generating module 704 is used to generate a flow limiting strategy for the target business if the global traffic is greater than a preset threshold; the sending module 705 is used to send the flow limiting strategy to the proxy service cluster, so that the proxy service cluster performs flow limiting processing on the target business based on the flow limiting strategy.

[0132] In this embodiment, distributed statistics can be achieved by using a cluster approach, so that global traffic can still be accurately obtained in a large business volume scenario; statistics of the first traffic, the second traffic and the global traffic are respectively performed by the proxy service cluster, the local service cluster and the global service cluster, and the statistics can be distributed to different levels, which can further improve the accuracy of the global traffic and reduce the statistical complexity, so that accurate and comprehensive global traffic can still be obtained in a large business volume scenario. In addition, by generating a flow limiting strategy through the local service cluster and sending it to the proxy service cluster for execution, the target business can be flow limited to improve system stability.

[0133] In some embodiments, the first receiving module 701 is further used to: receive a first reporting request sent by the proxy service cluster after a preset statistical period is reached, the first reporting request carries the first traffic, and the first traffic is obtained after the proxy service cluster counts the business requests sent by the client; accordingly, the sending module 705 is further used to: in response to receiving the first reporting request, send a first response message to the proxy service cluster, and the first response message carries the current limiting policy.

[0134] In this embodiment, the proxy service cluster reports the first traffic based on the statistical period, and the local service cluster sends the flow limiting policy to the proxy service cluster through the first response message, so that basic real-time traffic control can be achieved. For example, if the statistical period is 100ms, the discovery and blocking of services with excessive traffic can be completed in hundreds of milliseconds, truly achieving global real-time flow control.

[0135] In some embodiments, the statistical module 702 is further used to: in response to receiving the first reporting request, count the first traffic within the statistical period to obtain the second traffic, and carry the second traffic in the second reporting request and send it to the global service cluster; accordingly, the second receiving module 703 is further used to: receive a second response message sent by the global service cluster, the second response message carries the global traffic, and the second response message is sent by the global service cluster after counting the second traffic carried in the second reporting request to obtain the global traffic.

[0136] In this embodiment, the global service cluster can send the global traffic to the local service instance in real time by responding to the second reporting request and carrying the global traffic in the second response message, so that the local service instance can generate a flow limiting strategy in time to improve processing efficiency.

[0137] Figure 8 is a schematic diagram according to the seventh embodiment of the present disclosure. This embodiment provides a flow control device. The device can be located in a global service cluster, such as Figure 8 As shown, the device 800 includes: a receiving module 801, a statistical module 802 and a sending module 803.

[0138] The receiving module 801 is used to receive the second traffic of the target business sent by the local service cluster, the second traffic is obtained after the local service cluster counts the first traffic, and the first traffic is obtained after the proxy service cluster counts the business requests sent by the client; the statistical module 802 is used to count the second traffic to obtain the global traffic of the target business; the sending module 803 is used to send the global traffic to the local service cluster, so that the local service cluster generates a flow limiting strategy for the target business when the global traffic is greater than a preset threshold, and the flow limiting strategy is sent by the local service cluster to the proxy service cluster, so that the proxy service cluster performs flow limiting processing on the target business.

[0139] In this embodiment, distributed statistics can be achieved by using a cluster approach, so that global traffic can still be accurately obtained in a large business volume scenario; statistics of the first traffic, the second traffic and the global traffic are respectively performed by the proxy service cluster, the local service cluster and the global service cluster, and the statistics can be distributed to different levels, which can further improve the accuracy of the global traffic and reduce the statistical complexity, so that accurate and comprehensive global traffic can still be obtained in a large business volume scenario. In addition, by generating a flow limiting strategy through the local service cluster and sending it to the proxy service cluster for execution, the target business can be flow limited to improve system stability.

[0140] In some embodiments, the statistical module 802 is further used to: count the second traffic sent to its own instance to obtain its own statistics of the target business; obtain other statistics of the target business counted by other global service instances; and obtain the global traffic based on its own statistics and the other statistics.

[0141] In this embodiment, the global flow is obtained based on the own statistics and other statistics, so that the global flow can be obtained accurately and efficiently.

[0142] In some embodiments, the statistical module 802 is further used to: count the second traffic sent to its own instance to obtain an increment of the target business; obtain the original statistics of the target business from the target queue corresponding to the target global service instance; and obtain its own statistics based on the increment and the original statistics.

[0143] In this embodiment, the self-statistics are obtained based on the increments and the original statistics, which can improve the accuracy of the self-statistics, thereby improving the accuracy of the global traffic and the accuracy of subsequent flow limiting processing.

[0144] In some embodiments, the statistical module 802 is further used to: obtain the other statistics from other queues corresponding to the other global service instances; wherein the other queues are different from the target queue.

[0145] In this embodiment, by setting corresponding queues for corresponding global service instances and recording respective statistics in respective corresponding queues, business decoupling is achieved, horizontal expansion is facilitated, and elastic contraction capability is improved.

[0146] Fig. 9 is a schematic diagram according to the seventh embodiment of the present disclosure. This embodiment provides a flow control device. The device can be located in a proxy service cluster, such as Fig. 9 As shown, the device 900 includes: a statistical module 901, a sending module 902, a receiving module 903 and a current limiting module 904.

[0147] The statistical module 901 is used to count the service requests sent by the client to obtain the first flow of the target service; the sending module 902 is used to send the first flow to the local service cluster in the same deployment area, so that the local service cluster counts the first flow to obtain the second flow of the target service, and the second flow is sent by the local service cluster to the global service cluster, so that the global service cluster counts the second flow to obtain the global flow of the target service; the receiving module 903 is used to receive the flow limiting strategy for the target service sent by the local service cluster, and the flow limiting strategy is generated by the local service cluster when the global flow is greater than a preset threshold; the flow limiting module 904 is used to perform flow limiting processing on the target service based on the flow limiting strategy.

[0148] In this embodiment, distributed statistics can be achieved by using a cluster approach, so that global traffic can still be accurately obtained in a large business volume scenario; statistics of the first traffic, the second traffic and the global traffic are respectively performed by the proxy service cluster, the local service cluster and the global service cluster, and the statistics can be distributed to different levels, which can further improve the accuracy of the global traffic and reduce the statistical complexity, so that accurate and comprehensive global traffic can still be obtained in a large business volume scenario. In addition, by generating a flow limiting strategy through the local service cluster and sending it to the proxy service cluster for execution, the target business can be flow limited to improve system stability.

[0149] In some embodiments, the sending module 902 is further used to: in response to reaching a preset statistical period, send a first reporting request to the local service cluster, and the first reporting request carries the first traffic; accordingly, the receiving module 903 is further used to: receive a first response message sent by the local service cluster, and the first response message is sent by the local service cluster in response to the first reporting request, and the first response message carries the current limiting policy.

[0150] In this embodiment, the proxy service cluster reports the first traffic based on the statistical period, and the local service cluster sends the flow limiting policy to the proxy service cluster through the first response message, so that basic real-time traffic control can be achieved. For example, if the statistical period is 100ms, the discovery and blocking of services with excessive traffic can be completed in hundreds of milliseconds, truly achieving global real-time flow control.

[0151] It can be understood that in the embodiments of the present disclosure, the same or similar contents in different embodiments can be referenced to each other.

[0152] It can be understood that the “first”, “second”, etc. in the embodiments of the present disclosure are only used for distinction and do not indicate the degree of importance, time sequence, etc.

[0153] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

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

[0155] Fig.10 A schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present disclosure is shown. The electronic device 1000 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0156] like Fig.10 As shown, the electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0157] Multiple components in the electronic device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the electronic device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0158] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as a flow control method. For example, in some embodiments, the flow control method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the flow control method described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform the flow control method in any other appropriate manner (e.g., by means of firmware).

[0159] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0160] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0161] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

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

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

[0164] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

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

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

Claims

1. A distributed system, comprising: Proxy service cluster, used for asynchronous execution: statistics on business requests sent by clients to obtain the first flow of target business; And, if there is a flow limiting strategy for the target service, performing flow limiting processing on the target service based on the flow limiting strategy; A local service cluster is used to asynchronously execute: counting the first traffic sent by the proxy service cluster in the same deployment area to obtain the second traffic of the target service; and if the flow limiting strategy has been generated, sending the flow limiting strategy to the proxy service cluster, wherein the flow limiting strategy is generated when the global traffic of the target service is greater than a preset threshold; The global service cluster is used to count the second traffic sent by the local service cluster to obtain the global traffic of the target service, and send the global traffic to the local service cluster.

2. The system according to claim 1, wherein: The global service cluster includes: a target global service instance, and other global service instances other than the target global service instance, wherein the target global service instance is used to: Collecting statistics on the second traffic sent to the own instance to obtain own statistics of the target service; Obtaining other statistics of the target business counted by the other global service instances; The global traffic is obtained based on the own statistics and the other statistics.

3. The system according to claim 2, wherein: The target global service instance is further used to: Collecting statistics on the second traffic sent to the own instance to obtain an increase in the target service; Obtaining original statistics of the target service from the target queue corresponding to the target global service instance, and obtaining the own statistics based on the increment and the original statistics; Obtaining the other statistics from other queues corresponding to the other global service instances; The other queue is different from the target queue.

4. The system according to claim 1, wherein: The proxy service cluster is further used for: In response to reaching a preset statistical period, counting the service requests within the statistical period to obtain the first traffic, and carrying the first traffic in a first reporting request to send to the local service cluster; Accordingly, the local service cluster is further used for: In response to receiving the first reporting request and having generated the current limiting policy, the current limiting policy is carried in a first response message and sent to the proxy service cluster.

5. The system according to claim 4, wherein: The local service cluster is further used for: In response to receiving the first reporting request, counting the first traffic within the statistical period to obtain the second traffic, and sending the second traffic to the global service cluster by carrying it in a second reporting request; Accordingly, the global service cluster is further used for: In response to receiving the second reporting request, the second traffic is counted to obtain the global traffic, and the global traffic is carried in a second response message and sent to the local service cluster.

6. A flow control method, comprising: receiving a first flow of a target service sent by a proxy service cluster in the same deployment area, where the first flow is obtained by the proxy service cluster after counting service requests sent by a client; Performing statistics on the first traffic to obtain a second traffic of the target service, and sending the second traffic to a global service cluster; receiving the global traffic of the target service sent by the global service cluster, where the global traffic is obtained after the global service cluster collects statistics on the second traffic; If the global traffic is greater than a preset threshold, a flow limiting strategy for the target service is generated; Sending the current limiting strategy to the proxy service cluster so that the proxy service cluster performs current limiting processing on the target service based on the current limiting strategy; The process of obtaining the second traffic and the process of generating the current limiting strategy are executed asynchronously, and the process of counting the first traffic and the current limiting processing are executed asynchronously.

7. The method according to claim 6, wherein: The receiving first traffic of the target service sent by the proxy service cluster in the same deployment area includes: receiving a first reporting request sent by the proxy service cluster after a preset statistical period is reached, wherein the first reporting request carries the first traffic, and the first traffic is obtained after the proxy service cluster counts the service requests sent by the client; Correspondingly, sending the current limiting strategy to the proxy service cluster so that the proxy service cluster performs current limiting processing on the target service based on the current limiting strategy includes: In response to receiving the first reporting request, a first response message is sent to the proxy service cluster, where the first response message carries the current limiting strategy.

8. The method according to claim 7, wherein: The counting of the first traffic to obtain the second traffic of the target service, and sending the second traffic to the global service cluster includes: In response to receiving the first reporting request, counting the first traffic within the statistical period to obtain the second traffic, and sending the second traffic to the global service cluster by carrying it in a second reporting request; Correspondingly, the receiving the global traffic of the target service sent by the global service cluster includes: A second response message sent by the global service cluster is received, where the second response message carries the global traffic, and the second response message is sent by the global service cluster after obtaining the global traffic by performing statistics on the second traffic carried in the second reporting request.

9. A flow control method, comprising: Receive a second flow of a target service sent by a local service cluster, where the second flow is obtained by the local service cluster after counting the first flow, and the first flow is obtained by the proxy service cluster after counting the service request sent by the client; Collecting statistics on the second traffic to obtain the global traffic of the target service; Sending the global traffic to the local service cluster, so that the local service cluster generates a flow limiting strategy for the target service when the global traffic is greater than a preset threshold, and the flow limiting strategy is sent by the local service cluster to the proxy service cluster, so that the proxy service cluster performs flow limiting processing on the target service; The process of obtaining the second traffic and the process of generating the current limiting strategy are executed asynchronously, and the process of counting the first traffic and the current limiting processing are executed asynchronously.

10. The method according to claim 9, wherein: The counting of the second traffic to obtain the global traffic of the target service includes: Collecting statistics on the second traffic sent to the own instance to obtain own statistics of the target service; Obtain other statistics of the target business from other global service instances; The global traffic is obtained based on the own statistics and the other statistics.

11. The method according to claim 10, wherein: The counting of the second traffic sent to the own instance to obtain the own statistics of the target service includes: Collecting statistics on the second traffic sent to the own instance to obtain an increase in the target service; Obtaining original statistics of the target service from the target queue corresponding to the target global service instance; The own statistics are obtained based on the increment and the original statistics.

12. The method according to claim 11, wherein: The acquiring of other statistics of the target business from the other global service instances includes: The other statistics are obtained from other queues corresponding to the other global service instances; wherein the other queues are different from the target queue.

13. A flow control method, comprising: Count the service requests sent by the client to obtain the first flow of the target service; The first traffic is sent to a local service cluster in the same deployment area, so that the local service cluster obtains a second traffic of the target service after counting the first traffic, and the second traffic is sent by the local service cluster to a global service cluster, so that the global service cluster obtains a global traffic of the target service after counting the second traffic; Receiving a flow limiting strategy for the target service sent by the local service cluster, where the flow limiting strategy is generated by the local service cluster when the global flow is greater than a preset threshold; Performing flow limiting processing on the target service based on the flow limiting strategy; The process of obtaining the second traffic and the process of generating the current limiting strategy are executed asynchronously, and the process of counting the first traffic and the current limiting processing are executed asynchronously.

14. The method according to claim 13, wherein: The sending the first traffic to a local service cluster in the same deployment area includes: In response to reaching a preset statistical period, sending a first reporting request to the local service cluster, where the first reporting request carries the first traffic; Correspondingly, the receiving the flow limiting strategy for the target service sent by the local service cluster includes: A first response message sent by the local service cluster is received, where the first response message is sent by the local service cluster in response to the first reporting request, and the first response message carries the current limiting policy.

15. A flow control device, comprising: A first receiving module, configured to receive a first flow of a target service sent by a proxy service cluster in the same deployment area, wherein the first flow is obtained by the proxy service cluster after counting service requests sent by a client; A statistics module, used for counting the first traffic to obtain the second traffic of the target service, and sending the second traffic to the global service cluster; A second receiving module is used to receive the global traffic of the target service sent by the global service cluster, where the global traffic is obtained after the global service cluster collects statistics on the second traffic; A generating module, used for generating a flow limiting strategy for the target service if the global flow is greater than a preset threshold; A sending module, used to send the current limiting strategy to the proxy service cluster, so that the proxy service cluster performs current limiting processing on the target service based on the current limiting strategy; The process of obtaining the second traffic and the process of generating the current limiting strategy are executed asynchronously, and the process of counting the first traffic and the current limiting processing are executed asynchronously.

16. A flow control device, comprising: A receiving module, configured to receive a second flow of a target service sent by a local service cluster, wherein the second flow is obtained after the local service cluster performs statistics on the first flow, and the first flow is obtained after the proxy service cluster performs statistics on the service request sent by the client; A statistics module, used for collecting statistics on the second traffic to obtain the global traffic of the target service; A sending module, used to send the global traffic to the local service cluster, so that the local service cluster generates a flow limiting strategy for the target service when the global traffic is greater than a preset threshold, and the flow limiting strategy is sent by the local service cluster to the proxy service cluster, so that the proxy service cluster performs flow limiting processing on the target service; The process of obtaining the second traffic and the process of generating the current limiting strategy are executed asynchronously, and the process of counting the first traffic and the current limiting processing are executed asynchronously.

17. A flow control device, comprising: A statistics module is used to count the service requests sent by the client to obtain the first flow of the target service; A sending module, used for sending the first traffic to a local service cluster in the same deployment area, so that the local service cluster obtains the second traffic of the target business after counting the first traffic, and the second traffic is sent by the local service cluster to a global service cluster, so that the global service cluster obtains the global traffic of the target business after counting the second traffic; A receiving module, configured to receive a flow limiting strategy for the target service sent by the local service cluster, wherein the flow limiting strategy is generated by the local service cluster when the global flow is greater than a preset threshold; A current limiting module, used to perform current limiting processing on the target service based on the current limiting strategy; The process of obtaining the second traffic and the process of generating the current limiting strategy are executed asynchronously, and the process of counting the first traffic and the current limiting processing are executed asynchronously.

18. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 6 to 14.

19. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 6-14.

20. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 6 to 14.

Citation Information

Patent Citations

  • Message processing method and device, equipment and storage medium

    CN115658290A