Flow control method, communication system, computer equipment and storage medium

By sensing the link congestion status on the server and sending notification messages to the consumer side, the consumer side performs traffic control according to the request priority, solving the problems of inaccurate traffic control and waste of resources in the existing technology, and achieving efficient and accurate traffic management.

CN120223757APending Publication Date: 2025-06-27ZHEJIANG ZEEKR INTELLIGENT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510356768.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The prior art has problems such as inaccurate control, memory growth and waste of server resources in traffic control, making it difficult to effectively identify link congestion status and quickly adapt to network changes.

Method used

The server determines the link congestion status based on the service request cache upper limit and request accumulation status, and sends a notification message to the consumer side. The consumer side controls each service according to the request priority provided by the server side and dynamically adjusts the flow control strategy.

Benefits of technology

It improves the accuracy of traffic control, avoids memory growth and server resource waste, can timely identify link congestion status and quickly adapt to network changes, and meets high real-time requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120223757A_ABST
    Figure CN120223757A_ABST
Patent Text Reader

Abstract

The invention relates to a flow control method, a communication system, computer equipment and a storage medium. The method comprises the following steps: a server determines a link congestion state according to a service request cache upper limit and a request accumulation condition, and sends a notification message for indicating the link congestion state to each consumer in a link; the service request cache upper limit is determined according to a preset effective request response time and a request response time mean value in past preset duration; and each consumption end responds to the received notification message, and when it is determined that the notification message indicates that the link congestion state is congestion, flow control is performed on each service according to the request priority corresponding to each service provided by the server. According to the method and the device, the accuracy of flow control can be improved while the processing capacity of the server side is fully utilized, the problems of memory growth, server side resource waste and the like are avoided, the link congestion state can be identified more timely and accurately, and network changes can be adapted more quickly to perform flow control strategy adjustment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of vehicles, and particularly to a traffic control method, a communication system, a computer device, and a storage medium. Background Art

[0002] With the advancement of autonomous driving technology and the continuous increase in the number of in-vehicle software services, the requirements for the stability and availability of communication middleware have been gradually improved.

[0003] 1. Control the sending buffer of the consumer side. If it exceeds the buffer capacity, it will be directly discarded;

[0004] 2. Control the total amount of messages sent by the consumer side within a time period;

[0005] 3. Control the receiving buffer of the server side. If it exceeds the buffer capacity, it will be directly discarded;

[0006] The above are the current relatively common traffic control solutions for communication middleware. These solutions mainly control traffic from a single-point perspective, either throttling a single consumer side or directly throttling at the server side. This will cause problems such as inaccurate control, memory growth, and waste of server resources during traffic control. Summary of the Invention

[0007] In view of the above deficiencies or drawbacks, this application provides a traffic control method, a communication system, a computer device, and a storage medium. The embodiments of this application can make full use of the processing power of the server side, improve the accuracy of traffic control, avoid problems such as memory growth and waste of server resources, and can also more timely and accurately identify the link congestion state, and more quickly adapt to network changes to adjust the flow control strategy.

[0008] According to a first aspect of this application, a traffic control method is provided. In some embodiments, the method includes:

[0009] The server determines the link congestion state according to the service request buffer upper limit and the request accumulation status, and sends a notification message indicating the link congestion state to each consumer side in the link; the service request buffer upper limit is determined according to a preset effective request response time and the average value of the request response times in the past preset duration;

[0010] In response to receiving the notification message, each consumer side performs traffic control on each service according to the request priority corresponding to each service provided by the server when it determines that the notification message indicates that the link congestion state is congested.

[0011] In some embodiments, the operation of the consumer side performing traffic control on each service according to the request priority corresponding to each service provided by the server includes:

[0012] The consumer determines the traffic control policy corresponding to each service according to the request priority corresponding to each service provided by the server, and sends a service request to the server according to the traffic control policy corresponding to each service.

[0013] In some embodiments, the operation of the server to determine the link congestion state according to the service request cache upper limit and the request backlog status includes:

[0014] The server compares the number of service requests to be processed with the safety threshold. When the number of service requests to be processed is less than or equal to the safety threshold, it determines that the link congestion state is non-congested. When the number of service requests to be processed is greater than or equal to the target alarm threshold, it determines that the link congestion state is congested; the target alarm threshold is greater than the safety threshold; the target alarm threshold is equal to the product of the service request cache upper limit and the preset ratio value.

[0015] In some embodiments, when the link congestion state is congested, the notification message further includes the real-time congestion level determined by the server according to the comparison result of the number of service requests to be processed and multiple alarm thresholds; the target alarm threshold is the minimum value of the multiple alarm thresholds;

[0016] The operation of the consumer to determine the traffic control policy corresponding to each service according to the request priority corresponding to each service provided by the server includes:

[0017] The consumer determines the traffic control policy corresponding to each service according to the request priority corresponding to each service provided by the server and the real-time congestion level.

[0018] In some embodiments, the operation of the consumer to determine the traffic control policy corresponding to each service according to the request priority corresponding to each service provided by the server and the real-time congestion level includes:

[0019] The consumer determines whether traffic control is required for each service according to the request priority corresponding to each service.

[0020] For services determined not to require traffic control, it is determined that the traffic control policy corresponding to the service is an empty policy; the empty policy means that no traffic control is performed on the corresponding service.

[0021] For services determined to require traffic control, it obtains the congestion level corresponding to the request priority of the service. When the real-time congestion level is higher than or equal to the congestion level corresponding to the request priority of the service, it uses the preset traffic control policy corresponding to the real-time congestion level as the traffic control policy corresponding to the service. When the real-time congestion level is lower than the congestion level corresponding to the request priority of the service, it determines that the traffic control policy corresponding to the service is an empty policy.

[0022] In some embodiments, the operation of the server sending a notification message for indicating the link congestion status to each consumer in the link includes:

[0023] When the server determines that the link congestion status is congested, it periodically sends a notification message for indicating that the link congestion status is congested to each consumer in the link until it determines that the link congestion status switches from congested to non-congested.

[0024] In some embodiments, for each service, when the traffic control policy corresponding to the service is not an empty policy, the traffic control policy is used to reduce the service request sending frequency corresponding to the service; the service request sending frequency corresponding to each service is greater than or equal to 0; the service request sending frequency corresponding to the service being 0 means stopping sending service requests for invoking the service to the server; the method further includes:

[0025] After each consumer determines that the notification message indicates that the link congestion status is congested, it records the continuous reception count of the notification message for indicating that the link congestion status is congested, and when the continuous reception count reaches a preset count threshold, it sets the service request sending frequencies corresponding to all services to 0.

[0026] In some embodiments, the method further includes:

[0027] After each consumer determines that the notification message indicates that the link congestion status is congested, when it determines that no notification message is received within a continuous preset number of clock cycles and the heartbeat status is normal, it performs a status alarm and stops traffic control for each service.

[0028] According to a second aspect of the present application, another traffic control method is provided. In some embodiments, the method is applied to a consumer; the method includes:

[0029] Receiving a notification message sent by the server, the notification message being used to indicate the link congestion status determined by the server according to the service request cache upper limit and the request accumulation condition; the service request cache upper limit is determined according to a preset effective request response time and the average value of the request response times in the past preset duration;

[0030] When determining that the notification message indicates that the link congestion status is congested, performing traffic control on each service according to the request priority corresponding to each service provided by the server.

[0031] According to a third aspect of the present application, yet another traffic control method is provided. In some embodiments, the method is applied to the server; the method includes:

[0032] Determining the link congestion status according to the service request cache upper limit and the request accumulation condition; the service request cache upper limit is determined according to a preset effective request response time and the average value of the request response times in the past preset duration;

[0033] Send a notification message indicating the link congestion status to each consumer end in the link; in response to receiving the notification message, each consumer end performs traffic control on each service according to the request priority corresponding to each service provided by the server when it determines that the notification message indicates that the link congestion status is congestion.

[0034] According to a fourth aspect, the present application provides a communication system. In some embodiments, the system includes a server and multiple consumer ends;

[0035] The server is configured to determine the link congestion status according to the service request cache upper limit and the request backlog situation, and send a notification message indicating the link congestion status to each consumer end in the link; the service request cache upper limit is determined according to a preset effective request response time and the average value of the request response times in a past preset duration;

[0036] Each consumer end is configured to perform traffic control on each service according to the request priority corresponding to each service provided by the server when it determines that the notification message indicates that the link congestion status is congestion in response to receiving the notification message.

[0037] According to a fifth aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the traffic control method provided by the second aspect or the third aspect above.

[0038] According to a sixth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the traffic control method provided by the second aspect or the third aspect above.

[0039] In the above embodiments of the present application, the server in the communication system determines the link congestion state according to the service request cache upper limit (which is determined according to the preset effective request response time and the average request response time within the past preset duration) and the request backlog situation, and sends a notification message indicating the link congestion state to each consumer in the link. Each consumer in the communication system, in response to receiving the notification message, when determining that the notification message indicates that the link congestion state is congested, performs traffic control on each service according to the request priority corresponding to each service provided by the server. This communication system senses the traffic congestion situation through the server and notifies each consumer in the link in real time, performs traffic control on the consumer side, and the consumer performs dynamic flow control adjustment according to the real-time congestion situation of the server, which can improve the accuracy of traffic control while making full use of the server processing capacity, and avoid problems such as memory growth and server resource waste, ensuring the stable availability of software services. Moreover, the server side combining the response time of service requests and the cache quantity (representing the number of backlogged service requests) can more timely and accurately identify the link congestion state, and more quickly adapt to network changes for flow control strategy adjustment, so as to meet the high real-time requirements of specific scenarios (such as vehicle-mounted scenarios). BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic flowchart of a traffic control method provided by the present application according to one or more embodiments;

[0041] Figure 2 It is a schematic structural diagram of a communication system provided by the present application according to one or more embodiments;

[0042] Figure 3 It is a schematic interaction flowchart between the server and the consumer provided by the present application according to one or more embodiments;

[0043] Figure 4 It is a schematic management flowchart of the link congestion state by the server provided by the present application according to one or more embodiments;

[0044] Figure 5 It is a schematic management flowchart of the working state by the consumer provided by the present application according to one or more embodiments;

[0045] Figure 6 It is a structural block diagram of a communication system provided by the present application according to one or more embodiments;

[0046] Figure 7 It is an internal structural diagram of a computer device provided by the present application according to one or more embodiments. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0047] To make the objectives, technical solutions, and advantages of this application more clear, the following will further describe the embodiments of this application in detail in conjunction with the accompanying drawings. It should be clear that the described embodiments are only a part of the embodiments of this application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.

[0048] When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. On the contrary, they are merely examples of devices and methods consistent with some aspects of this application as detailed in the appended claims.

[0049] In the description of this application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects and do not have to be used to describe a specific order or sequence, nor can they be construed as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances. In addition, in the description of this application, unless otherwise specified, "a plurality" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.

[0050] In view of the deficiencies of the related art, this application provides a traffic control method for the RPC model of communication middleware (especially in-vehicle communication middleware). This method starts from the perspective of the entire service, perceives the congestion state on the server side and performs precise traffic control on the consumer side, and dynamically adjusts the traffic control method according to the actual situation to solve problems such as waste of server processing capacity, inaccurate traffic control, and memory growth and processing delay exceeding expectations caused by inaccurate traffic control that often occur in the implementation of the related art.

[0051] The RPC (Remote Procedure Call) model refers to the remote procedure call model. The RPC model allows a program (the consumer or client) to request services from another program (the provider) over the network, just like calling a local function, without having to worry about the details of the underlying network technology. The core idea of the RPC model is to make service calls in the network transparent and simple, enabling developers to call remote methods as if they were local methods when writing code. The application of the RPC model in communication middleware can make method calls between different services more convenient, greatly simplifying service communication in distributed systems. In some embodiments, the communication middleware can be an in-vehicle communication middleware, such as SOME / IP (Scalabe service-Oriented MiddlewarE over IP protocol), which is a flexible service-oriented middleware based on the IP protocol.

[0052] According to a first aspect, the present application provides a traffic control method, which can be applied to a communication system constructed based on the RPC model. In some embodiments, the method includes the steps as Figure 1 shown below, and the method will be described in detail below.

[0053] S110: The server determines the link congestion status based on the service request cache upper limit and the request backlog situation, and sends a notification message indicating the link congestion status to each consumer in the link.

[0054] As Figure 2 shown, the communication system includes a server and consumers. The consumer is the end that actively sends service requests or invokes the services of the server. The server is the end that provides services to the consumers and can provide corresponding services to the consumers according to their service requests. In some embodiments, the consumer can be an in-vehicle terminal or a user terminal, and the server can be the server of various in-vehicle services of the background server, such as the server of the air-conditioning control service, the server of the chassis control service, etc. Each server can usually provide multiple services. For example, the server of the air-conditioning control service can provide services such as air-conditioning on / off service, cooling service, heating service, etc. The consumer can establish a connection with the target server based on actual needs and request the target server to provide a specified service.

[0055] The server and the consumers can establish a communication link in a wireless or wired communication network, and then they can interact through this link. Usually, there is one server and multiple consumers on a link. Each consumer can send a service request (Request) to the server according to its own needs. The server needs to process the received service requests and respond to the consumer that sent the service request based on the processing results.

[0056] There will be a processing delay when the server processes service requests. When multiple consumer terminals initiate service requests to the server simultaneously, it may cause some service requests to not be processed in a timely manner, resulting in request backlogs. When request backlogs occur on the server, traffic control needs to be carried out.

[0057] The server can periodically detect the current request backlog situation, determine the link congestion status based on the current service request cache upper limit and the request backlog situation, and then notify each consumer terminal in the link of the current link congestion status. The service request cache upper limit is dynamically determined based on the preset effective request response time and the average request response time within a preset past duration. The effective request response time is used to indicate how long a service request is valid when being processed. It can be set by the user based on actual business requirements, and the specific value is not restricted in this embodiment. The server will calculate the response time of each service request, starting from the time when the service request is received and ending when the response data is fed back to the relevant consumer terminal after the service request is processed. And it will calculate the average request response time (representing the average response time of a single service request) based on the response times of each service request processed within a preset past duration (such as the past 10 seconds), and dynamically adjust the service request cache upper limit based on the calculated average request response time. In some examples, the service request cache upper limit = effective request response time / (average request response time + transmission delay empirical value). The transmission delay in different application scenarios is different, and the user can set the specific value of the transmission delay empirical value based on the specific application scenario. For example, in a vehicle communication system, the transmission delay is usually 1 millisecond, so the transmission delay empirical value can be set to 1 millisecond.

[0058] In some specific scenarios, some service requests cannot be rate-limited even in the case of network congestion. For example, the autonomous driving function depends on the fast and accurate communication between various components inside the vehicle. The server still needs to process the service requests related to these functions in a timely manner in the case of network congestion to ensure driving safety. Therefore, when the server calculates the average request response time, it only times the response times of the service requests that can be rate-limited, and does not time the response times of the service requests that cannot be rate-limited. Such an operation can make the average request response time more accurately reflect the server's response to the service requests that can be rate-limited, so as to ensure the normal operation of critical services while implementing precise dynamic traffic control for non-critical services.

[0059] In some embodiments, the operation of the server determining the link congestion state based on the service request cache upper limit and the request backlog status includes: the server compares the number of service requests to be processed with a safety threshold. When the number of service requests to be processed is less than or equal to the safety threshold, it determines that the link congestion state is non-congested. When the number of service requests to be processed is greater than or equal to the target warning threshold, it determines that the link congestion state is congested. The target warning threshold is greater than the safety threshold.

[0060] The response time and the cache quantity (representing the number of backlogged service requests) can reflect the dynamic load state of the link from different dimensions. Among them, the cache quantity can reflect the scale of service request backlog, but it is not very good at reflecting the instantaneous change of link load. The response time can reflect the processing efficiency of the server for service requests, and the change in the response time usually precedes the occurrence of request backlog. For example, when the network delay starts to increase, the processing time of a single service request will increase first, and the backlog quantity of requests may not have increased significantly yet. Therefore, the response time can better reflect the instantaneous change of link load, but the response time may have significant fluctuations due to bursty traffic, which may lead to misjudgment. This application combines the two, that is, dynamically determines the upper limit of the cache quantity (i.e., the cache upper limit of service requests) based on the response time, and then identifies the congestion degree based on the cache upper limit and the actual cache quantity. In this way, the congestion state of the link can be identified more timely and accurately, minimizing misjudgment as much as possible and avoiding false triggering of flow limiting.

[0061] The link congestion state can be divided into two major states, namely congested and non-congested. The server can compare the number of service requests to be processed (representing the number of unprocessed service requests) with the safety threshold and the target warning threshold to determine whether the current link congestion state is congested or non-congested. The target warning threshold is dynamically calculated based on the current service request cache upper limit. In some examples, the target warning threshold is equal to the product of the service request cache upper limit and a preset ratio value. The preset ratio value can be set and adjusted according to actual needs, such as 50%, 60%, etc.

[0062] The safety threshold can be a preset threshold, and its value can be set according to actual business needs.

[0063] In some examples, the safety threshold is obtained by subtracting a specified difference from the current target warning threshold. When the target warning threshold and the safety threshold are too close, it may cause the link congestion state to switch frequently, which will lead to unstable system operation. For example, assume that the clock cycle for the server to perform calculations is 10 ms, the target warning threshold is set to 30, and the safety threshold is set to 25. The server's service request processing capacity is to process one service request per 1 ms (millisecond). If the number of service requests to be processed at the start of a certain clock cycle reaches 30, the link congestion state will be updated to congested. The server can process 5 service requests in 5 ms. At this time, the number of service requests to be processed drops to 25, and the link congestion state is updated to non-congested. If the server receives new service requests, such as 5, the link congestion state will be updated to congested again. As the server continues to process service requests, the link congestion state will be updated to non-congested after 5 ms. That is, the state switch of congested - non-congested - congested - non-congested may occur within this clock cycle, and this setting will affect the stable operation of the system. Therefore, on the basis of ensuring that the target warning threshold is greater than the safety threshold, the difference between the two can be determined according to the service request processing capacity of the server and the length of the clock cycle to ensure the stable operation of the system.

[0064] In some embodiments, the congestion state may include multiple congestion levels corresponding to different degrees of congestion, such as mild congestion, moderate congestion, severe congestion, etc., so as to implement more refined traffic policies. At this time, in order to determine the degree of congestion of the congestion state, multiple different warning thresholds can be set. Then, by comparing the number of service requests to be processed with each warning threshold, the congestion level of the congestion state can be determined. The multiple warning thresholds can be obtained by multiplying the current upper limit of the service request cache by multiple preset ratio values. For example, the current upper limit of the service request cache is 100, and the multiple ratio values are 30%, 40%, and 50% respectively. Three warning thresholds can be obtained, which are 30, 40, and 50 respectively. When the number of service requests to be processed is greater than or equal to 30 and less than 40, it is determined that the congestion level is mild congestion. When the number of service requests to be processed is greater than or equal to 40 and less than 50, it is determined that the congestion level is moderate congestion. When the number of service requests to be processed is greater than or equal to 50, it is determined that the congestion level is severe congestion. Among them, the target warning threshold in the above embodiments is the minimum value among these warning thresholds. Correspondingly, the above preset ratio value is the minimum value among the preset ratio values.

[0065] In some embodiments, to make full use of communication resources, the server can use a communication message capable of carrying different status information to indicate different link congestion statuses to the consumer side. For example, when it is determined that the link congestion status is congested, the server sends a notification message carrying an alarm status (such as StateNotify with Alarm) to the consumer side. When it is determined that the link congestion status is non-congested, the server sends a notification message carrying a safe status (such as StateNotifywith Satisfy) to the consumer side.

[0066] In some embodiments, after each determination of the link congestion status, the server can send a notification message to each consumer in the link in a broadcast manner. To ensure that the consumer side can successfully receive the notification message, the server can send the notification message multiple times, such as 2 times, when sending the notification message.

[0067] S120: In response to receiving the notification message, each consumer side performs traffic control on each service according to the request priority corresponding to each service provided by the server when it is determined that the notification message indicates that the link congestion status is congested.

[0068] After receiving the notification message sent by the server, the consumer side processes the message with the highest priority and performs traffic control on various services provided by the server. The consumer side can determine various services that the server can provide through multiple methods. For example, the consumer side can determine various services that the server can provide through the dynamic service discovery mechanism provided by SOME / IP. Another example is that the consumer side can actively query the server to determine various services it can provide. The consumer side's traffic control on the services provided by the server mainly controls the sending frequency of service requests used to call the service.

[0069] The operation of the consumer side performing traffic control on each service according to the request priority corresponding to each service provided by the server can be that the consumer side determines the traffic control policy corresponding to each service according to the request priority corresponding to each service provided by the server, and sends a service request to the server according to the traffic control policy corresponding to each service.

[0070] Each service provided by the server has a corresponding request priority. There are multiple levels of request priorities, and different levels of request priorities correspond to different traffic control policies (i.e., traffic control strategies). Among them, specific levels can be divided according to actual business requirements. For example, 2 levels of request priorities are set, namely high priority and low priority. The traffic control policy for high-priority services is empty (indicating no traffic control for the service), and the traffic policy for low-priority services is to perform traffic control on the services provided by the server when the link congestion status is congested. Another example is that 3 levels of request priorities can also be set, namely high priority, medium priority, and low priority. The traffic control policy for high-priority services is empty (indicating no traffic control for the service), the traffic policy for medium-priority services is to perform traffic control on the services provided by the server when the link congestion status is congested and the congestion level is moderately congested, and the traffic policy for low-priority services is to perform traffic control on the services provided by the server when the link congestion status is congested. There can be various ways to set the request priorities corresponding to services. For example, developers can pre-set the corresponding request priorities for each service provided by the server in the system background according to actual business requirements. Exemplarily, high priority can be set for services directly related to normal vehicle driving (such as chassis control services), medium priority can be set for services not related to normal vehicle driving but highly relevant to the passenger's driving experience (such as air conditioner switch services), and low priority can be set for services not related to normal vehicle driving and less relevant to the passenger's driving experience (such as air conditioner temperature adjustment services).

[0071] The traffic control policy corresponding to a service is used to determine the way to perform traffic control on the service. The ways to perform traffic control on a service can include not performing control, stopping sending service requests, and reducing the service request sending frequency. Among them, the flow control method of stopping sending service requests can also be regarded as a special case in the flow control method of reducing the service request sending frequency, that is, the case where the service request sending frequency is reduced to 0. Therefore, the traffic control methods can also include not performing control and reducing the service request sending frequency. The method of reducing the service request sending frequency can include dynamically adjusting the service request sending frequencies corresponding to each service provided by the server according to the real-time congestion level.

[0072] The communication system in the above embodiments can sense the traffic congestion status through the server and inform each consumer in the link in real time, perform traffic control on the consumer side, and the consumer performs dynamic flow control adjustment according to the real-time congestion status of the server, which can improve the accuracy of traffic control while making full use of the server processing capacity, and avoid problems such as memory growth and server resource waste, ensuring the stable availability of software services.

[0073] In some embodiments, if the congestion state includes multiple congestion levels corresponding to different degrees of congestion, the notification message when the link is congested further includes the real-time congestion level determined by the server based on the comparison result of the number of service requests to be processed and multiple warning thresholds. For example, the congestion levels are mild congestion, moderate congestion, and severe congestion respectively, and there are 3 warning thresholds, which are 30, 40, and 50 respectively. When the current number of service requests to be processed is greater than or equal to 30 and less than 40, the real-time congestion level is determined to be mild congestion. When the current number of service requests to be processed is greater than or equal to 40 and less than 50, the real-time congestion level is determined to be moderate congestion. When the current number of service requests to be processed is greater than or equal to 50, the real-time congestion level is determined to be severe congestion.

[0074] Correspondingly, the operation of the consumer to determine the traffic control strategy corresponding to each service according to the request priority corresponding to each service provided by the server includes: the consumer determines the traffic control strategy corresponding to each service according to the request priority corresponding to each service provided by the server and the real-time congestion level.

[0075] The congestion situation of the server is subdivided into multiple degrees of congestion and characterized by different congestion levels. At the same time, each service provided by the server has a corresponding priority. Therefore, when the consumer performs traffic control on the service, it can determine the traffic control strategy required for different services by combining the real-time congestion level of the server and the request priorities of various services, which can improve the flow control accuracy and enhance the stability of the system and the user experience.

[0076] In some embodiments, the operation of the consumer to determine the traffic control strategy corresponding to each service according to the request priority corresponding to each service provided by the server and the real-time congestion level includes: the consumer determines whether each service needs to perform traffic control according to the request priority corresponding to each service; for the service determined not to need to perform traffic control, it is determined that the traffic control strategy corresponding to the service is an empty strategy; the empty strategy means not performing traffic control on the corresponding service; for the service determined to need to perform traffic control, the congestion level corresponding to the request priority of the service is obtained. When the real-time congestion level is higher than or equal to the congestion level corresponding to the request priority of the service, the preset traffic control strategy corresponding to the real-time congestion level is used as the traffic control strategy corresponding to the service. When the real-time congestion level is lower than the congestion level corresponding to the request priority of the service, it is determined that the traffic control strategy corresponding to the service is an empty strategy.

[0077] Some services with higher request priorities do not require traffic control. To more efficiently determine the traffic control strategy for each service, during the operation process of the consumer side to determine the traffic control strategy for each service, it first determines whether traffic control is required by judging the request priority of the service. It can be to query whether there is a corresponding traffic control strategy for the request priority of the service. If no corresponding traffic control strategy is found, it can be determined that the service belongs to the service that does not require traffic control, and the corresponding traffic strategy is determined to be an empty strategy (i.e., there is no traffic control strategy). If a corresponding traffic control strategy is found, it is determined that the service belongs to the service that requires traffic control, extracts the congestion level from the found traffic control strategy, and then compares the real-time congestion level of the server with the extracted congestion level. If the real-time congestion level is higher than or equal to the extracted congestion level, the traffic control strategy corresponding to the real-time congestion level is used as the traffic control strategy corresponding to the service. For example, if the real-time congestion level is "severe congestion" and the traffic control strategy corresponding to the request priority of the service is "perform traffic control when the real-time congestion level reaches moderate congestion", the obtained congestion level is "moderate congestion". Since "severe congestion" is higher than "moderate congestion", the traffic control strategy corresponding to "severe congestion", "reduce the service request sending frequency to 1 / 4", is determined as the traffic control strategy corresponding to the service.

[0078] In some embodiments, the operation of the server to send a notification message indicating the link congestion state to each consumer in the link includes: when the server determines that the link congestion state is congestion, it periodically sends a notification message indicating that the link congestion state is congestion to each consumer in the link until it determines that the link congestion state switches from congestion to non-congestion.

[0079] For each service, when the traffic control strategy corresponding to the service is not an empty strategy, the traffic control strategy is used to reduce the service request sending frequency corresponding to the service; the service request sending frequency corresponding to each service is greater than or equal to 0; the service request sending frequency corresponding to the service being 0 means stopping sending service requests for invoking the service to the server. The method further includes: after each consumer determines that the notification message indicates that the link congestion state is congestion, it records the continuous reception count of the notification message indicating that the link congestion state is congestion. When the continuous reception count reaches the preset count threshold, it sets the service request sending frequencies corresponding to all services to 0.

[0080] After determining that the link congestion state is congestion, the server can periodically send a notification message indicating that the link congestion state is congestion to each consumer in the link, and each consumer can record the number of consecutive received notification messages indicating that the link congestion state is congestion (such as StateNotify with Alarm) (i.e., the above-mentioned consecutive reception number). If this number reaches a preset number threshold (such as 3 times), then stop sending service requests to all services to avoid increasing the service request processing pressure on the server.

[0081] In some embodiments, if there are some services with request priorities that do not require traffic control, when the consecutive reception number reaches the preset number threshold, only set the service request sending frequency of specific services (services whose traffic control policies corresponding to the request priorities are not empty policies) to 0, so that the consumer can still obtain services with high request priorities when the server is at a high load.

[0082] In some embodiments, the method further includes: after each consumer determines that the notification message indicates that the link congestion state is congestion, when it determines that no notification message is received within a consecutive preset number of clock cycles and the heartbeat state is normal, perform status warning and stop traffic control for each service.

[0083] Regardless of whether the server is in a congestion state or how severe the congestion degree is, the consumer will send a heartbeat message to the server based on the preset heartbeat sending rule to maintain a normal connection state with the server. After the consumer determines that the server is in a congestion state, if no notification message sent by the server is received in consecutive multiple cycles (such as 3 cycles), but the heartbeat state is normal during this period, it means that the notification message of the server for indicating the congestion state is abnormal. The consumer will perform status warning so that relevant personnel can timely understand the abnormal state and troubleshoot problems. The consumer will also stop traffic control for the service and send service requests according to the service request sending rule when the server is not congested.

[0084] To better understand the above embodiments, the present application also provides some application examples.

[0085] Please refer to Figure 3 , Figure 3The figure shows the interaction process diagram between the server and the consumer. Each consumer (such as ConsumerA and ConsumerB) can send a service request (Request) to the server (Provider) according to actual needs. When the number of pending service requests does not reach the alarm threshold, the server will process the service request based on the preset business logic and feedback the corresponding processing result (Response) to the consumer. When the number of pending service requests reaches the alarm threshold, the server will send a notification message (StateNotify with Alarm) indicating that the link congestion state is congested to each consumer in the link. As a result, the consumer will perform traffic control on the service (such as stopping sending Requests) to avoid increasing the service request processing pressure on the server. The server will continuously accumulate the service requests, and at the same time, it will periodically send StateNotify with Alarm to each consumer in the link until the number of pending service requests drops to the safety threshold. Then the server will broadcast a notification message (StateNotifywith Satify) indicating that the link congestion state is non-congested.

[0086] Please refer to Figure 4 , Figure 4 The figure shows the management process of the server for the link congestion state. Among them, the server manages the link congestion state through a state machine (which can be called the first state machine). In this example, there are two major states of the link congestion state, namely non-congested and congested, which can be represented by Normal and Alarm respectively. The initial value of the state machine is Normal (indicating non-congested). The server will compare the accumulated message determined each time (referring to the number of pending service requests) with the alarm threshold and the safety threshold, and determine the real-time link congestion state based on the comparison result.

[0087] The consumer needs to execute different business logics under different link congestion states. The consumer can determine the business logic to be executed through a state machine (for the convenience of distinguishing from other state machines, it can be called the second state machine). Please refer to Figure 5 , Figure 5The management process of the working state by the consumer side is shown as follows. Among them, the consumer side manages the working state through a state machine, and different working states correspond to different business logics. There are two major states in the working states in this example, namely normal and silent, which can be represented by Normal and Silence respectively. The value of this state machine can be determined according to the state information carried in the received notification message. If the received notification message is a notification message carrying the security state (StateNotify with Satify), the value is Normal, and the business logic at this time is to normally send a service request Request. If the received notification message is a notification message carrying the alarm state (StateNotify with Alarm), the value is Silence, and the business logic at this time is to perform traffic control on each service, such as stopping sending the service request Request.

[0088] It should be noted that for each step included in the traffic control method provided in any of the above embodiments, unless there is a clear description in this article, the execution of these steps does not have a strict order limit, and these steps can be executed in other orders. Moreover, at least a part of these steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.

[0089] Based on the same inventive concept, the present application provides another traffic control method according to the second aspect, and this method can be applied to the consumer side in the above embodiments. In some embodiments, this method includes:

[0090] (1) Receive a notification message sent by the server, and the notification message is used to indicate the link congestion state determined by the server according to the service request cache upper limit and the request backlog situation; the service request cache upper limit is determined according to the preset effective request response time and the average request response time within the past preset duration;

[0091] (2) When it is determined that the notification message indicates that the link congestion state is congested, perform traffic control on each service according to the request priority corresponding to each service provided by the server.

[0092] Based on the same inventive concept, the present application provides yet another traffic control method according to the third aspect, and this method can be applied to the server in the above embodiments. In some embodiments, this method includes:

[0093] (1) Determine the link congestion status according to the service request cache upper limit and the request backlog situation; the service request cache upper limit is determined according to the preset effective request response time and the average request response time within a preset past duration;

[0094] (2) Send a notification message indicating the link congestion status to each consumer in the link; in response to receiving the notification message, each consumer performs traffic control on each service according to the request priority corresponding to each service provided by the server when determining that the notification message indicates that the link congestion status is congestion.

[0095] The traffic control method provided in the second aspect and the third aspect of this application and the traffic control method provided based on the first aspect of this application have the same inventive concept. For the limitations on the traffic control methods in the second aspect and the third aspect, reference can be made to the limitations on the traffic control method in the first aspect, which will not be elaborated here.

[0096] This application also provides a communication system according to the fourth aspect. In some embodiments, as Figure 6 shown, the system includes a server and multiple consumers;

[0097] The server is used to determine the link congestion status according to the service request cache upper limit and the request backlog situation, and send a notification message indicating the link congestion status to each consumer in the link; the service request cache upper limit is determined according to the preset effective request response time and the average request response time within a preset past duration;

[0098] Each consumer is used to perform traffic control on each service according to the request priority corresponding to each service provided by the server when determining that the notification message indicates that the link congestion status is congestion in response to receiving the notification message.

[0099] For the relevant limitations on the operations that the server and consumers can achieve, reference can be made to the limitations on the traffic control method in the first aspect, which will not be elaborated here.

[0100] This application also provides a computer device according to the fifth aspect. In some embodiments, the computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it can implement the traffic control method provided in any embodiment of the second aspect or the third aspect.

[0101] Furthermore, in some embodiments, the internal structure diagram of the computer device can be as Figure 7As shown in the figure. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as the request priorities corresponding to each service, each request priority, and the traffic control policies corresponding to each congestion level. For the specific stored data, reference can also be made to the definitions in the above method embodiments. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a traffic control method.

[0102] Those skilled in the art can understand that Figure 7 the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0103] According to the sixth aspect of this application, a computer-readable storage medium is also provided. In some embodiments, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, it implements the traffic control method provided in any of the embodiments of the above second aspect or third aspect.

[0104] In the above embodiments of this application, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0105] Those of ordinary skill in the art can understand that all or part of the processes in the above method embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in this application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink), DRAM (SLDRAM), memory bus (Rambus), direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0106] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0107] The above-described embodiments merely represent several implementation manners of this application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application patent shall be subject to the appended claims.

Claims

1. A flow control method, characterized in that: The method comprises: The server determines the link congestion status according to the service request cache upper limit and the request accumulation status, and sends a notification message indicating the link congestion status to each consumer in the link; the service request cache upper limit is determined according to the preset effective request response time and the average of the request response time within the preset time period in the past; In response to receiving the notification message, each of the consumer ends performs flow control on each of the services provided by the server end according to the request priority corresponding to each of the services when determining that the notification message indicates that the link congestion state is congested.

2. The method according to claim 1, characterized in that The operation of the consumer end performing flow control on each service provided by the server end according to the request priority corresponding to each service includes: The consumer determines the flow control strategy corresponding to each service provided by the server according to the request priority corresponding to each service, and sends a service request to the server according to the flow control strategy corresponding to each service.

3. The method according to claim 2, characterized in that The server determines the link congestion status according to the service request cache upper limit and the request accumulation status, including: The server compares the number of pending service requests with a security threshold, and determines that the link congestion state is non-congested when the number of pending service requests is less than or equal to the security threshold, and determines that the link congestion state is congested when the number of pending service requests is greater than or equal to a target alarm threshold; the target alarm threshold is greater than the security threshold; the target alarm threshold is equal to the product of the service request cache upper limit and a preset ratio value.

4. The method according to claim 3, characterized in that When the link congestion state is congested, the notification message further includes a real-time congestion level determined by the server according to a comparison result between the number of pending service requests and a plurality of alarm thresholds; The target alarm threshold is the minimum value among the multiple alarm thresholds; The operation of the consumer end determining the flow control strategy corresponding to each service provided by the server end according to the request priority corresponding to each service provided by the server end includes: The consumer determines a flow control strategy corresponding to each service provided by the server according to the request priority corresponding to each service and the real-time congestion level.

5. The method according to claim 4, characterized in that The operation of the consumer end determining the flow control strategy corresponding to each service provided by the server end according to the request priority corresponding to each service and the real-time congestion level includes: The consumer determines whether flow control is required for each service according to the request priority corresponding to each service; For the service determined not to require flow control, determining that the flow control policy corresponding to the service is an empty policy; the empty policy indicates that flow control is not performed on the corresponding service; For the service determined to require flow control, the congestion level corresponding to the request priority of the service is obtained; when the real-time congestion level is higher than or equal to the congestion level corresponding to the request priority of the service, the preset flow control strategy corresponding to the real-time congestion level is used as the flow control strategy corresponding to the service; when the real-time congestion level is lower than the congestion level corresponding to the request priority of the service, the flow control strategy corresponding to the service is determined to be an empty strategy.

6. The method according to claim 4, characterized in that The operation of the service end sending a notification message indicating the congestion state of the link to each consumer end in the link includes: When determining that the link congestion state is congested, the service end periodically sends a notification message indicating that the link congestion state is congested to each of the consumer ends until determining that the link congestion state is switched from congested to non-congested.

7. The method according to claim 4, characterized in that For each of the services, when the flow control policy corresponding to the service is not an empty policy, the flow control policy is used to reduce the frequency of sending service requests corresponding to the service; the frequency of sending service requests corresponding to each of the services is greater than or equal to 0; The service request sending frequency corresponding to the service is 0, indicating that the service request for invoking the service is stopped from being sent to the server. The method further includes: After determining that the notification message indicates that the link congestion state is congested, each consumer end records the number of consecutive receptions of notification messages indicating that the link congestion state is congested, and when the number of consecutive receptions reaches a preset number threshold, the service request sending frequency corresponding to all the services is set to 0.

8. The method according to claim 1, characterized in that The method further comprises: After each of the consumer ends determines that the notification message indicates that the link congestion state is congested, when it is determined that the notification message has not been received within a continuous preset number of clock cycles and the heartbeat state is normal, a status alarm is issued and flow control for each of the services is stopped.

9. A flow control method, characterized in that: The method comprises: Receive a notification message sent by a server, the notification message being used to indicate a link congestion state determined by the server according to a service request cache upper limit and a request backlog state; the service request cache upper limit is determined according to a preset effective request response time and an average of request response times within a preset time period in the past; When it is determined that the notification message indicates that the link congestion state is congested, flow control is performed on each of the services provided by the server according to the request priority corresponding to each of the services.

10. A flow control method, characterized in that: The method comprises: Determine the link congestion status according to the service request cache upper limit and the request accumulation status; the service request cache upper limit is determined according to the preset effective request response time and the average value of the request response time within the past preset time period; A notification message indicating the congestion status of the link is sent to each consumer end in the link; in response to receiving the notification message, each consumer end, when determining that the notification message indicates that the congestion status of the link is congested, performs flow control on each of the services provided by the service end according to the request priority corresponding to each service.

11. A communication system, characterized in that: The system includes a server and multiple consumer terminals; The server is used to determine the link congestion state according to the service request cache upper limit and the request accumulation state, and send a notification message indicating the link congestion state to each consumer end in the link; The service request cache upper limit is determined based on a preset effective request response time and an average of request response times within a preset time period in the past; Each of the consumer ends is used to, in response to receiving the notification message, perform flow control on each of the services provided by the server end according to the request priority corresponding to each of the services when determining that the notification message indicates that the link congestion state is congested.

12. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 9 to 10 is implemented.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 9 to 10 is implemented.