Flow control method and device, electronic equipment and computer program product
By working together between the traffic management server and the request processing server, real-time monitoring and dynamic adjustment of the traffic control quota of microservices, the problem of insufficient traffic control in the existing technology is solved, and more efficient and stable traffic management is achieved.
Patent Information
- Application Number
- CN202411830900.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-12-12
AI Technical Summary
In the prior art, the flow control of a single microservice architecture cannot be dynamically adjusted in real time, resulting in insufficient accurate flow control.
By working together between the traffic management server and the request processing server, the traffic data of the target microservices in multiple request processing servers is monitored in real time, and the comparison results of the current communication time interval and the shortest allowed communication time interval are used to determine the target quota adjustment strategy from multiple preset quota adjustment strategies to adjust the current traffic control quota.
Real-time dynamic control of microservice traffic is realized, the accuracy and adaptability of traffic control is improved, the traffic management server is prevented from being penetrated by massive requests, and communication stability and availability are improved.
Smart Images

Figure CN119629117A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a flow control method, device, electronic device, and computer program product. Background Art
[0002] In recent years, microservice architecture has been widely used in the industry due to its good independence, isolation and scalability, and more and more systems are built based on microservice architecture.
[0003] In the related art, the traffic of a single microservice under the microservice architecture can generally be limited by setting a traffic control quota to prevent a single microservice from being unavailable and threads of other microservices that depend on the microservice from being blocked. However, the traffic control quota set for each microservice is usually fixed and cannot be adjusted dynamically in real time, resulting in inaccurate traffic control of the microservice. Summary of the invention
[0004] In view of this, exemplary embodiments of the present disclosure provide a flow control method, apparatus, electronic device, and computer program product to solve the problems existing in the related art.
[0005] According to a first aspect of the exemplary embodiments of the present disclosure, a traffic control method is provided, characterized in that the method is applied to a traffic management server and includes:
[0006] Receive a quota allocation request sent by a target request processing server among multiple request processing servers, and obtain the current total flow and total flow control quota of the target microservice based on the identifier of the target microservice carried in the quota allocation request; wherein the target microservice is deployed in each request processing server;
[0007] When the current total flow is less than the total flow control quota, the current communication time interval, the shortest allowed communication time interval and the current flow control quota of the target microservice in the target request processing server are obtained;
[0008] Based on the comparison result between the current communication time interval and the shortest allowed communication time interval, a target quota adjustment strategy is determined from a plurality of preset quota adjustment strategies, and the current flow control quota is adjusted using the target quota adjustment strategy to obtain an adjusted flow control quota;
[0009] A quota adjustment indication is generated based on the adjusted flow control quota, and the quota adjustment indication is sent to the target request processing server; wherein the quota adjustment indication is used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice.
[0010] A second aspect of the exemplary embodiments of the present disclosure provides a flow control method, characterized in that it is applied to a request processing server, and the method includes:
[0011] Receive the user's service call request, and based on the identifier of the target microservice carried in the service call request, obtain the current traffic and current traffic control quota of the target microservice in the request processing server;
[0012] When the current flow is greater than or equal to the current flow control quota, a quota allocation request is sent to the flow management server; wherein the quota allocation request is used to request the flow management server to adjust the current flow control quota, obtain the adjusted flow control quota, and generate a quota adjustment indication based on the adjusted flow control quota;
[0013] Receive a quota adjustment instruction sent by the traffic management server, and perform traffic control on the target microservice based on the adjusted traffic control quota determined by the quota adjustment instruction.
[0014] According to a third aspect of the exemplary embodiments of the present disclosure, a flow control device is provided, characterized in that it is applied to a flow management server, and the device includes:
[0015] A communication module, used for receiving a quota allocation request sent by a target request processing server among multiple request processing servers;
[0016] A processing module, used to obtain the current total flow and total flow control quota of the target microservice based on the identifier of the target microservice carried in the quota allocation request; wherein the target microservice is deployed in each request processing server;
[0017] The processing module is also used to obtain the current communication time interval, the shortest allowed communication time interval and the current flow control quota of the target microservice in the target request processing server when the current total flow is less than the total flow control quota;
[0018] The processing module is also used to determine a target credit limit adjustment strategy from a plurality of preset credit limit adjustment strategies based on a comparison result between the current communication time interval and the shortest allowed communication time interval;
[0019] An adjustment module, used to adjust the current flow control quota using a target quota adjustment strategy to obtain an adjusted flow control quota;
[0020] A generating module, used for generating a quota adjustment indication based on the adjusted flow control quota;
[0021] The communication module is used to send a quota adjustment instruction to the target request processing server; wherein the quota adjustment instruction is used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice.
[0022] According to a fourth aspect of the exemplary embodiments of the present disclosure, a flow control device is provided, characterized in that it is applied to a request processing server, and the device includes:
[0023] A communication module, used to receive a user's service call request;
[0024] A processing module, used to obtain the current flow and current flow control quota of the target microservice in the request processing server based on the identifier of the target microservice carried in the service call request;
[0025] A communication module, used for sending a quota allocation request to a traffic management server when the current traffic is greater than or equal to the current traffic control quota; wherein the quota allocation request is used to request the traffic management server to adjust the current traffic control quota, obtain the adjusted traffic control quota, and generate a quota adjustment indication based on the adjusted traffic control quota;
[0026] The communication module is also used to receive a quota adjustment instruction sent by the traffic management server;
[0027] The control module is used to perform flow control on the target microservice based on the adjusted flow control quota determined by the quota adjustment indication.
[0028] According to a fifth aspect of the exemplary embodiments of the present disclosure, there is provided an electronic device, including:
[0029] at least one processor;
[0030] a memory for storing at least one processor executable instruction;
[0031] Wherein, at least one processor is used to execute instructions to implement the steps of the above method.
[0032] According to a sixth aspect of the exemplary embodiments of the present disclosure, a computer program product is provided, including a computer program, wherein the steps of the above method are implemented when the computer program is executed by a processor.
[0033] At least one of the above-mentioned technical solutions adopted in the exemplary embodiment of the present disclosure can achieve the following beneficial effects: by receiving a quota allocation request sent by a target request processing server among multiple request processing servers, and based on the identifier of the target microservice carried in the quota allocation request, obtaining the current total flow and the total flow control quota of the target microservice; wherein the target microservice is deployed in each request processing server; when the current total flow is less than the total flow control quota, obtaining the current communication time interval, the shortest allowed communication time interval and the current flow control quota of the target microservice in the target request processing server; based on the comparison result of the current communication time interval and the shortest allowed communication time interval, determining the target quota adjustment strategy from multiple preset quota adjustment strategies, and using the target quota adjustment strategy to adjust the current flow control quota to obtain the adjusted flow control quota; generating a quota based on the adjusted flow control quota An adjustment instruction is provided, and a quota adjustment instruction is sent to the target request processing server; wherein, the quota adjustment instruction is used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice, and can monitor the flow data of the target microservices in multiple request processing servers in real time when performing flow control, and for the quota allocation request sent by the target request processing server, use the comparison result of the current communication time interval and the shortest allowed communication time interval to determine the target quota adjustment strategy of the current flow control quota, so that the adjusted flow control quota obtained based on the target quota adjustment strategy can enable the target request processing server to adapt to the flow changes of the target microservice in time, dynamically control the flow of the target microservice in the target request processing server, thereby ensuring that the flow management server will not be overwhelmed by massive requests, thereby improving the communication stability and availability between the flow management server and the request processing server. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the exemplary embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0035] Figure 1 A flow chart of a flow control method provided by an exemplary embodiment of the present disclosure is shown;
[0036] Figure 2 A flow chart of another flow control method provided by an exemplary embodiment of the present disclosure is shown;
[0037] Figure 3 A schematic structural diagram of a flow control device provided by an exemplary embodiment of the present disclosure is shown;
[0038] Figure 4 A schematic structural diagram of another flow control device provided by an exemplary embodiment of the present disclosure is shown;
[0039] Figure 5 A schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present disclosure is shown;
[0040] Figure 6 A schematic diagram of the structure of a computer system provided by an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0041] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0042] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0043] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0044] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0045] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0046] In recent years, in order to cope with complex business needs, software architecture has been evolving from the initial monolithic architecture, vertical architecture, service-oriented architecture (SOA), to microservice architecture. Microservice architecture has good independence, isolation and scalability, and has been widely used in the industry. More and more systems are built based on microservice architecture. Since the traffic that each microservice can carry under the microservice architecture (here it can be the number of access requests) is usually limited, when the traffic exceeds the upper limit, a single microservice may become unavailable, which in turn causes thread blocking in other microservices that depend on the microservice. Therefore, it is necessary to control the traffic of each microservice to avoid causing an "avalanche effect" in high concurrency and massive data processing scenarios, causing the entire system to crash. Therefore, it is particularly important to ensure the availability of microservices in high concurrency and massive data processing scenarios.
[0047] In related technologies, in order to ensure the availability of microservices in high concurrency and massive data scenarios, cluster flow control can generally be used to monitor indicators such as the number of queries per second or the number of concurrent threads of microservice access requests. Once the preset flow control quota is reached, the flow control measures are initiated, and the microservice instance refuses to receive microservice access requests that exceed the preset flow control quota and returns a flow limiting error code.
[0048] In actual applications, since it is impossible to accurately predict the number of microservice access requests, and the number of microservice access requests that each microservice instance can load is not necessarily the same, it is impossible to accurately set the preset flow control quota of each microservice instance. As a result, when the preset flow control quota of some microservice instances has been exhausted, the microservice instance is restricted. At the same time, the preset flow control quota of other microservice instances has surplus and is not fully used.
[0049] Moreover, for each microservice, when the preset flow control quota of the microservice instance has been exhausted, when the microservice instance applies for a new flow control quota from the flow control server, it is applied for according to a fixed value. However, the number of microservice access requests per unit time may change greatly, which will cause the flow control quota to be used very quickly in some periods and very slowly in other periods, resulting in uneven use of the flow control quota of each microservice instance. In other words, the flow control quota of the microservice instance cannot be dynamically adjusted, which ultimately causes inaccurate flow control of the microservice instance.
[0050] Therefore, in order to solve the above problems, the exemplary embodiment of the present disclosure provides a flow control method, which can dynamically adjust the flow control quota of a microservice according to the real-time data called by the microservice, thereby improving the real-time and accuracy of flow control for the microservice.
[0051] The traffic control method provided by the exemplary embodiment of the present disclosure can be executed by a traffic control component, which may include a traffic management server and multiple request processing servers deployed in a distributed manner, and a microservice can be deployed in each request processing server.
[0052] Exemplarily, the traffic control component can be deployed according to the client / server architecture (Client / Server, referred to as C / S architecture), the traffic management server can be equivalent to the server in the client / server architecture, and the request processing server can be equivalent to the client in the client / server architecture.
[0053] Among them, in order to avoid congestion of the traffic management server caused by massive service call requests, the exemplary embodiment of the present disclosure can preset an initial traffic control quota for each microservice in the request processing server for use by the service call request when traffic control is required. The request processing server is deployed on the microservice instance side and is responsible for providing the user with the resources of the corresponding microservice according to the user's service call request; after receiving the user's service call request, the request processing server determines whether the current traffic control quota is exhausted, and when the current traffic control quota (at the start of traffic control, the current traffic control quota is the initial traffic control quota) is exhausted, it sends a quota allocation request for the microservice to the traffic management server to apply for an adjusted traffic control quota, and the adjusted traffic control quota is a new traffic control quota reallocated by the traffic management server; and according to the return result of the traffic management server, it determines whether to perform a flow limiting operation on the microservice in the request processing server in the current traffic control cycle.
[0054] The traffic management server is uniformly deployed, responsible for recording and monitoring the real-time data of service calls of each request processing server in the business cluster, and judging whether the current total traffic (i.e., the current total visits) of the microservice in multiple request processing servers reaches the total traffic control quota of the microservice in the traffic management server in combination with the total traffic control quota of a microservice in the traffic management server; within a traffic control cycle, when the current total traffic of the microservice in multiple request processing servers reaches the total traffic control quota of the microservice in the traffic management server, if a request processing server initiates a quota allocation request for the microservice, the traffic management server issues a traffic control instruction for the microservice to the request processing server that sent the quota allocation request. Based on this, the exemplary embodiment of the present disclosure can realize dynamic flow limiting through the collaboration between the traffic management server and multiple request processing servers.
[0055] First, the traffic management server can configure the total traffic control quota for multiple microservices respectively. The total traffic control quotas corresponding to different microservices can be the same or different, and the exemplary embodiment of the present disclosure does not specifically limit this. Here, the total traffic control quota can be the total traffic that the corresponding microservice can handle at most in one traffic control cycle.
[0056] Since each microservice can be deployed on multiple request processing servers, the request processing server can call the resources of the corresponding microservice according to the user's service call request and provide the corresponding microservice to the user. Based on this, in the initial flow control cycle, after determining the total flow control quota of each microservice, the flow management server first reserves a part of the total flow control quota of the microservice, and evenly distributes the remaining total flow control quota of the microservice to the microservice deployed in each request processing server as the initial flow control quota of the microservice in the request processing server for use by the service call request.
[0057] Exemplarily, when determining the initial flow control quota of a microservice in the request processing server, the flow management server may first reserve a portion of the total flow control quota of the microservice and allocate the remaining total flow control quota of the microservice.
[0058] Assuming that the total flow control quota of a microservice in a traffic management server is Q, the number of request processing servers deploying a microservice is n, the reserved quota coefficient is m, and m>1, the initial flow control quota of the microservice in each request processing server can be expressed as Q / mn. Here, the size of the reserved quota coefficient can be set by the user, and the exemplary embodiments of the present disclosure do not specifically limit this.
[0059] In actual applications, the request processing server receives a service call request from a user, determines the target microservice according to the identifier of the microservice carried in the service call request, obtains the current traffic of the target microservice (excluding the service call request from the user this time) and the current traffic control quota, directly calls the service resources of the target microservice if the current traffic is less than the current traffic control quota, and sends a quota allocation request for the target microservice to the traffic management server if the current traffic is greater than or equal to the current traffic control quota, and the quota allocation request is used to request the traffic management server for the adjusted traffic control quota of the target microservice. Here, the target microservice can be one of the above-mentioned multiple microservices.
[0060] After receiving the quota allocation request, the traffic management server obtains the current total traffic of the target microservice (excluding the quota allocation request sent by the request processing server this time) and the total traffic control quota; if the current total traffic is greater than or equal to the total traffic control quota, a flow limiting instruction for the target microservice is sent to the request processing server, and the flow limiting instruction is used to instruct the request processing server to stop calling the service resources of the target microservice; if the current total traffic is less than the total traffic control quota, the current communication time interval and the shortest allowed communication time interval of the target microservice in the request processing server are obtained, and based on the size relationship between the current communication time interval and the shortest allowed communication time interval, a decision is made whether to adjust the current traffic control quota of the target microservice in the request processing server; wherein, the current communication time interval is the time interval between the two most recent quota allocation requests sent by the same request processing server to the traffic management server. The total traffic control quota of the target microservice can be: the total traffic allocated by the traffic management server to the target microservice in the current traffic control cycle.
[0061] Exemplarily, if the current communication time interval is less than the shortest allowed communication time interval, the ratio of the shortest allowed communication time interval to the current communication time interval is used to calculate the adjusted flow control quota reallocated to the request processing server; if the current communication time interval is greater than or equal to the shortest allowed communication time interval, the flow pressure data of the target microservice in the request processing server is obtained, and the flow pressure trend change is used to calculate the adjusted flow control quota reallocated to the request processing server.
[0062] The exemplary embodiments of the present disclosure may predetermine the shortest allowed communication time interval for each microservice in the request processing server.
[0063] Exemplarily, the shortest allowed communication time interval of the i-th microservice in the request processing server can be calculated by the following formula:
[0064]
[0065] Among them, T i represents the shortest allowed communication time interval of the i-th microservice in the request processing server, n represents the number of request processing servers where the i-th microservice is deployed, F represents the maximum number of communications of all microservices in the traffic management server within a traffic control cycle, and g i Represents the ratio of the flow control quota of the i-th microservice in the request processing server to the sum of the flow control quotas of all microservices in the traffic management server.
[0066] In formula (1), F×g iIt can represent the total number of communications of the i-th microservice in the traffic management server, and the average number of communications distributed to the i-th microservice in each request processing server can be expressed as Its reciprocal represents the shortest allowed communication time interval of the i-th microservice in the request processing server. i The larger the value is, the more frequently the request processing server communicates with the traffic management server for the i-th microservice compared with other microservices in the request processing server, allowing the i-th microservice to have a shorter allowed communication time interval.
[0067] Exemplarily, the traffic management server records the timestamp of the quota allocation request for the i-th microservice sent by each request processing server, and then determines the time interval between the two most recent quota allocation requests for the i-th microservice sent by the same request processing server to the traffic management server as the current communication time interval between the request processing server and the traffic management server for the i-th microservice.
[0068] Assume that the current communication time interval between the request processing server and the traffic management server for the i-th microservice is t. If t <T i , it means that the request processing server needs to communicate frequently with the traffic management server for the i-th microservice, and the actual number of communications between the request processing server and the traffic management server for the i-th microservice may exceed If the flow control quota of the i-th microservice in the request processing server is not increased quickly, the traffic management server may be overwhelmed.
[0069] At this time, it is necessary to increase the flow control quota of the i-th microservice in the request processing server. The adjusted flow control quota should make the communication time interval between the request processing server and the traffic management server for the i-th microservice greater than or equal to the shortest allowed communication time interval of the i-th microservice in the request processing server, that is, t≥T i .
[0070] Assuming that the traffic pressure of the i-th microservice in the request processing server remains unchanged, if the adjusted traffic control quota of the i-th microservice in the request processing server is calculated according to the following formula (2), the communication time interval between the request processing server and the traffic management server for the i-th microservice is equal to the shortest allowed communication time interval of the i-th microservice in the request processing server, that is, t = T i .
[0071]
[0072] Where Ln represents the adjusted flow control quota allocated by the traffic management server to the i-th microservice in the request processing server, Lo represents the current flow control quota of the i-th microservice in the request processing server, and T i represents the shortest allowed communication time interval of the i-th microservice in the request processing server, and t represents the current communication time interval between the request processing server and the traffic management server for the i-th microservice.
[0073] From formula (2), we can see that the smaller t is, the The larger it is, the larger Ln is.
[0074] Considering that the traffic management server should not be operated continuously under extreme conditions, a certain redundancy should be left for the communication time interval between the traffic management server and the request processing server for the i-th microservice. <T i When , the adjusted flow control quota allocated by the traffic management server to the i-th microservice in the request processing server is calculated according to the following formula (3):
[0075]
[0076] Here, α represents a redundancy coefficient, and its size can be set according to the actual situation of the system and the physical device, and the exemplary embodiments of the present disclosure do not make specific limitations on this.
[0077] Based on this, when the request processing server encounters a large number of requests, the exemplary embodiment of the present disclosure can use the above formula (3) to quickly increase the flow control quota of the i-th microservice in the request processing server, so that the number of communications between the request processing server and the traffic management server for the i-th microservice is reduced to an acceptable range as soon as possible.
[0078] For example, if t ≥ T i The exemplary embodiment of the present disclosure can also obtain the traffic pressure data of the i-th microservice in the request processing server; based on the traffic pressure data and the current traffic control quota of the i-th microservice in the request processing server, calculate the adjusted traffic control quota allocated by the traffic management server to the i-th microservice in the request processing server.
[0079] Here, the traffic pressure data includes the traffic pressure at the current moment and the traffic pressure at at least two historical moments closest to the current moment. The traffic pressure can be used to characterize the number of service call requests received by the request processing server per unit time.
[0080] The traffic pressure of the i-th microservice in the request processing server during the j-th communication time interval can be calculated by the following formula (4):
[0081]
[0082] Among them, p ij represents the traffic pressure of the i-th microservice in the request processing server during the j-th communication time interval, Lo j represents the flow control quota of the i-th microservice in the request processing server during the j-th communication time interval, t ij Indicates the time interval between two adjacent quota allocation requests for the i-th microservice sent by the request processing server and received by the traffic management server.
[0083] When t ≥ T i When , the adjusted flow control quota allocated by the traffic management server to the i-th microservice in the request processing server can also be calculated by the following formula (5):
[0084]
[0085] Where Ln represents the adjusted flow control quota allocated by the traffic management server to the i-th microservice in the request processing server, Lo represents the current flow control quota of the i-th microservice in the request processing server, and p i1 represents the traffic pressure of the i-th microservice in the request processing server during the first communication time interval, p i2 represents the traffic pressure of the i-th microservice in the request processing server during the second communication time interval, p i3 Represents the traffic pressure of the i-th microservice in the request processing server during the third communication time interval.
[0086] Here, the third communication time interval is the most recent communication time interval, that is, the difference between the timestamp of the traffic management server receiving the quota allocation request for the i-th microservice sent by the target request processing server this time and the timestamp of the last time the traffic management server received the quota allocation request for the i-th microservice sent by the target request processing server. The second communication time interval is the difference between the timestamp of the traffic management server last receiving the quota allocation request for the i-th microservice sent by the target request processing server (this time - 1 time) and the timestamp of the last time the traffic management server received the quota allocation request for the i-th microservice sent by the target request processing server (this time - 2 times). The first communication time interval is the difference between the timestamp of the traffic management server last receiving the quota allocation request for the i-th microservice sent by the target request processing server (this time - 2 times) and the timestamp of the traffic management server receiving the quota allocation request for the i-th microservice sent by the target request processing server (this time - 3 times).
[0087] From formula (5), we can see that It can be used to characterize the traffic pressure trend of the i-th microservice in the request processing server, reflecting the traffic pressure changes of the request processing server in the past three communication time intervals. but It shows that the traffic pressure of the i-th microservice in the request processing server is increasing, and its adjusted traffic control quota is also increasing accordingly; conversely, its adjusted traffic control quota is decreasing accordingly.
[0088] That is to say, the adjusted flow control quota of the i-th microservice in the request processing server is linearly positively correlated with the flow pressure trend of the i-th microservice in the request processing server. Through such a strategy, the adjusted flow control quota allocated by the traffic management server to the i-th microservice in the request processing server matches its flow pressure trend as much as possible, and timely adapts to the changes in the flow pressure of the i-th microservice in the request processing server, so that the number of communications between the request processing server and the traffic management server for the i-th microservice remains basically stable.
[0089] After determining the adjusted flow control quota allocated to the i-th microservice in the request processing server, the flow management server sends the adjusted flow control quota to the request processing server. If the remaining flow control quota of the i-th microservice in the flow management server is less than the adjusted flow control quota to be allocated to the i-th microservice in the request processing server, the remaining flow control quota of the i-th microservice in the flow management server is used as the adjusted flow control quota and is fully allocated to the request processing server.
[0090] Based on this, an exemplary embodiment of the present disclosure provides a traffic control method, which is applied to a traffic management server, and can be executed by the traffic management server or by a chip applied to the traffic management server.
[0091] Exemplarily, the above-mentioned traffic management server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms, but the exemplary embodiments of the present disclosure are not limited to this.
[0092] Figure 1 FIG. 2 shows a flow chart of a flow control method provided by an exemplary embodiment of the present disclosure. Figure 1 As shown, the flow control method includes:
[0093] S101, receiving a quota allocation request sent by a target request processing server among multiple request processing servers, and obtaining a current total flow and a total flow control quota of the target microservice based on an identifier of the target microservice carried in the quota allocation request; wherein the target microservice is deployed in each request processing server;
[0094] S102, when the current total flow is less than the total flow control quota, obtaining the current communication time interval, the shortest allowed communication time interval and the current flow control quota of the target microservice in the target request processing server;
[0095] S103, based on the comparison result between the current communication time interval and the shortest allowed communication time interval, determining a target quota adjustment strategy from a plurality of preset quota adjustment strategies, and adjusting the current flow control quota using the target quota adjustment strategy to obtain an adjusted flow control quota;
[0096] S104, generating a quota adjustment indication based on the adjusted flow control quota, and sending the quota adjustment indication to the target request processing server; wherein the quota adjustment indication is used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice.
[0097] Specifically, the flow control component composed of a flow management server and multiple request processing servers can refer to the relevant content in the previous article, which will not be repeated here.
[0098] Microservices can be deployed in each request processing server. The traffic management server can centrally manage the traffic control quota of a microservice deployed in multiple request processing servers.
[0099] The request processing server can receive the user's service call request, and when the current traffic of the target microservice in the request processing server is less than the current traffic control quota, it uses the identifier of the microservice carried in the service call request to call the service resources of the corresponding microservice to provide the corresponding microservice to the user.
[0100] Here, the current traffic of the target microservice in the request processing server can be: the current access volume of the target microservice in the request processing server; the current traffic control quota of the target microservice in the request processing server can be: when performing traffic control, the traffic management server configures the traffic control quota for the target microservice in the request processing server in the current traffic control cycle.
[0101] When the current traffic of the target microservice in the request processing server is greater than or equal to the current traffic control quota, the request processing server sends a quota allocation request to the traffic management server.
[0102] In actual applications, when performing flow control, the flow management server can receive a quota allocation request sent by a target request processing server among multiple request processing servers, and obtain the current total flow and total flow control quota of the target microservice based on the identifier of the target microservice carried in the quota allocation request.
[0103] Here, the current total flow of the target microservice can be: the sum of the current flows of the target microservice in multiple request processing servers; the total flow control quota of the target microservice can be: the total flow control quota allocated by the traffic management server to the target microservice in multiple request processing servers during the current flow control cycle. As can be seen from the foregoing, since the traffic management server sets a reserved quota coefficient when presetting the initial flow control quota for each microservice in the request processing server at the beginning of the first flow control cycle of flow control, the total flow control quota (Q) here is greater than the sum of the initial flow control quotas of the target microservice in multiple request processing servers (n×Q / mn).
[0104] When the current total flow is less than the total flow control quota, it means that the total flow control quota of the target microservice is still remaining, so the flow control quota of the target microservice in the target request processing server can also be adjusted. At this time, the current communication time interval, the shortest allowed communication time interval and the current flow control quota of the target microservice in the target request processing server can be obtained; then, based on the comparison result of the current communication time interval and the shortest allowed communication time interval, the target quota adjustment strategy is determined from multiple preset quota adjustment strategies.
[0105] Here, the current communication time interval of the target microservice in the target request processing server can be the time interval between the two most recent quota allocation requests sent by the target request processing server to the traffic management server. The shortest allowed communication time interval of the target microservice in the target request processing server can be calculated by the formula (1) in the previous text, which will not be repeated here.
[0106] The current flow control quota can be the flow control quota allocated by the flow management server to the target microservice in the target request processing server at the current moment. It should be noted that at the start of the first flow control cycle of flow control, the current flow control quota can be the initial flow control quota mentioned above. The relevant content of the initial flow control quota can be found in the previous text and will not be repeated here.
[0107] The exemplary embodiment of the present disclosure can pre-set multiple preset credit adjustment strategies so that a target credit adjustment strategy can be selected from the comparison result between the current communication time interval and the shortest allowed communication time interval. Multiple preset credit adjustment strategies can be set according to actual application scenarios, and the exemplary embodiment of the present disclosure does not specifically limit this.
[0108] The comparison result here can be the comparison result between the difference between the current communication time interval and the shortest allowed communication time interval and the preset difference, or the comparison result between the ratio of the current communication time interval to the shortest allowed communication time interval and the preset ratio, or other comparison results, which are not specifically limited in the exemplary embodiments of the present disclosure.
[0109] After determining the target quota adjustment strategy, the target quota adjustment strategy can be used to adjust the current flow control quota to obtain the adjusted flow control quota; then, a quota adjustment instruction is generated based on the adjusted flow control quota, and the quota adjustment instruction is sent to the target request processing server. Here, the quota adjustment instruction can be used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice.
[0110] Based on this, the exemplary embodiment of the present disclosure can utilize the target quota adjustment strategy determined based on the comparison result of the current communication time interval and the shortest allowed communication time interval to dynamically adjust the flow control quota of the target microservice in the target request processing server, so that the adjusted flow control quota can enable the target request processing server to adapt to the flow changes of the target microservice in a timely manner, thereby ensuring that the flow management server will not be overwhelmed by massive requests.
[0111] At the same time, the real-time dynamic adjustment of the flow control quota can greatly reduce the communication volume between the flow management server and the request processing server, so that the number of communications between the flow management server and the request processing server is in a stable state, thereby improving the communication stability between the flow management server and the request processing server and ensuring the availability of the system.
[0112] According to the technical solution of the exemplary embodiment of the present disclosure, by receiving a quota allocation request sent by a target request processing server among multiple request processing servers, and based on the identifier of the target microservice carried in the quota allocation request, the current total traffic and the total traffic control quota of the target microservice are obtained; wherein the target microservice is deployed in each request processing server; when the current total traffic is less than the total traffic control quota, the current communication time interval, the shortest allowed communication time interval and the current traffic control quota of the target microservice in the target request processing server are obtained; based on the comparison result of the current communication time interval and the shortest allowed communication time interval, a target quota adjustment strategy is determined from multiple preset quota adjustment strategies, and the current traffic control quota is adjusted using the target quota adjustment strategy to obtain an adjusted traffic control quota; a quota adjustment indication is generated based on the adjusted traffic control quota, and the quota adjustment indication is sent to the target The request processing server sends a quota adjustment indication; wherein, the quota adjustment indication is used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice, and can monitor the flow data of the target microservices in multiple request processing servers in real time when performing flow control, and for the quota allocation request sent by the target request processing server, use the comparison result of the current communication time interval and the shortest allowed communication time interval to determine the target quota adjustment strategy of the current flow control quota, so that the adjusted flow control quota obtained based on the target quota adjustment strategy can enable the target request processing server to adapt to the flow changes of the target microservice in time, dynamically control the flow of the target microservice in the target request processing server, thereby ensuring that the flow management server will not be overwhelmed by massive requests, thereby improving the communication stability and availability between the flow management server and the request processing server.
[0113] In some embodiments, the plurality of preset quota adjustment strategies may include a first quota adjustment strategy and a second quota adjustment strategy, the first quota adjustment strategy being related to a ratio between a current communication time interval and a shortest allowed communication time interval, and the second quota adjustment strategy being related to traffic pressure data of a target microservice in a target request processing server;
[0114] Based on the comparison result between the current communication time interval and the shortest allowed communication time interval, a target credit limit adjustment strategy is determined from a plurality of preset credit limit adjustment strategies, which may include:
[0115] If the current communication time interval is less than the shortest allowed communication time interval, determining the first credit limit adjustment strategy as the target credit limit adjustment strategy;
[0116] If the current communication time interval is greater than or equal to the shortest allowed communication time interval, the second credit limit adjustment strategy is determined to be the target credit limit adjustment strategy.
[0117] Specifically, the plurality of preset credit adjustment strategies may include a first credit adjustment strategy and a second credit adjustment strategy, wherein the first credit adjustment strategy may be determined by the formula (3) in the foregoing text. As can be seen from formula (3), the first credit adjustment strategy and the ratio between the current communication time interval and the shortest allowed communication time interval are In related aspects, the exemplary embodiment of the present disclosure may also set a redundancy coefficient. When the request processing server encounters a large number of requests, the flow control quota of the target microservice in the request processing server may be quickly increased using formula (3), so that the number of communications between the request processing server and the flow management server for the target microservice is reduced to an acceptable range as soon as possible, thereby improving the communication stability between the flow management server and the request processing server and ensuring the availability of the system.
[0118] The second quota adjustment strategy can be determined by the formula (5) in the previous text. As can be seen from formula (5), the second quota adjustment strategy is related to the traffic pressure data of the target microservice in the target request processing server. It can be used to characterize the traffic pressure trend determined by the traffic pressure data, reflecting the traffic pressure changes of the request processing server in the last three communication time intervals. The second quota adjustment strategy determined by formula (5) can make the adjusted traffic control quota match its traffic pressure trend as much as possible, so as to timely adapt to the changes in the traffic pressure of the target microservice in the target request processing server and maintain stable communication between the traffic management server and the request processing server.
[0119] If the current communication time interval is less than the shortest allowed communication time interval, it means that the target request processing server needs to communicate frequently with the traffic management server. The communication time interval factor has a greater impact on the adjusted traffic control quota. At this time, the first quota adjustment strategy that has a higher correlation with the ratio between the current communication time interval and the shortest allowed communication time interval can be determined as the target quota adjustment strategy.
[0120] If the current communication time interval is greater than or equal to the shortest allowed communication time interval, it means that the number of communications between the target request processing server and the traffic management server is small, and the communication time interval factor has little impact on the adjusted traffic control quota. The traffic pressure of the target microservice itself in the target request processing server has a greater impact on the adjusted traffic control quota. At this time, the second quota adjustment strategy that has a higher correlation with the traffic pressure data of the target microservice in the target request processing server can be determined as the target quota adjustment strategy.
[0121] Based on this, the technical solution of the exemplary embodiment of the present disclosure can select an appropriate target quota adjustment strategy based on the comparison result of the current communication time interval and the shortest allowed communication time interval, so that the adjusted traffic control quota can maintain stable communication between the traffic management server and the request processing server.
[0122] In some embodiments, adjusting the current flow control quota by using the target quota adjustment strategy to obtain the adjusted flow control quota may include:
[0123] Obtaining the ratio between the current communication time interval and the shortest allowed communication time interval;
[0124] Based on the ratio, the current flow control quota and the first quota adjustment strategy, an adjusted flow control quota is calculated.
[0125] Specifically, when the target quota adjustment strategy is the first quota adjustment strategy, the ratio between the current communication time interval and the shortest allowed communication time interval can be calculated; then, the ratio between the current communication time interval and the shortest allowed communication time interval and the current flow control quota are substituted into formula (3) to obtain the adjusted flow control quota of the target microservice in the target request processing server.
[0126] In some embodiments, the traffic pressure data may include the traffic pressure of the current communication time interval and the traffic pressure of at least two historical communication time intervals closest to the current communication time interval, and the traffic pressure is used to characterize the number of service call requests for the target microservice received by the target request processing server per unit time;
[0127] The current flow control quota is adjusted using the target quota adjustment strategy to obtain an adjusted flow control quota, which may include:
[0128] Acquire the flow pressure of the current communication time interval and the flow pressure of at least two historical communication time intervals that are closest to the current communication time interval;
[0129] Determine traffic pressure trend data of a target microservice in a target request processing server based on the traffic pressure of a current communication time interval and the traffic pressures of at least two historical communication time intervals that are closest to the current communication time interval;
[0130] Based on the flow pressure trend data, the current flow control quota and the second quota adjustment strategy, the adjusted flow control quota is calculated.
[0131] Specifically, the traffic pressure data may include the traffic pressure of the current communication time interval and the traffic pressure of at least two historical communication time intervals that are closest to the current communication time interval. The traffic pressure may be used to characterize the number of service call requests received by the target request processing server for the target microservice per unit time. In the method of the exemplary embodiment of the present disclosure, the traffic pressure of the target microservice in the target request processing server at a certain communication time interval may be calculated by the formula (4) in the above text.
[0132] In the method of the exemplary embodiment of the present disclosure, the flow pressure data may include the flow pressure of the current communication time interval (p in the foregoing text). i3 ), and the traffic pressure of the two historical communication time intervals closest to the current communication time interval (p in the previous text) i1 and p i2 ); then, through p i1 、p i2 and p i3 Calculate the traffic pressure trend data of the target microservice in the target request processing server. The traffic pressure trend data can be the Finally, the flow pressure trend data and the previous flow control quota are substituted into formula (5) to obtain the adjusted flow control quota of the target microservice in the target request processing server.
[0133] Taking the target microservice in the target request processing server as the i-th microservice in the request processing server as an example, it can be seen from formula (5) that It can be used to characterize the traffic pressure trend of the i-th microservice in the request processing server, reflecting the traffic pressure changes of the request processing server in the past three communication time intervals. but It shows that the traffic pressure of the i-th microservice in the request processing server is increasing, and its adjusted traffic control quota is also increasing accordingly; conversely, its adjusted traffic control quota is decreasing accordingly.
[0134] In some embodiments, the method may further include:
[0135] Get the remaining amount of traffic control for the target microservice;
[0136] If the adjusted flow control quota is less than or equal to the flow control remaining quota, executing the step of generating a quota adjustment indication based on the adjusted flow control quota;
[0137] If the adjusted flow control quota is greater than the remaining flow control quota, the remaining flow control quota is determined as the adjusted flow control quota, and the step of generating a quota adjustment indication based on the adjusted flow control quota is performed.
[0138] Specifically, it can be seen from the foregoing that at the start of the first flow control cycle, the initial flow control quota allocated by the flow management server to the target microservice in the target request processing server is Q / mn, so there is also a flow control reserved quota for the target microservice in the flow management server. The above-mentioned flow control remaining quota may include the flow control reserved quota and the current flow control quota of the target microservice in the target request processing server. In addition, for other flow control cycles, the flow control reserved quota of the target microservice that was not allocated at the end of the previous flow control cycle is used as the flow control reserved quota of the target microservice at the start of the next flow control cycle.
[0139] If the adjusted flow control quota is less than or equal to the remaining flow control quota, it means that it is sufficient to take out a part of the remaining flow control quota as the adjusted flow control quota, and allocate the adjusted flow control quota to the target microservice in the target request processing server. At this time, the quota adjustment indication can be generated directly based on the adjusted flow control quota.
[0140] If the adjusted flow control quota is greater than the remaining flow control quota, it means that the remaining flow control quota is insufficient to be allocated to the target microservice in the target request processing server as the adjusted flow control quota. At this time, the remaining flow control quota is determined as the adjusted flow control quota, and then a quota adjustment indication is generated based on the adjusted flow control quota.
[0141] In some embodiments, the method may further include:
[0142] When the current total flow is greater than or equal to the total flow control amount, a flow limiting indication is generated; wherein the flow limiting indication is used to instruct the target request processing server to stop calling the service resources of the target microservice within the current flow control cycle;
[0143] Send a current limiting instruction to the target request processing server.
[0144] Specifically, when the current total flow is greater than or equal to the total flow control quota, it means that the total flow control quota of the target microservice is insufficient to meet the flow requirements of the target microservices in multiple request processing servers, and it is necessary to limit access to the target microservices in the target request processing servers. At this time, a flow limiting indication can be generated and sent to the target request processing server.
[0145] Among them, the current limiting indication can be used to instruct the target request processing server to stop calling the service resources of the target microservice during the current flow control cycle, so as to avoid causing an "avalanche effect" in high concurrency and massive data processing scenarios, causing the entire system to crash.
[0146] The exemplary embodiment of the present disclosure also provides a flow control method, which is applied to a request processing server and can be executed by the request processing server or by a chip applied to the request processing server.
[0147] Exemplarily, the request processing server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms. The exemplary embodiments of the present disclosure are not limited to this.
[0148] Figure 2 FIG. 2 shows a flow chart of another flow control method provided by an exemplary embodiment of the present disclosure. Figure 2 As shown, the flow control method includes:
[0149] S201, receiving a service call request from a user, and obtaining the current flow and current flow control quota of the target microservice in the request processing server based on the identifier of the target microservice carried in the service call request;
[0150] S202, when the current flow is greater than or equal to the current flow control quota, sending a quota allocation request to the flow management server; wherein the quota allocation request is used to request the flow management server to adjust the current flow control quota, obtain the adjusted flow control quota, and generate a quota adjustment indication based on the adjusted flow control quota;
[0151] S203: Receive a quota adjustment instruction sent by the traffic management server, and perform traffic control on the target microservice based on the adjusted traffic control quota determined by the quota adjustment instruction.
[0152] Specifically, when flow control is required, the request processing server can receive the user's service call request, and based on the identifier of the target microservice carried in the service call request, obtain the current flow and current flow control quota of the target microservice in the request processing server.
[0153] Here, the current traffic may be the current traffic volume of the target microservice in the request processing server. The current traffic control quota may be the traffic control quota allocated by the traffic management server to the target microservice in the request processing server at the current moment; if the current moment is the start moment of the current cycle, the current traffic control quota may be the initial traffic control quota in the foregoing text. The relevant contents of the initial traffic control quota may be referred to in the foregoing text and will not be repeated here.
[0154] When the current traffic is greater than or equal to the current traffic control quota, a quota allocation request is sent to the traffic management server, wherein the quota allocation request is used to request the traffic management server to adjust the current traffic control quota, obtain the adjusted traffic control quota, and generate a quota adjustment indication based on the adjusted traffic control quota.
[0155] The request processing server receives the quota adjustment instruction sent by the traffic management server, and then performs traffic control on the target microservice based on the adjusted traffic control quota determined by the quota adjustment instruction.
[0156] Based on this, the exemplary embodiment of the present disclosure can adjust the current flow control quota of the target microservice in the request processing server in real time according to the quota adjustment indication of the traffic management server, so that the adjusted flow control quota can enable the request processing server to adapt to the flow changes of the target microservice, dynamically control the flow of the target microservice in the request processing server, and thus ensure that the traffic management server will not be overwhelmed by massive requests, thereby improving the communication stability and availability between the traffic management server and the request processing server.
[0157] The above mainly introduces the solutions provided by the exemplary embodiments of the present disclosure. It is understandable that in order to implement the above functions, the electronic device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present disclosure.
[0158] The exemplary embodiments of the present disclosure can divide the functional units of the electronic device according to the above method examples. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the exemplary embodiments of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0159] In the case of dividing each functional module according to each function, an exemplary embodiment of the present disclosure provides a flow control device, which may be a flow management server or a chip applied to a flow management server. Figure 3FIG. 2 shows a schematic diagram of a flow control device provided by an exemplary embodiment of the present disclosure. Figure 3 As shown, the device 300 includes:
[0160] The communication module 301 is used to receive a quota allocation request sent by a target request processing server among multiple request processing servers;
[0161] The processing module 302 is used to obtain the current total flow and total flow control quota of the target microservice based on the identifier of the target microservice carried in the quota allocation request; wherein the target microservice is deployed in each request processing server;
[0162] The processing module 302 is also used to obtain the current communication time interval, the shortest allowed communication time interval and the current flow control quota of the target microservice in the target request processing server when the current total flow is less than the total flow control quota;
[0163] The processing module 302 is further configured to determine a target credit limit adjustment strategy from a plurality of preset credit limit adjustment strategies based on a comparison result between the current communication time interval and the shortest allowed communication time interval;
[0164] An adjustment module 303 is used to adjust the current flow control quota by using the target quota adjustment strategy to obtain an adjusted flow control quota;
[0165] A generating module 304, configured to generate a quota adjustment indication based on the adjusted flow control quota;
[0166] The communication module 301 is used to send a quota adjustment instruction to the target request processing server; wherein the quota adjustment instruction is used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice.
[0167] In some embodiments, the plurality of preset quota adjustment strategies include a first quota adjustment strategy and a second quota adjustment strategy, wherein the first quota adjustment strategy is related to a ratio between a current communication time interval and a shortest allowed communication time interval, and the second quota adjustment strategy is related to traffic pressure data of a target microservice in a target request processing server;
[0168] The processing module 302 is also used to determine the first credit adjustment strategy as the target credit adjustment strategy if the current communication time interval is less than the shortest allowed communication time interval; if the current communication time interval is greater than or equal to the shortest allowed communication time interval, determine the second credit adjustment strategy as the target credit adjustment strategy.
[0169] In some embodiments, the adjustment module 303 is further configured to obtain a ratio between a current communication time interval and a shortest allowed communication time interval; and calculate an adjusted flow control quota based on the ratio, a current flow control quota and a first quota adjustment strategy.
[0170] In some embodiments, the traffic pressure data includes the traffic pressure at the current moment and the traffic pressure at at least two historical moments closest to the current moment, and the traffic pressure is used to represent the number of service call requests for the target microservice received by the target request processing server per unit time;
[0171] The adjustment module 303 is also used to obtain the flow pressure at the current moment and the flow pressure at at least two historical moments closest to the current moment; based on the flow pressure at the current moment and the flow pressure at at least two historical moments closest to the current moment, determine the flow pressure trend data of the target microservice in the target request processing server; based on the flow pressure trend data, the current flow control quota and the second quota adjustment strategy, calculate the adjusted flow control quota.
[0172] In some embodiments, the processing module 302 is also used to obtain the remaining flow control quota of the target microservice; if the adjusted flow control quota is less than or equal to the remaining flow control quota, the step of generating a quota adjustment indication based on the adjusted flow control quota is executed; if the adjusted flow control quota is greater than the remaining flow control quota, the remaining flow control quota is determined as the adjusted flow control quota, and the step of generating a quota adjustment indication based on the adjusted flow control quota is executed.
[0173] In some embodiments, the device 300 further includes: a generating module 304, configured to generate a flow limiting indication when the current total flow is greater than or equal to the total flow control amount; wherein the flow limiting indication is used to instruct the target request processing server to stop calling the service resources of the target microservice within the current flow control period;
[0174] The communication module 301 is used to send a current limiting instruction to the target request processing server.
[0175] The exemplary embodiments of the present disclosure further provide a flow control device, which may be a request processing server or a chip applied to the request processing server. Figure 4 FIG. 2 shows a schematic diagram of the structure of another flow control device provided by an exemplary embodiment of the present disclosure. Figure 4 As shown, the device 400 includes:
[0176] Communication module 401, used to receive a user's service call request;
[0177] Processing module 402 is used to obtain the current flow and current flow control quota of the target microservice in the request processing server based on the identifier of the target microservice carried in the service call request;
[0178] The communication module 401 is used to send a quota allocation request to the traffic management server when the current traffic is greater than or equal to the current traffic control quota; wherein the quota allocation request is used to request the traffic management server to adjust the current traffic control quota, obtain the adjusted traffic control quota, and generate a quota adjustment indication based on the adjusted traffic control quota;
[0179] The communication module 401 is also used to receive a quota adjustment instruction sent by the traffic management server;
[0180] The control module 403 is used to perform flow control on the target microservice based on the adjusted flow control quota determined by the quota adjustment indication.
[0181] The exemplary embodiments of the present disclosure also provide an electronic device, comprising: at least one processor; a memory for storing at least one processor-executable instruction; wherein the at least one processor is used to execute the instruction to implement the steps of the above method disclosed in the exemplary embodiments of the present disclosure.
[0182] Figure 5 FIG. 1 shows a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present disclosure. Figure 5 As shown, the electronic device 500 includes at least one processor 501 and a memory 502 coupled to the processor 501 . The processor 501 can execute corresponding steps in the above method disclosed in the exemplary embodiment of the present disclosure.
[0183] The processor 501 may also be referred to as a central processing unit (CPU), which may be an integrated circuit chip having signal processing capabilities. Each step in the method disclosed in the exemplary embodiment of the present disclosure may be completed by an integrated logic circuit of hardware in the processor 501 or by instructions in the form of software. The processor 501 may be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the exemplary embodiment of the present disclosure may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a memory 502, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, or other mature storage media in the art. The processor 501 reads the information in the memory 502 and completes the steps of the method in conjunction with its hardware.
[0184] In addition, when various operations / processes according to the present disclosure are implemented by software and / or firmware, they can be transmitted from a storage medium or a network to a computer system having a dedicated hardware structure, for example, Figure 6 The computer system 600 shown is installed with the programs constituting the software. When the various programs are installed, the computer system can perform various functions, including the functions described above. Figure 6 A schematic diagram of the structure of a computer system provided by an exemplary embodiment of the present disclosure is shown.
[0185] Computer system 600 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, 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 claimed herein.
[0186] like Figure 6As shown, the computer system 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0187] A plurality of components in the computer system 600 are connected to the I / O interface 605, including: an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. The input unit 606 can be any type of device capable of inputting information to the computer system 600, and the input unit 606 can receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 607 can be any type of device capable of presenting information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 608 can include but is not limited to a disk, an optical disk. The communication unit 609 allows the computer system 600 to exchange information / data with other devices over a network such as the Internet, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, for example, a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0188] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 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 601 performs the various methods and processes described above. For example, in some embodiments, the above methods disclosed in the exemplary embodiments of the present disclosure may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on an electronic device via a ROM 602 and / or a communication unit 609. In some embodiments, the computing unit 601 may be configured to perform the above methods disclosed in the exemplary embodiments of the present disclosure by any other appropriate means (e.g., by means of firmware).
[0189] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the above method disclosed in the exemplary embodiments of the present disclosure.
[0190] The computer-readable storage medium in the exemplary embodiment of the present disclosure 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. The above-mentioned computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the above. More specifically, the above-mentioned computer-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 above.
[0191] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0192] The exemplary embodiments of the present disclosure further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor, the above method disclosed in the exemplary embodiments of the present disclosure is implemented.
[0193] In embodiments of the present disclosure, computer program codes for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer.
[0194] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0195] The modules, components or units involved in the exemplary embodiments described in the present disclosure may be implemented by software or hardware, wherein the names of the modules, components or units do not, in some cases, limit the modules, components or units themselves.
[0196] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0197] The above descriptions are only some embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, a technical solution formed by replacing the above features with the technical features with similar functions disclosed in the present disclosure (but not limited to).
[0198] Although some specific embodiments of the present disclosure have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present disclosure. It should be understood by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.
Claims
1. A flow control method, characterized in that: Applied to a traffic management server, the method comprises: Receive a quota allocation request sent by a target request processing server among multiple request processing servers, and obtain the current total flow and total flow control quota of the target microservice based on the identifier of the target microservice carried in the quota allocation request; wherein the target microservice is deployed in each of the request processing servers; When the current total flow is less than the total flow control quota, obtain the current communication time interval, the shortest allowed communication time interval and the current flow control quota of the target microservice in the target request processing server; Based on the comparison result of the current communication time interval and the shortest allowed communication time interval, a target quota adjustment strategy is determined from a plurality of preset quota adjustment strategies, and the current flow control quota is adjusted using the target quota adjustment strategy to obtain an adjusted flow control quota; A quota adjustment indication is generated based on the adjusted flow control quota, and the quota adjustment indication is sent to the target request processing server; wherein the quota adjustment indication is used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice.
2. The method according to claim 1, characterized in that The multiple preset quota adjustment strategies include a first quota adjustment strategy and a second quota adjustment strategy, the first quota adjustment strategy is related to the ratio between the current communication time interval and the shortest allowed communication time interval, and the second quota adjustment strategy is related to the traffic pressure data of the target microservice in the target request processing server; The step of determining a target credit limit adjustment strategy from a plurality of preset credit limit adjustment strategies based on a comparison result of the current communication time interval with the shortest allowed communication time interval includes: If the current communication time interval is less than the shortest allowed communication time interval, determining the first credit limit adjustment strategy as a target credit limit adjustment strategy; If the current communication time interval is greater than or equal to the shortest allowed communication time interval, the second credit limit adjustment strategy is determined to be a target credit limit adjustment strategy.
3. The method according to claim 2, characterized in that The step of adjusting the current flow control quota by using the target quota adjustment strategy to obtain an adjusted flow control quota includes: Acquire a ratio between the current communication time interval and the shortest allowed communication time interval; An adjusted flow control quota is calculated based on the ratio, the current flow control quota and the first quota adjustment strategy.
4. The method according to claim 2, characterized in that: The traffic pressure data includes the traffic pressure of the current communication time interval and the traffic pressure of at least two historical communication time intervals closest to the current communication time interval, and the traffic pressure is used to represent the number of service call requests for the target microservice received by the target request processing server per unit time; The step of adjusting the current flow control quota by using the target quota adjustment strategy to obtain an adjusted flow control quota includes: Acquire the flow pressure of the current communication time interval and the flow pressure of at least two historical communication time intervals that are closest to the current communication time interval; Determine the traffic pressure trend data of the target microservice in the target request processing server based on the traffic pressure of the current communication time interval and the traffic pressures of at least two historical communication time intervals that are closest to the current communication time interval; An adjusted flow control quota is calculated based on the flow pressure trend data, the current flow control quota and the second quota adjustment strategy.
5. The method according to claim 1, characterized in that The method further comprises: Obtain the remaining amount of traffic control for the target microservice; If the adjusted flow control quota is less than or equal to the flow control remaining quota, executing the step of generating a quota adjustment indication based on the adjusted flow control quota; If the adjusted flow control quota is greater than the flow control remaining quota, the flow control remaining quota is determined as the adjusted flow control quota, and the step of generating a quota adjustment indication based on the adjusted flow control quota is performed.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: When the current total flow is greater than or equal to the total flow control amount, a flow limiting indication is generated; wherein the flow limiting indication is used to instruct the target request processing server to stop calling the service resources of the target microservice within the current flow control period; The current limiting indication is sent to the target request processing server.
7. A flow control method, characterized in that: Applied to a request processing server, the method comprises: Receive a service call request from a user, and based on an identifier of a target microservice carried in the service call request, obtain a current flow and a current flow control quota of the target microservice in the request processing server; When the current flow is greater than or equal to the current flow control quota, a quota allocation request is sent to the flow management server; wherein the quota allocation request is used to request the flow management server to adjust the current flow control quota, obtain the adjusted flow control quota, and generate a quota adjustment indication based on the adjusted flow control quota; The quota adjustment instruction sent by the traffic management server is received, and based on the adjusted traffic control quota determined by the quota adjustment instruction, traffic control is performed on the target microservice.
8. A flow control device, characterized in that: Applied to a traffic management server, the device comprises: A communication module, used for receiving a quota allocation request sent by a target request processing server among multiple request processing servers; A processing module, configured to obtain the current total flow and total flow control quota of the target microservice based on the identifier of the target microservice carried in the quota allocation request; wherein the target microservice is deployed in each of the request processing servers; The processing module is also used to obtain the current communication time interval, the shortest allowed communication time interval and the current flow control quota of the target microservice in the target request processing server when the current total flow is less than the total flow control quota; The processing module is further used to determine a target credit limit adjustment strategy from a plurality of preset credit limit adjustment strategies based on a comparison result between the current communication time interval and the shortest allowed communication time interval; An adjustment module, configured to adjust the current flow control quota using the target quota adjustment strategy to obtain an adjusted flow control quota; A generating module, configured to generate a quota adjustment indication based on the adjusted flow control quota; The communication module is used to send the quota adjustment instruction to the target request processing server; wherein the quota adjustment instruction is used to instruct the target request processing server to use the adjusted flow control quota to perform flow control on the target microservice.
9. A flow control device, characterized in that: Applied to a request processing server, the device comprises: A communication module, used to receive a user's service call request; A processing module, configured to obtain the current flow and current flow control quota of the target microservice in the request processing server based on the identifier of the target microservice carried in the service call request; A communication module, configured to send a quota allocation request to a traffic management server when the current traffic is greater than or equal to the current traffic control quota; wherein the quota allocation request is used to request the traffic management server to adjust the current traffic control quota, obtain the adjusted traffic control quota, and generate a quota adjustment indication based on the adjusted traffic control quota; The communication module is also used to receive the quota adjustment instruction sent by the traffic management server; A control module is used to perform flow control on the target microservice based on the adjusted flow control quota determined by the quota adjustment indication.
10. An electronic device, characterized in that: include: at least one processor; a memory for storing the at least one processor-executable instruction; The at least one processor is used to execute the instructions to implement the steps of the method according to any one of claims 1 to 6 or 7.
11. A computer program product, characterized in that The method comprises a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 or 7 are implemented.
Citation Information
Patent Citations
Micro-service distributed current limiting method and device, storage medium and electronic equipment
CN110753131A
Flow control system, method and device
CN117014346A
System and method for a line of credit based digital content multichambered cloud based distribution platform
US20220156714A1
Flow control method, apparatus and system
WO2024198573A1