Flow control method and apparatus, device, and computer readable storage medium
After receiving the message containing the control identifier at the sending end, the data flow to be sent to the receiving end is determined and controlled, and the packet loss problem caused by the burst of data flow in the communication system is solved, and the precise flow control of the data flow and the stability of the communication system are improved.
Patent Information
- Application Number
- PCT/CN2024/138947
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-15
- Filing Date
- 2024-12-12
- Publication Date
- 2025-06-19
AI Technical Summary
In the communication system, the sending end sends too many messages in a short time, resulting in bursts of traffic in the data stream, and the receiving end receives a surge, exceeding the receiving end's ability, resulting in loss of messages.
After receiving the message containing the control identifier sent by the receiving end at the transmitting end, it is determined that the data stream to be sent to the receiving end, and the data stream is flow-controlled according to the control identifier, including pausing or adjusting the transmission rate of the data stream.
Accurate flow control of data flow is realized, which slows down the reception pressure at the receiver, avoids packet loss, and improves the stability of the communication system.
Smart Images

Figure CN2024138947_19062025_PF_FP_ABST
Abstract
Description
Flow control method, device, equipment and computer-readable storage medium
[0001] This application claims priority to Chinese patent application number 202311739757.8, filed on December 15, 2023, entitled “Flow control method, device, equipment and computer-readable storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of communication technology, and in particular to a flow control method, apparatus, device, and computer-readable storage medium. Background Art
[0003] In a communication system, the sender and receiver communicate by exchanging messages to achieve data flow. During data flow transmission, a burst of traffic may occur, caused by the sender sending too many messages in a short period of time. This can lead to a surge in the number of messages received by the receiver, exceeding the receiver's ability to receive messages, resulting in problems such as message loss. Therefore, flow control is necessary on the sender to prevent problems such as message loss caused by bursts of data flow. Summary of the Invention
[0004] This application provides a flow control method, apparatus, device, and computer-readable storage medium to accurately control the flow of data streams. The technical solution is as follows:
[0005] In a first aspect, a flow control method is provided, which is applied to a first device, including: the first device receives a first message sent by a second device, the first message is sent when the second device has insufficient receiving capacity for the data stream, the first message includes identification information and a control identifier of the second device, the control identifier instructs the first device to perform flow control on the data stream sent to the second device; based on the identification information of the second device, determines the first data stream to be sent to the second device from the data stream to be sent by the first device; and performs flow control on the first data stream according to the control identifier.
[0006] In the present application, the second device can send a first message to the first device when the receiving capacity is insufficient. Since the control identifier included in the first message can instruct the first device to control the flow of the data stream sent to the second device, and the identification information of the second device included in the first message can be used by the first device to determine the first data stream that needs to be sent to the second device in the data stream to be sent by the first device, the first device can accurately control the flow of the first data stream according to the control identifier, thereby reducing the receiving pressure of the second device for the data stream.
[0007] In one possible implementation, flow control of a first data stream based on a control identifier includes: obtaining a control policy based on the control identifier, the control policy including at least one of a type of data stream to be sent or a sending rate; and flow control of the first data stream based on the control policy. The control policy in this application includes at least one of a type of data stream to be sent or a sending rate, so that after obtaining the control policy, more precise flow control can be performed on at least one of a type of data stream to be sent in the first data stream or a sending rate of the first data stream based on the control policy.
[0008] In one possible implementation, the first data stream includes a first critical data stream of type critical data stream and a first non-critical data stream of type non-critical data stream, the control strategy includes the type of the data stream to be sent, and the type of the data stream to be sent is the critical data stream; flow control is performed on the first data stream in accordance with the control strategy, including: pausing sending the first non-critical data stream to the second device; and sending the first critical data stream to the second device. In the event that the control strategy includes the type of the data stream to be sent and the type is the critical data stream, the first device may, in accordance with the control strategy, send the first critical data stream of type critical data stream in the first data stream and suspend sending the first non-critical data stream of type non-critical data stream in the first data stream, thereby reducing the number of data streams sent to the second device and thereby achieving precise flow control.
[0009] In one possible implementation, the control strategy includes a sending rate, and flow control of the first data stream is performed according to the control strategy, including: sending the first data stream to the second device at a first rate, where the first rate is determined based on resources used by the second device to receive the data stream. In the present application, the resources used by the second device to receive the data stream can be used to determine the second device's receiving capability for the data stream, and the first rate is also determined based on the resources used by the second device to receive the data stream. Therefore, the first rate is consistent with the second device's receiving capability for the data stream, and sending the first data stream to the second device at the first rate consistent with the receiving capability enables precise flow control of the first data stream.
[0010] In one possible implementation, flow control of the first data stream based on a control identifier includes: obtaining a control effective time; obtaining a control expiration time; and performing flow control on the first data stream based on the control identifier within the effective time and expiration time. By obtaining the control effective time and expiration time and performing flow control on the first data stream within the effective time and expiration time, precise flow control of the data stream can be performed in the time dimension.
[0011] In one possible implementation, the first message also includes an effective time or a pre-effective time, and obtaining the effective time of the control includes: if the first message includes the effective time, obtaining the effective time from the first message; if the first message includes the pre-effective time, obtaining the pre-effective time from the first message and obtaining the effective buffer time of the first device, and determining the effective time based on the pre-effective time and the effective buffer time. If the first message includes the effective time, the effective time can be efficiently obtained from the first message. If the first message includes the pre-effective time, the effective time can be accurately determined based on the effective buffer time and the pre-effective time of the first device.
[0012] In one possible implementation, the first message also includes an expiration time or a pre-failure time, and obtaining the controlled expiration time includes: if the first message includes the expiration time, obtaining the expiration time from the first message; if the first message includes the pre-failure time, obtaining the pre-failure time from the first message and obtaining the expiration buffer time of the first device, and determining the expiration time based on the pre-failure time and the expiration buffer time. If the first message includes the expiration time, the expiration time can be efficiently obtained from the first message. If the first message includes the pre-failure time, the expiration time can be accurately determined based on the expiration buffer time and the pre-failure time of the first device.
[0013] In one possible implementation, the first device and the second device belong to the same multicast group, the multicast group includes multiple devices connected to the second device, the multiple devices include the first device, the first message is a multicast message sent by the second device to the multiple devices, and the first message also includes device information, which is information of the device used to control the data stream sent to the second device; determining the first data stream to be sent to the second device from the data stream to be sent by the first device includes: based on the device information being the same as the device information of the first device, determining the first data stream from the data stream to be sent by the first device according to the identification information of the second device.
[0014] Since the first message is a multicast message, after the second device sends the first message, multiple devices belonging to the same multicast group as the second device can all receive the first message. Therefore, the first message carries the device information of the device that needs to perform flow control on the data stream sent to the second device, which enables multiple devices to determine whether each device needs to perform flow control on the data stream sent to the second device based on the device information in the first message. The multiple devices include the first device, so the first device can also determine whether the first device needs to perform flow control on the data stream sent to the second device based on the device information in the first message. When the device information in the first message is the same as the device information of the first device, the first device can determine that it is necessary to perform flow control on the data stream sent to the second device, and then the first device can determine the first data stream based on the identification information of the second device, and implement flow control on the first data stream based on the control identifier.
[0015] In a second aspect, a flow control method is provided, which is applied to a second device, and the method includes: when the second device has insufficient receiving capacity for the data stream, the second device determines a first device for flow control of the data stream, and the first device is connected to the second device; a first message is sent to the first device, the first message including identification information and a control identifier of the second device, and the control identifier instructs the first device to perform flow control on the data stream sent to the second device.
[0016] The method is to enable the first device to control the flow of the data stream sent to the second device according to the control identifier, and to determine the first data stream that needs to be sent to the second device in the data stream to be sent by the first device according to the identification information of the second device, and then accurately control the flow of the first data stream that needs to be sent to the second device according to the control identifier, thereby alleviating the receiving pressure of the second device for the data stream.
[0017] In one possible implementation, when the second device has insufficient receiving capacity for the data stream, before determining the first device for flow control of the data stream, the method further includes: obtaining the occupancy of resources used by the second device for receiving the data stream; and determining that the second device has insufficient receiving capacity for the data stream based on the occupancy being greater than or equal to a resource occupancy threshold. Since the second device receives and processes the data stream using the resources used to receive the data stream, the second device's receiving capacity for the data stream can be determined based on the resources used to receive the data stream. If the occupancy of the resources used by the second device for receiving the data stream is greater than or equal to the resource occupancy threshold, it means that the second device has fewer available resources and a smaller number of data streams that can continue to be received. Therefore, it can be considered that the second device has insufficient receiving capacity for the data stream, so that flow control of the data stream can be performed in a timely manner.
[0018] In one possible implementation, the occupancy is determined based on at least one of an occupancy ratio of a cache queue used by the second device for caching data streams, an occupancy ratio of a bandwidth used by the second device for receiving data streams, or a usage rate of a processing unit of the second device used for processing data streams. The cache queue used for caching data streams, the bandwidth used for receiving data streams, and the processing unit used for processing data streams are all resources used by the second device for receiving data streams. Based on the usage of at least one of these resources, the occupancy ratio of the resources used by the second device for receiving data streams can be accurately determined.
[0019] In one possible implementation, sending a first message to a first device includes: obtaining a historical sending time of a second message of the same type as the first message last sent by the second device; and sending the first message to the first device based on a time interval between the historical sending time and a time interval when the second device is determined to have insufficient receiving capability for a data stream being greater than or equal to a time threshold, the time threshold being determined based on a transmission delay between the second device and the first device. If the time interval between the historical sending time and a time interval when the second device is determined to have insufficient receiving capability for the data stream being less than the time threshold determined based on the transmission delay, the second device sends the first message to the first device before the second message has been received by the first device, resulting in the first device receiving the first message of the same type as the second message after receiving the second message but before starting to perform flow control on the data stream destined for the second device, or receiving the first message of the same type as the second message before completing flow control on the data stream indicated by the second message. The first message and the second message are of the same type, and therefore, the first message and the second message have the same function. The first message and the second message are duplicated, rendering the first message ineffective and wasting resources.
[0020] In one possible implementation, the second device and the first device belong to the same multicast group, the multicast group includes multiple devices connected to the second device, the multiple devices include the first device, the first message is a multicast message, and the first message also includes device information of the first device. The device information of the first device is used by the first device to determine whether to perform flow control on the first data stream. Because the first message is a multicast message, after the second device sends the first message, multiple devices belonging to the same multicast group as the second device can all receive the first message. Therefore, the first message carries the device information of the first device for which flow control is required for the data stream sent to the second device. This enables the first device to accurately determine the need for flow control on the data stream sent to the second device based on the device information in the first message, and prevents other devices among the multiple devices from performing flow control on the data stream sent to the second device, thereby improving the accuracy of flow control.
[0021] In one possible implementation, the first message also includes at least one of a start time and an end time for instructing the first device to perform flow control on a data stream sent to the second device. The start time includes an effective time or a pre-effective time, and the end time includes an expiration time or a pre-expiration time. By including at least one of the start time and the end time in the first message, the first device can accurately and efficiently determine the effective time or the end time of the control, thereby achieving precise flow control in the time dimension.
[0022] In one possible implementation, when a second device has insufficient receiving capacity for a data stream, determining a first device for flow control of the data stream includes: when the second device has insufficient receiving capacity for the data stream, determining a service to which the data stream for flow control belongs; and determining the first device to which the service belongs. By determining the service requiring flow control and then determining the first device to which the service belongs, the first device corresponding to the data stream requiring flow control can be accurately determined, enabling the first device to accurately perform flow control on the data stream requiring flow control.
[0023] In a possible implementation, the first device and the second device in the first aspect and the second aspect are devices in a vehicle network.
[0024] In a third aspect, a flow control device is provided, which is applied to a first device and includes:
[0025] A receiving module is used to receive a first message sent by a second device. The first message is sent when the second device has insufficient receiving capacity for the data stream. The first message includes identification information and a control identifier of the second device. The control identifier instructs the first device to perform flow control on the data stream sent to the second device; a determining module is used to determine, based on the identification information of the second device, a first data stream to be sent by the first device from the data stream to be sent by the first device; and a control module is used to perform flow control on the first data stream according to the control identifier.
[0026] In a possible implementation, the control module is configured to obtain a control strategy according to the control identifier, where the control strategy includes at least one of a type of data stream to be sent or a sending rate; and perform flow control on the first data stream according to the control strategy.
[0027] In one possible implementation, the first data stream includes a first critical data stream of type critical data stream and a first non-critical data stream of type non-critical data stream, the control strategy includes the type of data stream sent, the type of data stream sent is critical data stream; a control module is used to suspend sending the first non-critical data stream to the second device; and send the first critical data stream to the second device.
[0028] In one possible implementation, the control strategy includes a sending rate, and the control module is configured to send the first data stream to the second device at a first rate, where the first rate is determined based on resources of the second device for receiving the data stream.
[0029] In a possible implementation, the control module is configured to obtain a control effective time; obtain a control expiration time; and perform flow control on the first data flow according to the control identifier within the effective time and the expiration time.
[0030] In one possible implementation, the first message also includes an effective time or a pre-effective time, and the control module is used to obtain the effective time from the first message when the first message includes the effective time; when the first message includes the pre-effective time, obtain the pre-effective time from the first message, and obtain the effective buffer time of the first device, and determine the effective time based on the pre-effective time and the effective buffer time.
[0031] In one possible implementation, the first message also includes an expiration time or a pre-failure time, and the control module is used to obtain the expiration time from the first message when the first message includes the expiration time; when the first message includes the pre-failure time, obtain the pre-failure time from the first message and obtain the failure buffer time of the first device, and determine the expiration time based on the pre-failure time and the failure buffer time.
[0032] In one possible implementation, the first device and the second device belong to the same multicast group, the multicast group includes multiple devices connected to the second device, the multiple devices include the first device, the first message is a multicast message sent by the second device to the multiple devices, and the first message also includes device information, which is information of the device used to control the data stream sent to the second device; a determination module is used to determine the first data stream from the data stream to be sent by the first device based on the device information being the same as the device information of the first device and according to the identification information of the second device.
[0033] In a fourth aspect, a flow control device is provided, which is applied to a second device and includes:
[0034] a determining module, configured to determine, when the second device has insufficient receiving capability for the data stream, a first device for flow control of the data stream, the first device being connected to the second device;
[0035] The sending module is configured to send a first message to the first device, where the first message includes identification information of the second device and a control identifier, and the control identifier instructs the first device to perform flow control on a data stream sent to the second device.
[0036] In one possible implementation, the device also includes an acquisition module, which is used to obtain the occupancy of resources used by the second device to receive the data stream; and the determination module is also used to determine that the second device has insufficient receiving capacity for the data stream based on the occupancy being greater than or equal to a resource occupancy threshold.
[0037] In one possible implementation, the occupancy is determined based on at least one of an occupancy ratio of a cache queue of the second device for caching data flows, an occupancy ratio of a bandwidth of the second device for receiving data flows, or a usage rate of a processing unit of the second device for processing data flows.
[0038] In one possible implementation, a sending module is used to obtain a historical sending time when the second device last sent a second message of the same type as the first message; based on the time interval between the historical sending time and the time when it is determined that the second device has insufficient receiving capacity for the data stream is greater than or equal to a time threshold, send a first message to the first device, and the time threshold is determined based on the transmission delay between the second device and the first device.
[0039] In one possible implementation, the second device and the first device belong to the same multicast group, the multicast group includes multiple devices connected to the second device, the multiple devices include the first device, the first message is a multicast message, and the first message also includes device information of the first device. The device information of the first device is used by the first device to determine flow control of the first data stream.
[0040] In one possible implementation, the first message also includes at least one of a start time and an end time indicating that the first device performs flow control on a data stream sent to the second device, where the start time includes an effective time or a pre-effective time, and the end time includes an expiration time or a pre-expiration time.
[0041] In a possible implementation, the determination module is configured to determine the service to which the data flow used for flow control belongs when the second device has insufficient receiving capability for the data flow; and determine the first device to which the service belongs.
[0042] In a possible implementation, the first device and the second device in the third and fourth aspects are devices in a vehicle network.
[0043] In a fifth aspect, another communication device is provided, comprising: a network interface, a memory, and a processor. The network interface, the memory, and the processor communicate with each other via an internal connection path; the memory is configured to store instructions; and the processor is configured to execute the instructions stored in the memory to control the network interface to receive signals and to control the network interface to send signals. When the processor executes the instructions stored in the memory, the processor performs the method of the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0044] Optionally, there are one or more processors and one or more memories.
[0045] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.
[0046] In a sixth aspect, a communication system is provided, which includes the device in the third aspect or any possible implementation of the third aspect and the device in the fourth aspect or any possible implementation of the fourth aspect.
[0047] In the seventh aspect, a computer program (product) is provided, which includes: computer program code, which, when run by a computer, enables the computer to execute the method in the above-mentioned first aspect, second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0048] In an eighth aspect, a computer-readable storage medium is provided, which stores a program or instruction. When the program or instruction is run on a computer, the method in the above-mentioned first aspect, second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect is executed.
[0049] In the ninth aspect, a chip is provided, comprising a processor for calling and executing instructions stored in a memory from a memory, so that a computer equipped with the chip executes the method of the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0050] In the tenth aspect, another chip is provided, comprising: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected through an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, a computer equipped with the chip executes the method in the above-mentioned first aspect, the second aspect, any possible implementation of the first aspect or any possible implementation of the second aspect.
[0051] It should be understood that the beneficial effects achieved by the technical solutions of the third to tenth aspects of this application and the corresponding possible implementation methods can be found in the above-mentioned technical effects of the first and second aspects and their corresponding possible implementation methods, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] FIG1 is a schematic diagram of the structure of a local area network provided in an embodiment of the present application;
[0053] FIG2 is a schematic diagram showing the effect of not limiting the maximum sending rate causing a traffic burst according to an embodiment of the present application;
[0054] FIG3 is a schematic diagram showing an effect of limiting the maximum sending rate to avoid traffic bursts according to an embodiment of the present application;
[0055] FIG4 is a schematic diagram of the effect of flow superposition provided in an embodiment of the present application;
[0056] FIG5 is a diagram of an implementation scenario provided by an embodiment of the present application;
[0057] FIG6 is a flow chart of a flow control method provided in an embodiment of the present application;
[0058] FIG7 is a schematic diagram of a process for configuring an occupancy threshold according to an embodiment of the present application;
[0059] FIG8 is a schematic diagram of a process of a second device sending a first message according to an embodiment of the present application;
[0060] FIG9 is a schematic diagram of a many-to-one connection relationship provided in an embodiment of the present application;
[0061] FIG10 is a schematic diagram of a process in which a second device and a first device join the same multicast group according to an embodiment of the present application;
[0062] FIG11 is a schematic structural diagram of a first device provided in an embodiment of the present application;
[0063] FIG12 is a schematic diagram of a process for configuring a traffic shaping strategy according to an embodiment of the present application;
[0064] FIG13 is a schematic diagram showing the effect of flow control of a data stream provided in an embodiment of the present application;
[0065] FIG14 is a process diagram of flow control of a data stream provided by an embodiment of the present application;
[0066] FIG15 is a flow chart of a method for controlling a data flow according to an embodiment of the present application;
[0067] FIG16 is a schematic diagram showing the effect of flow control of another data stream provided in an embodiment of the present application;
[0068] FIG17 is a schematic diagram of a process of controlling the flow of a data stream by a first device according to an embodiment of the present application;
[0069] FIG18 is a schematic structural diagram of a flow control device provided in an embodiment of the present application;
[0070] FIG19 is a schematic structural diagram of another flow control device provided in an embodiment of the present application;
[0071] FIG20 is a schematic structural diagram of a flow control device provided in an embodiment of the present application;
[0072] FIG21 is a schematic structural diagram of another flow control device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0073] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.
[0074] A communication network typically includes network nodes of different types or functions, such as a transmitter (Tx) for sending data streams and a receiver (Rx) for receiving data streams. The transmitters and receivers in a communication network can be interconnected to form a network topology. The interconnected transmitters and receivers can achieve data stream transmission through the established connection. The connection established between the transmitter and receiver can be established through an intermediate device, so the network nodes may also include intermediate devices. Intermediate devices can be, for example, switches or routers that can be used to forward data streams. Communication networks can be divided into different types of communication networks based on the scope of their coverage, such as local area networks and wide area networks. The switches in a local area network can also be called local area network switches (LSWs).
[0075] When an intermediary device exists in a communication network, a sender can send a data stream to the intermediary device, and a receiver can receive the data stream forwarded by the intermediary device, thereby achieving data stream transmission between the sender and receiver. For example, referring to Figure 1, a schematic diagram of the structure of a local area network is shown. Sender 0, sender 1, and receiver 0 are all connected to switch 0, while receiver 1 and sender 2 are both connected to switch 1. A communication connection is established between switch 0 and switch 1, enabling communication between them. Switch 0 and switch 1 can both be local area network switches. Each sender and receiver can achieve data stream transmission through switch 0 and switch 1. Taking the data stream transmission process between sender 0 and receiver 1 as an example, sender 0 sends a data stream with a destination address indicating receiver 1 to switch 0. Switch 0 determines that receiver 1 is connected to switch 1, and then switch 0 forwards the data stream to switch 1. Switch 1 then forwards the data stream to receiver 1, indicated by the destination address. Receiver 1 receives the data stream, completing the data stream transmission process.
[0076] Because the resources used by the receiving end to process received data streams are limited, or in other words, the resources used by the receiving end to receive data streams are limited, such as the resources of the central processing unit (CPU) used to process data streams on the receiving end and the bandwidth of the network interface card used to receive data streams on the receiving end, the receiving end's ability to receive data streams at each moment is limited. In some cases, the available resources for receiving data streams at the receiving end are less than the available resources for sending data streams at the receiving end or the switch, resulting in the maximum rate at which the receiving end can receive data streams being lower than the maximum rate at which the sending end and the switch can send data streams to the receiving end. If the sending end and the switch send data streams to the receiving end at the maximum rate, traffic bursts will occur, and data streams will accumulate at the receiving end, overloading the receiving end's receiving capacity, which may lead to data stream loss or packet loss in the data stream. Among them, receiving capacity overload of the receiving end can also be referred to as communication capacity overload of the receiving end. Traffic burst refers to a sudden increase in the number of data streams per unit time.
[0077] For example, the bandwidth of the network card on the receiving end for receiving data streams is 100 megabits per second (Mbps), that is, the maximum receiving rate of the receiving end for data streams is 100 Mbps, while the maximum sending rate of the sending end or switch for sending data streams is 1000 Mbps. In this case, the maximum receiving rate of the receiving end for data streams is lower than the maximum sending rate of the sending end or switch. Therefore, if the sending end or switch sends data streams to the receiving end at a sending rate of 1000 Mbps, and the receiving end receives data streams at a receiving rate of 100 Mbps, data streams will accumulate at the receiving end, causing receiving end overload. Furthermore, because the sending end or switch may continuously send data streams to the receiving end, if the receiving end has not completed processing the previously received data stream when receiving the data stream sent by the sending end or switch, the receiving end may discard the unprocessed data streams from the previously received data stream, resulting in data stream loss and the inability to complete the service corresponding to the discarded data stream.
[0078] In order to prevent the phenomenon of data stream loss caused by overload of the receiving capacity of the receiving end in the communication network, in the field of communication technology, the maximum sending rate of the sending end can be limited so that the sending rate of the sending end for the data stream does not exceed the receiving rate of the receiving end for the data stream. For example, a sending rule including the maximum sending rate after limitation can be deployed or configured at the sending end so that the sending rate of the data stream at the sending end does not exceed the maximum sending rate after limitation. Exemplarily, in the embodiments of the present application, the effect of limiting the maximum sending rate of the sending end is explained by taking Figures 2 and 3 as examples.
[0079] Figure 2 is a schematic diagram of the effect of not limiting the maximum sending rate, resulting in a traffic burst. The dotted line in the figure represents the maximum receiving rate of the receiving end. The sending end begins sending a data stream to the receiving end at time t21, and the sending end gradually increases the sending rate of the data stream until it exceeds the maximum receiving rate of the receiving end, causing a traffic burst. The receiving end is unable to process the received data stream in time, resulting in data loss. Figure 3 is a schematic diagram of the effect of limiting the maximum sending rate to avoid traffic bursts. The maximum receiving rate represented by the dotted line in the figure can be the same as that in Figure 2. By limiting the maximum sending rate of the sending end (indicated by the half-dashed line in Figure 3), the sending end can only send data streams at a rate less than or equal to the maximum sending rate, thereby limiting the number of data streams sent per unit time. In other words, traffic is shaped to prevent the sending rate of the data stream from exceeding the maximum receiving rate of the receiving end.
[0080] Furthermore, comparing Figures 2 and 3 shows that the traffic volume after shaping in Figure 3 varies less than the traffic volume before shaping in Figure 2. For the same number of data streams, the sending time shown in Figure 3 is from t31 to t32, while the sending time shown in Figure 2 is from t21 to t22. This shows that for the same number of data streams, the sending time required after limiting the maximum sending rate is longer than before limiting the maximum sending rate. Therefore, after limiting the maximum sending rate, the receiving end has more time to process the data stream, thereby avoiding data loss.
[0081] In some other situations, the receiving end may be deployed with multiple services, each of which needs to be implemented by receiving and processing different data streams. These multiple services may be deployed in multiple transmitting ends connected to the receiving end, and thus multiple transmitting ends connected to the same receiving end may send multiple data streams corresponding to the multiple services to the receiving end at irregular times. Since multiple transmitting ends may send multiple data streams to the receiving end at the same time, the number of data streams received by the receiving end in a short period of time may increase, which may also cause traffic bursts at the receiving end. If the burst traffic exceeds the receiving capacity of the receiving end, it may also cause the data stream or the message in the data stream to be lost at the receiving end. Moreover, in this case, even if the maximum sending rate of each transmitting end is limited, when multiple transmitting ends send data streams to the same receiving end at the same time, the traffic of the superimposed data streams may still exceed the receiving capacity of the receiving end, causing the receiving capacity of the receiving end to be overloaded.
[0082] For example, referring to the schematic diagram of traffic superposition shown in FIG4 , the receiving end has a receiving capacity of 4 kilo packets per second (Kpps), that is, the receiving end can process 4,000 data packets in the received data stream per second. Transmitters 0, 1, and 2 are all connected to the receiving end, and transmitters 0, 1, and 2 all limit the maximum sending rate for data packets to 3Kpps. When the time when each transmitter sends the data stream is staggered (for example, the sending situation during the time period from t0 to t1), that is, at most one transmitter sends a data stream to the receiving end at the same time, then the rate at which data packets are sent to the receiving end in the communication network will not exceed 3Kpps, and will not exceed the receiving capacity of the receiving end. When the time when multiple senders send data packets to the receiver overlaps (for example, the sending situation during the time period from t1 to t2 or the sending situation during the time period from t2 to t3), that is, two or three senders send data streams to the receiver at the same time, then the superimposed rate of sending data packets to the receiver in the communication network may be 6Kpps or 9Kpps, which exceeds the receiving capacity of the receiver, causing the receiving capacity of the receiver to be overloaded, and thus leading to data packet loss.
[0083] Therefore, in a communication scenario where multiple services are deployed on multiple transmitters, the maximum transmission rate of each transmitter is usually limited to a lower level to ensure that when multiple transmitters send data streams to the receiver at the same time, the superimposed transmission rate is still lower than the receiving capacity of the receiver, thereby avoiding overloading the receiving capacity of the receiver. However, this method tends to limit the transmission rate of each transmitter too low, reducing the utilization rate of the resources used by the transmitter to send data streams. For example, if the maximum receiving rate of the receiver is 10Mbps, and the receiver is connected to 9 transmitters, and the maximum transmission rate of each transmitter is limited to 1Mbps, then even if the 9 transmitters send data streams to the receiver at the maximum transmission rate at the same time, the transmission rate of the superimposed data stream is 9Mbps, and the transmission rate of the superimposed data stream is still lower than the maximum receiving rate of the receiver, it will not cause the receiving capacity of the receiver to be overloaded.
[0084] However, if the maximum sending rate of a sender is continuously limited to a low level, the resources available to the sender for sending data streams will be insufficient. For example, the bandwidth used for sending data streams will be underutilized, which will reduce the sender's performance. Furthermore, multiple senders do not continuously send data streams simultaneously. Only in a small number of cases do multiple senders send data streams to the same receiver simultaneously. Therefore, in most cases, limiting the maximum sending rate of each sender too low will result in a waste of resources.
[0085] In the field of communication technology, in order to avoid the above situation, the receiving end will sense whether the receiving capacity of the receiving end is insufficient. If the receiving capacity of the receiving end is still acceptable, the sending end will send a data stream to the receiving end at a higher sending rate. If the receiving capacity is insufficient, the receiving end will feedback the insufficient receiving capacity of the receiving end to the sending end connected to the receiving end. After receiving the feedback, the sending end immediately stops sending all data streams to achieve data flow control. However, this method will cause other receiving ends with acceptable receiving capacity to be unable to receive the data stream, resulting in the services of other receiving ends being affected. The embodiment of the present application provides a flow control method that can accurately control the flow of data streams sent to a receiving end with insufficient receiving capacity.
[0086] Referring to Figure 5, an implementation scenario diagram of an embodiment of the present application is shown, which includes a first device 51 and a second device 52. The first device 51 and the second device 52 can be connected to each other via wired or wireless communication. Optionally, an intermediate device can be connected between the first device 51 and the second device 52, and the first device 51 and the second device 52 can communicate through the intermediate device. The first device 51 and the second device 52 can be each other's sending end and receiving end, that is, in the direction in which the first device 51 sends a data stream to the second device 52, the first device 51 is the sending end and the second device 52 is the receiving end; in the direction in which the second device 52 sends a data stream to the first device 51, the second device 52 is the sending end and the first device 51 is the receiving end. In some cases, the first device 51 and the second device 52 can be terminals, servers or intermediate devices.
[0087] The communication network to which the first device 51 and the second device 52 belong may be an in-vehicle network, an in-vehicle Ethernet network, an industrial Internet network, or another type of communication network. The present embodiment of the application does not limit the type of communication network to which the first device 51 and the second device 52 belong. When the first device 51 and the second device 52 belong to an in-vehicle network, the first device 51 and the second device 52 may be devices in the in-vehicle network, such as an in-vehicle terminal.
[0088] The flow control method provided in the embodiment of the present application can be applied to the implementation scenario shown in FIG5 , referring to the method flow chart shown in FIG6 , and the method includes but is not limited to the following S601 to S605 .
[0089] S601: When the second device has insufficient receiving capability for the data stream, the second device determines a first device for flow control of the data stream, and the first device is connected to the second device.
[0090] Among them, the receiving capacity of the second device can be determined based on the resources used by the second device to receive the data stream. The embodiment of the present application does not limit the resources used by the second device to receive the data stream. Exemplarily, the resources may include at least one of the cache queue used by the second device to cache the data stream, the bandwidth of the second device to receive the data stream, or the resources of the processing unit of the second device to process the data stream. The maximum value of the receiving capacity, that is, the maximum receiving capacity of the second device, can be determined based on the maximum value of the resource. For example, the maximum value of the receiving capacity of the second device can be determined based on at least one of the maximum length of the cache queue, the maximum value of the bandwidth, and the maximum utilization rate of the resources of the processing unit. Taking the bandwidth used by the second device to receive the data stream as an example, if the maximum value of the bandwidth used by the second device to receive the data stream is 400Mbps, 400Mbps can be determined as the maximum receiving capacity of the second device. If the rate at which the second device receives the data stream exceeds 400Mbps, the receiving capacity of the second device will be overloaded, resulting in the loss of the data stream or the message in the data stream.
[0091] The insufficient receiving capacity of the second device for the data stream may mean that the second device has a small margin of receiving capacity for the data stream, making it difficult to continue receiving a large amount of data streams. The margin of receiving capacity may be the difference between the maximum receiving capacity and the used receiving capacity of the second device. The used receiving capacity of the second device can be determined based on the amount of resources used by the second device for receiving the data stream. Therefore, in the embodiment of the present application, whether the second device has insufficient receiving capacity can be determined by the size of the resources used by the second device for receiving the data stream and the amount of resources used.
[0092] Exemplarily, the second device may obtain the occupancy of resources used by the second device for receiving the data stream, determine the difference between the occupancy and an occupancy threshold, and determine that the second device has insufficient reception capacity for the data stream based on the occupancy being greater than or equal to the resource occupancy threshold. Optionally, the occupancy may be determined based on at least one of the occupancy ratio of a cache queue used by the second device for caching the data stream, the occupancy ratio of the bandwidth used by the second device for receiving the data stream, or the utilization rate of a processing unit of the second device for processing the data stream.
[0093] In one possible implementation, the occupancy threshold can be set based on experience or user needs, or it can be determined based on the business traffic size of the first device and the resources used by the second device to receive the data stream, and the configuration of the occupancy threshold can be achieved through a configuration tool or a configuration file. Referring to Figure 7, a schematic diagram of a process for configuring the occupancy threshold is shown. The second device or the control device connected to the second device can determine the occupancy threshold based on the business traffic size of the first device connected to the second device and the resource size of the second device. Among them, the business traffic size of the first device refers to the average rate at which the first device sends the business data stream within a period of time. The size of the period of time can be set based on experience or user needs, for example, it can be 1 hour.
[0094] In some cases, the resource occupation threshold of the second device may be positively correlated with the resource size of the second device. The reason is that if the resource size of the second device is large, setting the resource occupation threshold of the second device to a smaller value will cause the resource occupation amount of the second device to easily reach the resource occupation threshold, thereby causing the first device to frequently perform flow control on the data stream sent to the second device, reducing the flow of the data stream sent to the second device, so that most of the resources used by the second device to receive and process the data stream are not used, and the bandwidth utilization rate for receiving the data stream is low, resulting in waste. If the resource size of the second device is large, setting the resource occupation threshold of the second device to a larger value will make the resource occupation amount of the second device less likely to reach the resource occupation threshold of the second device. In most cases, the first device will send the data stream to the second device at a higher rate, which can reduce the waste of resources used by the second device to receive and process the data stream.
[0095] In addition, the resource occupation threshold of the second device may be negatively correlated with the business traffic size of the first device. The reason is that if the resource occupation amount of the second device reaches the resource occupation threshold at the first moment, the first device starts to control the traffic of the data stream sent to the second device at the second moment, then between the first moment and the second moment, the first device still sends the data stream to the second device according to the traffic before control. In this case, if the business traffic size of the first device is large, and the resource occupation threshold of the second device is large, the resource occupation threshold of the second device is closer to the maximum value of the resources of the second device, then between the first moment and the second moment, the number of data streams received by the second device increases rapidly, and it is easy to reach the maximum value of the resources of the second device on the basis that the resource occupation amount of the second device has reached the resource occupation threshold, thereby causing the receiving capacity of the second device to be overloaded. If the service flow of the first device is small, even if the resource occupation threshold of the second device is large and the resource occupation threshold of the second device is closer to the maximum value of the resources of the second device, the number of data streams received by the second device increases slowly between the first moment and the second moment, and it is not easy for the resource occupation of the second device to reach the maximum value of the resources of the second device after the resource occupation of the second device has reached the resource occupation threshold, nor is it easy to cause the receiving capacity of the second device to be overloaded. Therefore, when the service flow of the first device is small, the resource occupation threshold of the second device can be determined to be a larger value. For similar reasons, when the service flow of the first device is large, the resource occupation threshold of the second device can be determined to be a smaller value.
[0096] Continuing with FIG7 , after determining the resource occupancy threshold of the second device, the resource occupancy threshold can be configured for the second device. The embodiment of the present application does not limit the method for configuring the resource occupancy threshold. For example, the occupancy threshold of the second device can be configured by configuring a file or script on the second device that can indicate the resource occupancy threshold.
[0097] After completing the configuration of the resource occupancy threshold of the second device, it is possible to determine whether the second device has insufficient receiving capacity based on the relative size of the resource occupancy of the second device and the occupancy threshold. Taking the resource used by the second device for receiving data streams as a cache queue used by the second device for receiving data streams as an example, the occupancy threshold may be 80% of the length of the cache queue. If the resource occupancy is 80%, which is equal to the occupancy threshold, it can be considered that the receiving capacity of the second device has reached the receiving capacity threshold, the remaining available resources of the second device are relatively small, and the remaining receiving capacity is insufficient to receive a large number of data streams. Therefore, it can be determined that the second device has insufficient receiving capacity for the data stream.
[0098] In one possible implementation, after a first device establishes a connection with a second device, the first device can begin to continuously send a service data stream to the second device for implementing service interaction. The service data stream includes service messages, which can also be called network messages. The second device can then continuously receive the service data stream sent by the first device. Therefore, after each time the second device receives a service data stream sent by the first device, it can obtain the resource usage of the second device in real time, and promptly determine whether the second device has insufficient receiving capacity, thereby avoiding the loss of messages in the data stream caused by flow control after the second device's receiving capacity is overloaded.
[0099] When the second device determines that the second device has insufficient receiving capacity for the data stream, the second device may determine a first device for flow control of the data stream sent to the second device. The embodiments of the present application do not limit the method by which the second device determines the first device. For example, when the second device has insufficient receiving capacity for the data stream, the second device may determine the service to which the data stream for flow control belongs, and thereby determine the first device to which the service belongs.
[0100] In some cases, multiple services are deployed on the second device, and different services have different priorities. Different services are implemented by processing different data streams. Different services may be deployed on different devices connected to the second device. In the case that the receiving capacity of the second device is insufficient, flow control can be performed on the data stream corresponding to the lower priority service first, and flow control can not be performed on the data stream corresponding to the higher priority service, so as to reduce the impact on the higher priority service. After determining the service to which the data stream that needs to be flow controlled belongs, the first device connected to the second device and deployed with the determined service can be determined. The determined first device is the first device that needs to perform flow control on the data stream sent to the second device.
[0101] In addition, the first device can be determined based on the business traffic size of multiple devices connected to the second device. For example, a device with larger business traffic can be determined as the first device to control the business data flow with larger traffic and improve the efficiency of traffic control.
[0102] S602: The second device sends a first message to the first device. The first message includes identification information of the second device and a control identifier. The control identifier instructs the first device to perform flow control on a data stream sent to the second device.
[0103] After the second device determines that the first device requires flow control, it can generate a first message and add the second device's identification information and control identifier to the first message, so that the first device can perform flow control on the data stream sent to the second device after receiving the first message sent by the second device. Optionally, because the first message can not only indicate that the first device needs to perform flow control on the data stream sent to the second device, but can also be used to provide feedback on insufficient receiving capacity of the second device, the first message can also be called a feedback message, and the control identifier can also be called a feedback signal.
[0104] The identification information of the second device may be the address of the second device, such as the Internet Protocol (IP) address or Media Access Control (MAC) address of the second device, or may be information that can identify the second device, such as the name or number of the second device. The control identifier may be a symbol or string that can instruct the first device to perform flow control on a data stream sent to the second device.
[0105] Since the first device continuously sends a service data stream to the second device, the second device may have insufficient receiving capacity multiple times in the process of continuously receiving the service data stream, and each time the receiving capacity is insufficient, it needs to send a first message to the first device. If the second device has insufficient receiving capacity twice in a short period of time, if the second device sends two first messages to the first device in a short period of time, the two first messages have the same function, which may cause one of the first messages to be unable to function, resulting in a waste of resources. Therefore, in the process of sending the first message to the first device, the second device can obtain the historical sending time of the second device last sending the second message of the same type as the first message; based on the time interval between the historical sending time and the time when it is determined that the second device has insufficient receiving capacity for the data stream is greater than or equal to the time threshold, the first message is sent to the first device, and the time threshold is determined based on the transmission delay between the second device and the first device. Among them, the second message is the first message sent by the second device before sending the currently generated first message. To avoid confusion of concepts, in the embodiment of the present application, the first message sent by the second device last time is temporarily referred to as the second message. The content of the second message can be the same as or different from the first message.
[0106] Exemplarily, the historical sending time of the second message can be obtained by the timestamp determined by sending the second message. If the time interval between the historical sending time and the time when it is determined that the second device has insufficient receiving capacity for the data stream is less than the time threshold, that is, the second device sends the first message to the first device when the second message has not yet been received by the first device, resulting in the first device receiving the first message with the same function as the second message when it receives the second message but has not yet started to perform flow control on the data stream sent to the second device, or the first device receives the first message with the same function as the second message when it has not yet completed the flow control of the data stream indicated by the second message, so that the first message and the second message are repeated, the first message cannot play a role, resulting in a waste of resources. If the time interval between the historical sending time and the time when it is determined that the second device has insufficient receiving capacity for the data stream is greater than or equal to the time threshold, that is, the second device sends the first message to the first device when the second message has already been received by the first device, avoiding the waste of resources caused by the duplication of the first message and the second message.
[0107] Referring to Figure 8, a schematic diagram of a process in which a second device sends a first message is shown. After the first device and the second device begin communicating, the first device continuously sends a service data stream to the second device, and then the second device continuously receives the service data stream sent by the first device. After each time the second device receives a service data stream, it determines whether the second device has insufficient receiving capacity. If the second device has insufficient receiving capacity, the second device generates and sends a first message to the first device. If the second device does not have insufficient receiving capacity, the second device can continue to receive the service data stream sent by the first device without sending the first message to the first device.
[0108] In one possible implementation, the second device and the first device belong to the same multicast group. The multicast group includes multiple devices connected to the second device, and the multiple devices include the first device. The multiple devices have a many-to-one connection relationship with the second device. For example, see FIG9 , which illustrates a many-to-one connection relationship. The communication network includes device 0, device 1, and the first device. Device 0, device 1, and the first device are all connected to the second device via at least one of switch 0 or switch 1, thereby establishing a many-to-one connection relationship between the multiple devices and the second device.
[0109] In a multicast group, the first message can be a multicast message. After the second device sends the first message, multiple devices that belong to the same multicast group as the second device can all receive the first message. However, devices other than the first device among the multiple devices do not need to perform flow control on the data stream sent to the second device. Therefore, the device information of the first device can also be added to the first message. The device information of the first device is used by the first device to determine whether to perform flow control on the first data stream. This enables the first device to accurately determine the need to perform flow control on the data stream sent to the second device based on the device information in the first message, and avoids other devices among the multiple devices from performing flow control on the data stream sent to the second device, thereby improving the accuracy of flow control. Among them, the device information of the first device can be the address of the first device, the name of the first device, the label of the first device, or the verification information of the first device.
[0110] In some cases, the multicast group joined by the first device and the second device may be a multicast group that is not used by other data streams, that is, the multicast group is not used to transmit other data streams, and is only used for the second device to send the first message to the first device. Therefore, before the second device sends the first message to the first device, both the first device and the second device need to join the multicast group used to transmit the first message. The embodiment of the present application does not limit the method for the first device and the second device to join the multicast group. For example, see Figure 10, which shows a schematic diagram of the process of the second device and the first device joining the same multicast group. First, an address of a multicast group for transmitting the first message can be determined, and the address of the multicast group can be configured on each device that needs to join the multicast group, such as the first device and the second device, so that the first device and the second device join the multicast group.
[0111] In one possible implementation, if the second device determines that there are multiple first devices, the second device can add the device information of the multiple first devices to a single first message and multicast the single first message so that the multiple first devices can receive the first message. In this implementation, by sending a single first message, the second device can enable the multiple first devices to implement data flow control based on the first message, thereby reducing the number of first messages sent by the second device and reducing the consumption of resources used to generate the first messages.
[0112] In addition, the first message may also include at least one of the start time or end time indicating that the first device performs flow control on the data stream sent to the second device, the start time includes the effective time or the pre-effective time, and the end time includes the expiration time or the pre-expiration time. By carrying at least one of the start time or the end time in the first message, the first device can accurately and efficiently determine the effective time or the end time of the control, thereby achieving precise flow control in the time dimension. The time interval between the start time and the end time can be determined based on the time required for the second device to complete the processing of the received data stream. The process of the first device determining the effective time or the end expiration time of the control based on the start time and the end time can be referred to the description in S605 below and will not be elaborated here.
[0113] S603, the first device receives a first message sent by the second device. The first message is sent when the second device has insufficient receiving capability for the data stream. The first message includes identification information and a control identifier of the second device. The control identifier instructs the first device to perform flow control on the data stream sent to the second device.
[0114] After the second device sends the first message to the first device, the first device, as the destination device of the first message, can receive the first message and can control the flow of the data stream sent to the second device based on the identification information and control identifier of the second device in the first message. The process of the first device controlling the flow of the data stream sent to the second device can be referred to S604 and S605 below and will not be elaborated here.
[0115] As described above, the first device, the second device, and multiple other devices may belong to the same multicast group. Therefore, in addition to receiving the first message sent by the second device, the first device can also receive messages from other devices instructing them to perform flow control on the data stream. Because some of the other devices do not require the first device to send data streams to them, the first device does not need to process messages sent by these devices. Therefore, the first device can filter the received messages and discard messages sent by these devices.
[0116] Optionally, the first device can filter the message according to the address of the source device in the message. After receiving the message, the first device can obtain the information or data in the message through protocol stack conversion. Therefore, the first device can filter the message according to the address of the source device in the message during the protocol stack conversion process. For example, the first device can filter the specific multicast source by using the Internet Group Management Protocol version 3 (IGMPv3), where the specific multicast source can be a second device that has a data stream interaction requirement with the first device. Therefore, the first device can discard the message whose source device address is not the address of the second device and not process the message, and retain the message whose source device address is the address of the second device to reduce the use of resources for processing the message.
[0117] In addition, after the protocol stack conversion, the first device can also extract the address of the source device in the message and determine whether the address of the source device is the address of the second device. After that, the first device can also discard the message whose source device address is not the address of the second device and not process the message, and retain the message whose source device address is the address of the second device.
[0118] S604: The first device determines, based on the identification information of the second device, a first data stream to be sent to the second device from the data streams to be sent by the first device.
[0119] In an implementation where a first device and a second device belong to the same multicast group, the multicast group includes multiple devices connected to the second device. The first message is a multicast message sent by the second device to the multiple devices. The first message transmitted via multicast can be received by the multiple devices. Therefore, the first message can also include device information. The device information is information about a device used to control a data flow sent to the second device. The device information can also be used by the multiple devices to determine whether flow control is required for the data flow sent to the second device. The first device is included in the multiple devices, and therefore the first device can also receive the first message, that is, the first device can also obtain the device information in the first message.
[0120] Therefore, when the first device determines the first data stream to be sent to the second device from the data stream to be sent by the first device based on the identification information of the second device, it can first determine whether the first device needs to perform flow control on the data stream sent to the second device based on whether the device information in the first message is the same as the device information of the first device. Based on the fact that the device information in the first message is the same as the device information of the first device, the first device can determine that flow control is required for the data stream sent to the second device. Thereafter, the first device can determine the first data stream from the data stream to be sent by the first device based on the identification information of the second device.
[0121] The embodiments of the present application do not limit the method by which the first device determines the first data stream from the data streams to be transmitted. For example, the first device may store a mapping relationship between each data stream and its destination address, and may also store a mapping relationship between each destination address and the identification information of the device indicated by the destination address. The first device may determine the address of the second device based on the identification information of the second device in the first message, and thereby determine, based on the destination address, the data stream that has a mapping relationship with the destination address, and determine the data stream as the first data stream.
[0122] S605: The first device performs flow control on the first data stream according to the control identifier.
[0123] The embodiments of the present application do not limit the method by which the first device controls the flow of the first data stream. For example, the first device may obtain a control policy based on the control identifier and control the flow of the first data stream according to the control policy, wherein the control policy includes at least one of the type of data stream to be transmitted or the transmission rate.
[0124] In one possible implementation, the control strategy can be determined by the user and configured in the first device, or issued by a control device connected to the first device and configured autonomously by the first device. The control strategies for different data streams can be the same or different, and the control strategies of different first devices for data streams sent to the same second device can be the same or different.
[0125] According to different control strategies for the content, flow control of the first data stream can be divided into different situations. The following takes situation A1 and situation A2 as examples to illustrate the process of flow control of the first data stream according to the control strategy.
[0126] In case A1, the control policy includes the type of data stream being sent, and the type of the data stream being sent is a critical data stream. The first data stream includes a first critical data stream of type and a first non-critical data stream of type. In this case, flow control is performed on the first data stream according to the control policy, including: pausing the transmission of the first non-critical data stream to the second device; and sending the first critical data stream to the second device.
[0127] In one possible implementation, the first device may classify the various data streams to be sent, or the first device may classify the various services deployed on the first device, and the types of data streams corresponding to different services are different. For example, the first device may classify the various services deployed on the first device into critical services and non-critical services according to their importance or priority. The data stream corresponding to the critical service is the critical data stream, and the data stream corresponding to the non-critical service is the non-critical data stream. The embodiment of the present application does not limit the content of critical services and non-critical services. Critical services and non-critical services can be specified by the user. For example, critical services can be services used to ensure the basic function operation of the second device, and non-critical services can be services used to enhance the functional richness of the second device.
[0128] Taking the first device as a vehicle-mounted terminal as an example, the first device can divide the deployed services into critical vehicle control services and non-critical vehicle control services. Critical services can be services such as turn signal reporting or brake signal reporting, which are used to ensure that the second device can realize basic functional operations. Non-critical services can be services such as music playback, which are used to enhance the functional richness of the second device. The data stream corresponding to the critical vehicle control service is the critical data stream, which can also be called the critical vehicle control service data stream. The data stream corresponding to the non-critical vehicle control service is the non-critical data stream, which can also be called the non-critical vehicle control service data stream. In addition, the importance or priority of each service can be specified by the user or determined based on experience, and the embodiments of the present application do not limit this.
[0129] After completing the classification of the data stream, the first device can also create different sending queues, and different sending queues are used to send different types of data streams. For example, a low-latency sending queue and a shaped sending queue can be created through a sending queue creation tool or a configuration file. The low-latency sending queue is used to send critical data streams with a higher degree of importance, ensuring that the critical data stream is sent to the second device with a lower latency. The shaped sending queue is used to send non-critical data streams with a lower degree of importance, so that when flow control of the data stream is required, the non-critical data stream is preferentially shaped through the shaped sending queue to achieve flow control. Both the low-latency sending queue and the shaped sending queue can be software sending queues, that is, queues created at the software level, without the need to change the hardware structure of the first device, reducing the difficulty of creating the sending queue.
[0130] Referring to Figure 11, a schematic diagram of the structure of a first device is shown. The first device includes a network card and an operating system running on the first device hardware. The operating system includes two operating states: user mode and kernel mode. The kernel mode is used to operate programs in the operating system and also to operate the first device hardware through instructions. The user mode is used to run an application (APP) deployed on the sending end.
[0131] The operating system in kernel state may include a TCP / UDP module for processing a transmission control protocol (TCP) or a user datagram protocol (UDP), an overload feedback module for processing a first message, an IP / MAC module for processing an IP address or a MAC address, a low-latency send queue module for sending critical data streams, a shaping send queue module for sending non-critical data streams, and a receive queue module for receiving data streams.
[0132] The process in which the first device classifies data streams and configures different types of data streams to different sending queues can be called the process in which the first device configures a traffic shaping policy. For example, referring to FIG12 , a schematic diagram of the process of configuring a traffic shaping policy is shown. When starting to configure the traffic shaping policy, the data streams of the first device can be classified, and different types of data streams can be configured to different sending queues to send different types of data streams in different sending modes. For example, the data streams can be divided into critical data streams and non-critical data streams. Afterwards, different types of data streams can be configured to different sending queues by judging whether the data stream is a critical data stream. If the data stream is a critical data stream, the critical data stream can be configured to a low-latency sending queue, and if the data stream is a non-critical data stream, the non-critical data stream can be configured to a shaping sending queue.
[0133] Since a variety of different services may be deployed on the second device, and the various services may include critical services and non-critical services, the first data stream that needs to be sent to the second device may include a first critical data stream of the critical data stream type and a first non-critical data stream of the non-critical data stream type. After the first device obtains the control strategy, it determines that the type of data stream to be sent is a critical data stream. The first device may continue to send the first critical data stream to the second device, while suspending the sending of the first non-critical data stream. According to the control strategy, part of the data stream in the first data stream is sent to the second device, reducing the flow of the data stream sent to the second device, and realizing flow control of the first data stream sent to the second device.
[0134] In case A2, the control strategy includes a sending rate. In this case, flow control is performed on the first data stream according to the control strategy, including: sending the first data stream to the second device at a first rate, the first rate being determined based on the resources used by the second device to receive the data stream. Optionally, the first rate can be determined based on one or more resources of the resources used by the second device to receive the data stream. For example, the maximum receiving rate of the second device for the data stream can be determined based on the resources used by the second device to receive the data stream, and then the first rate is determined based on the maximum receiving rate of the second device. Taking the first rate as an example of determining the bandwidth used by the second device to receive the data stream, if the bandwidth used by the second device to receive the data stream is 400Mbps, the first rate can be determined as 30% of the bandwidth, that is, the first rate is 120Mbps, so that the first device sends the first data stream at a lower rate during the process of flow control on the first data stream, thereby avoiding overloading the receiving capacity of the second device due to insufficient receiving capacity of the second device.
[0135] In an embodiment of the present application, the receiving capability of the second device for the data stream is determined based on the resources used by the second device to receive the data stream. Therefore, the first rate determined based on the resources used by the second device to receive the data stream is consistent with the receiving capability of the second device for the data stream. Sending the first data stream to the second device at the first rate consistent with the receiving capability can achieve precise flow control of the first data stream.
[0136] In one possible implementation, before the second device feeds back to the first device that its receiving capacity is insufficient, the first device may also limit the sending rate of the data stream. For example, the first device may send the critical data stream to the second device at the second rate and send the non-critical data stream at the third rate. Both the second rate and the third rate may be determined based on the resources used by the second device to receive the data stream. Optionally, the second rate may be greater than the first rate, so that when the receiving capacity of the second device has sufficient margin, the first device sends the critical data stream to the second device at a higher rate, thereby improving bandwidth utilization. The third rate may be less than the second rate, so that the sending rate of the non-critical data stream is less than the critical data stream, and avoids the situation where both the critical data stream and the non-critical data stream are large, resulting in insufficient receiving capacity of the second device.
[0137] Referring to Figure 13, a schematic diagram of the effect of flow control of a data stream is shown. The data streams to be sent by the first device include data stream 1, data stream 2 and data stream 3. The destination internet protocol addresses (dst ip address) of data stream 1 and data stream 2 are both 192.0.0.2, and the dst ip address indicates the second device 0, that is, data stream 1 and data stream 2 are both data streams that need to be sent to the second device 0. Among them, data stream 1 is a non-critical data stream, and data stream 2 is a critical data stream. The dst ip address of data stream 3 is 192.0.0.3, and the dst ip address indicates the second device 1, that is, data stream 3 is a data stream that needs to be sent to the second device 1. Data stream 3 includes critical data streams and non-critical data streams that need to be sent to the second device 1.
[0138] When the receiving capacity of second device 0 is insufficient, second device 0 sends a first message to the first device. The first device receives the first message through its interface and, based on the first message, controls data stream 1 and data stream 2 sent to second device 0. According to the control strategy, since data stream 1 is a non-critical data stream, the first device can suspend the transmission of data stream 1. Since data stream 2 is a critical data stream, the first device can send data stream 2 to second device 0 at a lower first rate. Second device 1 does not have insufficient receiving capacity, so the first device sends data stream 3 to second device 1 through the port normally.
[0139] Based on this example, it can be seen that in an embodiment of the present application, the first device can perform flow control on the data flow sent to the second device based on the identification information of the second device in the first message, without performing flow control on the data flow sent to other devices, and does not affect the services deployed on other devices. The flow control has high accuracy.
[0140] Referring to Figure 14, a process diagram for data flow control is shown. The first device 0, the first device 1, the first device 2, and the second device 0 belong to the same multicast group and are connected to each other via switches 0 and 1. Before the first device 0 and the second device 0 begin communicating, a control policy can be configured on the first device 0 and an occupancy threshold can be configured on the second device 0. The structure of the first device 0 can refer to the above description of Figure 11, wherein the APPs running in the user state include critical business APPs and non-critical business APPs, the critical business APPs are used to generate critical data streams, and the non-critical business APPs are used to generate non-critical data streams. The structure of the second device 0 is similar to that of the first device 0. The kernel state structure of the second device 0 does not include a low-latency send queue module, a shaping send queue module, and a receive queue module, but instead includes a software send queue module and a receive detection queue module. The software send queue module is used to send data streams (such as business data streams or first messages), and the receive detection queue module is used to detect whether the receiving capacity of the second device is insufficient. The functions of the other structures of the second device 0 can refer to the above description of the structure of the first device 0 and will not be repeated here.
[0141] Below, the transmission paths of the various data streams in Figure 14 are illustrated. The critical data stream of first device 0 is generated by the critical business APP of the first device, and the non-critical data stream of first device 0 is generated by the non-critical business APP. The critical data stream and non-critical data stream of first device 0 are transferred from user state to kernel state through state transition. The critical data stream is transmitted to the network card via the low-latency send queue module, and the non-critical data stream is transmitted to the network card via the shaping send queue module. The critical data stream and non-critical data stream are sent to switch 0 via the network card. Switch 0 forwards the critical data stream and non-critical data stream of first device 0 to switch 1. Switch 1 sends the critical data stream and non-critical data stream to second device 0. Second device 0 receives the critical data stream and non-critical data stream via the network card and transfers the critical data stream and non-critical data stream from kernel state to user state through state transition. The critical data stream is used to implement the critical business APP installed on second device 0, and the non-critical data stream is used to implement the non-critical business APP installed on second device 0. The structures of the first device 1 and the first device 2 can be the same as the structure of the first device 0, and the paths for the first device 1 and the first device 2 to send critical data streams and non-critical data streams to the second device 0 are the same as the paths for the first device 0 to send critical data streams and non-critical data streams to the second device 0, which will not be repeated here.
[0142] After the second device 0 determines that its receiving capacity is insufficient through the receiving detection queue module, it reports the insufficient receiving capacity to the overload feedback module. The overload feedback module generates a first message and sends the first message to the software sending queue module. Then, the first message is sent to switch 1 through the network card. Switch 1 forwards the first message to switch 0. After receiving the first message, switch 0 forwards the first message to the first device 0. The first device 0 receives the first message through the network card and transmits the first message to the overload feedback module. The overload feedback module obtains a control strategy based on the first message and sends the control strategy to the low-latency sending queue module and the shaping sending queue module. The low-latency sending queue module and the shaping sending queue module adjust the data flow sending method according to the control strategy to achieve data flow control.
[0143] Since, in the embodiment of the present application, the first device can be both a transmitter and a receiver of a service data stream, the structure of the first device can be converted based on different roles. That is, when the first device is a transmitter of a service data stream, the structure of the first device is shown as the first device 0 in FIG14 ; when the first device is a receiver of a service data stream, the structure of the first device is shown as the second device 0 in FIG14 . Correspondingly, the structure of the second device can also be converted based on different roles, which will not be described in detail here.
[0144] In embodiments of the present application, in addition to being able to adjust the data flow transmission method through a control policy, it is also possible to determine the control time for the flow. For example, performing flow control on a first data flow based on a control identifier may include: obtaining the control's effective time; obtaining the control's expiration time; and performing flow control on the first data flow according to the control policy within the effective time and the expiration time.
[0145] The embodiments of the present application do not limit the method by which the first device obtains the effective time and the expiration time. For example, the first message may further include the effective time or the pre-effective time. In this implementation, the first device obtains the effective time of the control, including: if the first message includes the effective time, the first device may obtain the effective time from the first message. If the first message includes the pre-effective time, the first device may obtain the pre-effective time from the first message and obtain the effective buffer time of the first device, and determine the effective time based on the pre-effective time and the effective buffer time.
[0146] Among them, the effective buffer time can be specified and configured by the user, and can also be determined by the first device based on the current data flow transmission situation. For example, when the first device receives the first message, it may not have completed the transmission of the data flow including multiple messages, and the data flow is a data flow sent to the second device. The first device can estimate the time required to complete the complete transmission of the data flow based on the number of unfinished messages in the data flow, and use this time as the effective buffer time. This method of determining the effective time enables the first device to perform flow control after completing the complete transmission of the data flow, avoiding suspending the transmission of the data flow, resulting in incomplete data flow, and thus the problem of message loss.
[0147] After determining the effective buffer time, the sum of the pre-effective time and the effective buffer time may be determined as the effective time of the control, and flow control of the first data stream sent to the second device may be performed starting at the effective time.
[0148] In a possible implementation, the first message does not include an effective time and a pre-effective time. The first device may start flow control on the first data flow after receiving the first message and completing the data flow currently being sent to the second device.
[0149] Correspondingly, the first message may also include an expiration time or a pre-failure time. In this implementation, the first device obtains the controlled expiration time, including: when the first message includes the expiration time, the first device can obtain the expiration time from the first message; and when the first message includes the pre-failure time, the first device can obtain the pre-failure time from the first message and obtain the failure buffer time of the first device, and determine the expiration time based on the pre-failure time and the failure buffer time.
[0150] The dead buffer time can be user-specified or randomly generated by the first device, and is therefore also referred to as a random time. Multiple first devices connected to the second device can have different dead buffer times to prevent multiple first devices from simultaneously resuming normal data flow transmission, causing another instantaneous traffic surge and insufficient receiving capacity on the second device.
[0151] After the first device determines the effective time and the expiration time, flow control can be performed on the first data stream between the effective time and the expiration time. The time interval between the expiration time and the expiration time is the control time, which can be 500 microseconds, for example. The control time can indicate the time required for the second device to complete the processing of the received data stream. Since the embodiment of the present application can suspend the transmission of the first non-critical data stream within the control time period, the control time can also be called a pause time period. The first device can resume the normal transmission of the data stream sent to the second device after the expiration time, and improve the utilization rate of the transmission bandwidth of the first device and the utilization rate of the receiving bandwidth of the second device when the receiving capacity of the second device is sufficient.
[0152] In one possible implementation, the first message does not include the expiration time and the pre-expiration time, then the first device can determine the end time of control based on the start time of control and the control time period according to the control time period configured by the user, and stop the flow control of the first data stream after the end time of control is reached.
[0153] Below, the process of the flow control method provided in the embodiment of the present application is exemplarily described through different examples.
[0154] Refer to Figure 15, which shows a flow chart of a data flow control method. Before starting data flow control, the second device configures the occupancy threshold, the first device configures the control strategy, and the second device and the first device join the same multicast group for transmitting the first message. The first device starts communicating with the second device, the first device sends a service data stream to the second device, and the second device receives the service data stream. After each time the second device receives the service data stream, it determines whether the second device has insufficient receiving capacity. If the second device has insufficient receiving capacity, the second device sends the first message to each first device in the multicast group through multicast. After receiving the first message, the first device that needs to perform flow control performs flow control on the first data stream. Correspondingly, if the second device does not have insufficient receiving capacity, the second device can continue to receive the service data stream sent by the first device.
[0155] Referring to Figure 16, a schematic diagram illustrating the effect of data flow control is shown. Second device 0 determines that its receiving capacity is insufficient based on resource usage reaching a threshold. Second device 0 generates a first message and sends it to the switch connected to the second device. Based on the forwarding list of the multicast group to which second device 0 belongs, the switch determines that the first devices belonging to the same multicast group as second device 0 are first device 0, first device 1, and first device 2. The switch then copies the first message into three identical copies and sends one copy each to first device 0, first device 1, and first device 2. After receiving the first message, first device 0, first device 1, and first device 2 verify the device information of the first device in the first message and determine that they all need to control the data flow according to the first message. Furthermore, based on the identification information of the second device in the first message, they determine the first data flow to be sent to the second device and the corresponding control strategy. Furthermore, each first device generates a corresponding expiration buffer time: first device 0 generates expiration buffer time 0, first device 1 generates expiration buffer time 1, and first device 2 generates expiration buffer time 2. These expiration buffer times can be the same or different. Each first device determines the expiration time based on the generated expiration buffer time and the pre-expiration time carried in the first message, and performs flow control on the first data stream. Taking first device 2 controlling the first data stream as an example, first device 2 transmits the first critical data stream to second device 0 at the first rate via a low-latency transmit queue. First device 2 pauses transmission of the first non-critical data stream via a shaped transmit queue. First device 0 and first device 1 can also perform flow control on the first data stream using the same method, which will not be further described here.
[0156] Referring to Figure 17, a schematic diagram illustrates a process for a first device to control the flow of a data stream. After receiving a first message, the first device begins processing the first message and determines whether the first message originates from a second device connected to the first device. If the first message originates from a second device not connected to the first device, the first device may discard the first message and not perform flow control on the data stream based on the first message. If the first message originates from a second device connected to the first device, the first device may perform flow control on the first data stream destined for the second device based on the first message. After determining an effective time and an expiration time, the first device starts a timer, setting the timer to start at the effective time and stop at the expiration time. The timer's expiration time is the timer's expiration time. During the period between the effective time and the expiration time, the first device performs flow control on the first data stream, suspending transmission of the first non-critical data stream in the shaped transmit queue and transmitting the first critical data stream at the first rate to the second device. After the timer expires, i.e., after the expiration time is reached, control of the first data stream ends, discarding the first message, and processing of the first message ends. The shaped transmit queue then resumes transmitting the first non-critical data stream.
[0157] To sum up, in the flow control method provided in the present application, the second device can send a first message to the first device when the receiving capacity is insufficient. Since the control identifier included in the first message can instruct the first device to control the flow of the data stream sent to the second device, and the identification information of the second device included in the first message can be used by the first device to determine the first data stream that needs to be sent to the second device in the data stream to be sent by the first device, the first device can accurately control the flow of the first data stream according to the control identifier, thereby reducing the receiving pressure of the second device for the data stream.
[0158] The flow control method provided in the embodiments of the present application has been described above. Corresponding to the above method, the embodiments of the present application also provide a flow control device. The device is applied to a first device. The device is configured to execute the flow control method executed by the first device in FIG. 6 above through the various modules shown in FIG. As shown in FIG. 18 , the flow control device provided in the embodiments of the present application includes the following modules.
[0159] The receiving module 1801 is used to receive a first message sent by a second device. The first message is sent when the second device has insufficient receiving capacity for the data stream. The first message includes identification information and a control identifier of the second device. The control identifier instructs the first device to perform flow control on the data stream sent to the second device; the determining module 1802 is used to determine, based on the identification information of the second device, the first data stream to be sent by the first device from the data stream to be sent by the first device; and the control module 1803 is used to perform flow control on the first data stream according to the control identifier.
[0160] In a possible implementation, the control module 1803 is configured to obtain a control policy according to the control identifier, where the control policy includes at least one of a type of data stream to be sent or a sending rate; and perform flow control on the first data stream according to the control policy.
[0161] In one possible implementation, the first data stream includes a first critical data stream of type critical data stream and a first non-critical data stream of type non-critical data stream, the control strategy includes the type of data stream sent, and the type of data stream sent is critical data stream; the control module 1803 is used to suspend sending the first non-critical data stream to the second device; and send the first critical data stream to the second device.
[0162] In a possible implementation, the control strategy includes a sending rate, and the control module 1803 is configured to send the first data stream to the second device at a first rate, where the first rate is determined based on resources of the second device for receiving the data stream.
[0163] In a possible implementation, the control module 1803 is configured to obtain a control effective time; obtain a control expiration time; and perform flow control on the first data flow according to the control identifier within the effective time and the expiration time.
[0164] In one possible implementation, the first message also includes an effective time or a pre-effective time, and the control module 1803 is used to obtain the effective time from the first message when the first message includes the effective time; when the first message includes the pre-effective time, obtain the pre-effective time from the first message, and obtain the effective buffer time of the first device, and determine the effective time based on the pre-effective time and the effective buffer time.
[0165] In one possible implementation, the first message also includes an expiration time or a pre-failure time, and the control module 1803 is used to obtain the expiration time from the first message when the first message includes the expiration time; when the first message includes the pre-failure time, obtain the pre-failure time from the first message and obtain the failure buffer time of the first device, and determine the expiration time based on the pre-failure time and the failure buffer time.
[0166] In one possible implementation, the first device and the second device belong to the same multicast group, the multicast group includes multiple devices connected to the second device, the multiple devices include the first device, the first message is a multicast message sent by the second device to the multiple devices, and the first message also includes device information, which is information of the device used to control the data stream sent to the second device; the determination module 1802 is used to determine the first data stream from the data stream to be sent by the first device based on the device information being the same as the device information of the first device and according to the identification information of the second device.
[0167] The present application also provides a flow control device. The device is applied to a second device. The device is configured to execute the flow control method performed by the second device in FIG. 6 through the modules shown in FIG. 19 . As shown in FIG. 19 , the flow control device provided in the present application includes the following modules.
[0168] A determining module 1901 is configured to determine a first device for flow control of the data flow when the receiving capability of the second device for the data flow is insufficient, and the first device is connected to the second device;
[0169] The sending module 1902 is configured to send a first message to the first device, where the first message includes identification information of the second device and a control identifier, and the control identifier instructs the first device to perform flow control on a data stream sent to the second device.
[0170] In one possible implementation, the device also includes an acquisition module, which is used to obtain the occupancy of resources used by the second device to receive the data stream; the determination module 1901 is also used to determine that the second device has insufficient receiving capacity for the data stream based on the occupancy being greater than or equal to the resource occupancy threshold.
[0171] In one possible implementation, the occupancy is determined based on at least one of an occupancy ratio of a cache queue of the second device for caching data flows, an occupancy ratio of a bandwidth of the second device for receiving data flows, or a usage rate of a processing unit of the second device for processing data flows.
[0172] In one possible implementation, the sending module 1902 is used to obtain the historical sending time when the second device last sent a second message of the same type as the first message; based on the time interval between the historical sending time and the time when it is determined that the second device has insufficient receiving capacity for the data stream is greater than or equal to a time threshold, the first message is sent to the first device, and the time threshold is determined based on the transmission delay between the second device and the first device.
[0173] In one possible implementation, the second device and the first device belong to the same multicast group, the multicast group includes multiple devices connected to the second device, the multiple devices include the first device, the first message is a multicast message, and the first message also includes device information of the first device. The device information of the first device is used by the first device to determine flow control of the first data stream.
[0174] In one possible implementation, the first message also includes at least one of a start time and an end time indicating that the first device performs flow control on a data stream sent to the second device, where the start time includes an effective time or a pre-effective time, and the end time includes an expiration time or a pre-expiration time.
[0175] In a possible implementation, the determination module 1901 is configured to determine the service to which the data flow used for flow control belongs when the second device has insufficient receiving capability for the data flow; and determine the first device to which the service belongs.
[0176] It should be understood that the beneficial effects of the device provided in Figures 18 or 19 when implementing its functions are the same as the beneficial effects of the flow control method provided in Figure 6, and will not be repeated here. In addition, when implementing its functions, the device provided in Figures 18 or 19 is only illustrated by the division of the above-mentioned functional modules. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments belong to the same concept. The specific implementation process is detailed in the method embodiment, and will not be repeated here.
[0177] 20 , which shows a schematic structural diagram of an exemplary flow control device 2000 of the present application. The flow control device 2000 includes at least one processor 2001 , a memory 2003 , and at least one network interface 2004 .
[0178] The processor 2001 is, for example, a general-purpose central processing unit (CPU), a digital signal processor (DSP), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor or one or more integrated circuits or application-specific integrated circuits (ASICs) for implementing the solution of the present application, a programmable logic device (PLD), other general-purpose processors or other programmable logic devices, discrete gates, transistor logic devices, discrete hardware components or any combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The general-purpose processor can be a microprocessor or any conventional processor, etc. It is worth noting that the processor can be a processor that supports the advanced reduced instruction set machine (ARM) architecture. It can implement or execute various logic blocks, modules and circuits described in conjunction with the disclosure of this application. A processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0179] Optionally, flow control device 2000 further includes a bus 2002. Bus 2002 is used to transmit information between the various components of flow control device 2000. Bus 2002 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, for example. Bus 2002 may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, FIG. 20 shows only one line, but this does not imply that there is only one bus or only one type of bus.
[0180] The memory 2003 may be, for example, a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. The nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache.
[0181] By way of example and not limitation, many forms of ROM and RAM are available. For example, ROM is a compact disc read-only memory (CD-ROM). RAM includes, but is not limited to, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0182] The memory 2003 may also be other types of storage devices that can store static information and instructions. Alternatively, it may be other types of dynamic storage devices that can store information and instructions. Alternatively, it may be other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 2003 is, for example, independently existing and connected to the processor 2001 via the bus 2002. The memory 2003 may also be integrated with the processor 2001.
[0183] The network interface 2004 uses any device such as a transceiver to communicate with other devices or a communication network. The communication network may be Ethernet, a radio access network (RAN), or a wireless local area network (WLAN).
[0184] The network interface 2004 may include a wired network interface or a wireless network interface. Specifically, the network interface 2004 may be an Ethernet interface, such as a Fast Ethernet (FE) interface, a Gigabit Ethernet (GE) interface, an Asynchronous Transfer Mode (ATM) interface, a WLAN interface, a cellular network interface, or a combination thereof. The Ethernet interface may be an optical interface, an electrical interface, or a combination thereof. In some embodiments of the present application, the network interface 2004 may be used for the flow control device 2000 to communicate with other devices.
[0185] In a specific implementation, as some embodiments, the processor 2001 may include one or more CPUs, such as CPU0 and CPU1 shown in FIG20 . Each of these processors may be a single-core processor or a multi-core processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0186] In a specific implementation, as some embodiments, the flow control device 2000 may include multiple processors, such as processor 2001 and processor 2005 shown in FIG20 . Each of these processors may be a single-core processor or a multi-core processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0187] In some embodiments, the memory 2003 is used to store program instructions 2010 for executing the solution of the present application, and the processor 2001 can execute the program instructions 2010 stored in the memory 2003. In other words, the flow control device 2000 can implement the method provided in the method embodiment, i.e., the method shown in FIG6 , through the processor 2001 and the program instructions 2010 in the memory 2003. The program instructions 2010 may include one or more software modules. Alternatively, the processor 2001 itself may also store program instructions for executing the solution of the present application.
[0188] During the specific implementation process, the flow control device 2000 of the present application may correspond to the first device or the second device for executing the above method. The processor 2001 in the flow control device 2000 reads the instructions in the memory 2003, so that the flow control device 2000 shown in Figure 20 can execute all or part of the steps in the method embodiment.
[0189] The flow control device 2000 may also correspond to the apparatus shown in FIG18 or 19 above, where each functional module in the apparatus shown in FIG18 or 19 is implemented using the software of the flow control device 2000. In other words, the functional modules included in the apparatus shown in FIG18 or 19 are generated by the processor 2001 of the flow control device 2000 after reading the program instructions 2010 stored in the memory 2003.
[0190] Among them, each step of the method shown in Figure 6 is completed by the hardware integrated logic circuit or software instructions in the processor of the flow control device 2000. The steps of the method embodiment disclosed in this application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature in the art such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method embodiment in combination with its hardware. To avoid repetition, it will not be described in detail here.
[0191] Referring to FIG. 21 , FIG. 21 illustrates a schematic structural diagram of an exemplary flow control device 2100 of the present application. Flow control device 2100 includes a main control board 2110 and an interface board 2130. Flow control device 2100 shown in FIG. 21 is configured to perform the operations described in the flow control method illustrated in FIG. 6 . Flow control device 2100 is, for example, a switch, router, or controller. Flow control device 2100 may be an example of a first device or a second device.
[0192] Main control board 2110, also known as the main processing unit (MPU) or route processor card, is responsible for controlling and managing various components in traffic control device 2100, including routing calculation, device management, device maintenance, and protocol processing. Main control board 2110 includes a central processing unit (CPU) 2111 and memory 2112.
[0193] Interface board 2130 is also known as a line processing unit (LPU), line card, or service board. It provides various service interfaces and implements data packet forwarding. Service interfaces include, but are not limited to, Ethernet interfaces and POS (Packet over SONET / SDH) interfaces. Ethernet interfaces, for example, are interfaces for flexible Ethernet clients (FlexE Clients). Interface board 2130 includes a central processing unit (CPU) 2131, a network processor (NPU) 2132, a forwarding table memory 2134, and a physical interface card (PIC) 2133.
[0194] The central processing unit 2131 on the interface board 2130 is used to control and manage the interface board 2130 and communicate with the central processing unit 2111 on the main control board 2110 .
[0195] The network processor 2132 is used to implement message forwarding processing. The network processor 2132 can be in the form of a forwarding chip. Specifically, the network processor 2132 is used to forward received messages based on the forwarding table stored in the forwarding table memory 2134. If the destination address of the message is the address of the flow control device 2100, the message is sent to the CPU (such as the central processing unit 2111) for processing; if the destination address of the message is not the address of the flow control device 2100, the next hop and outgoing interface corresponding to the destination address are searched in the forwarding table based on the destination address, and the message is forwarded to the outgoing interface corresponding to the destination address. The processing of uplink messages includes: processing of the message input interface, forwarding table search; processing of downlink messages: forwarding table search, etc.
[0196] The physical interface card 2133 implements the physical layer interconnection function. Raw traffic enters the interface board 2130 through this card, and processed packets are sent out from this physical interface card 2133. Physical interface card 2133, also known as a daughter card, can be installed on the interface board 2130. It is responsible for converting optical and electrical signals into packets, performing a validity check on these packets, and forwarding them to the network processor 2132 for processing. In some embodiments, a central processing unit can also perform the functions of the network processor 2132, such as implementing software forwarding based on a general-purpose CPU, thus eliminating the need for the network processor 2132 in the physical interface card 2133.
[0197] Optionally, the traffic control device 2100 includes multiple interface boards. For example, the traffic control device 2100 further includes an interface board 2140 . The interface board 2140 includes a central processing unit 2141 , a network processor 2142 , a forwarding table entry memory 2144 , and a physical interface card 2143 .
[0198] Optionally, the traffic control device 2100 further includes a switching fabric board 2120. The switching fabric board 2120 may also be referred to as a switch fabric unit (SFU). If the traffic control device includes multiple interface boards 2130, the switching fabric board 2120 is used to exchange data between the interface boards. For example, the interface board 2130 and the interface board 2140 can communicate via the switching fabric board 2120.
[0199] The main control board 2110 and the interface board 2130 are coupled. For example, the main control board 2110, the interface board 2130, the interface board 2140, and the switching network board 2120 are connected to the system backplane via a system bus to achieve intercommunication. In one possible implementation, an inter-process communication (IPC) channel is established between the main control board 2110 and the interface board 2130, and communication between the main control board 2110 and the interface board 2130 is performed via the IPC channel.
[0200] Logically, the traffic control device 2100 includes a control plane and a forwarding plane. The control plane includes a main control board 2110 and a central processing unit 2131. The forwarding plane includes various components that perform forwarding, such as a forwarding table entry memory 2134, physical interface cards 2133, and a network processor 2132. The control plane performs routing functions, generates forwarding tables, processes signaling and protocol messages, and configures and maintains device status. The control plane sends the generated forwarding tables to the forwarding plane. On the forwarding plane, the network processor 2132 forwards messages received by the physical interface card 2133 based on the forwarding tables sent by the control plane. The forwarding tables sent by the control plane can be stored in the forwarding table entry memory 2134. In some embodiments, the control plane and forwarding plane can be completely separate and not located on the same device.
[0201] It's worth noting that there may be one or more main control boards (SPUs), which can include both active and standby SPUs. There may also be one or more interface boards. The higher the data processing capabilities of a flow control device, the more interface boards it provides. Interface boards can also have one or more physical interface cards. There may be no SPUs, one or more SPUs, and multiple SPUs can be used to achieve load balancing and redundant backup. In a centralized forwarding architecture, a flow control device may not require a SPU; the interface boards handle service data processing for the entire system. In a distributed forwarding architecture, a flow control device may have at least one SPU, which enables data exchange between multiple interface boards, providing high-capacity data exchange and processing capabilities. Therefore, the data access and processing capabilities of a distributed flow control device are greater than those of a centralized architecture. Alternatively, the flow control device can consist of a single card, without a switching fabric board (SFB), integrating the functions of the interface board and the main control board. In this case, the central processing unit (CPU) on the interface board and the CPU on the main control board can be combined into a single CPU on this card to perform the combined functions. This type of device has lower data exchange and processing capabilities (for example, low-end communications equipment such as switches or routers). The specific architecture used depends on the specific networking deployment scenario and is not specified here.
[0202] In an exemplary embodiment, a flow control system is provided. The system includes a first device and a second device. The first device is used to execute the method executed by the first device in FIG. 6 , and the second device is used to execute the method executed by the second device in FIG. 6 .
[0203] In an exemplary embodiment, a computer program (product) is provided. The computer program (product) includes: computer program code. When the computer program code is executed by a computer, the computer is caused to perform the method in FIG. 6 .
[0204] In an exemplary embodiment, a computer-readable storage medium is provided. The computer-readable storage medium stores a program or instruction. When the program or instruction is executed on a computer, the computer executes the method in FIG. 6 .
[0205] In an exemplary embodiment, a chip is provided, including a processor for calling and executing instructions stored in a memory, so that a computer equipped with the chip executes the method in the figure.
[0206] In an exemplary embodiment, another chip is provided, including: an input interface, an output interface, a processor and a memory. The input interface, the output interface, the processor and the memory are connected through an internal connection path. The processor is used to execute the code in the memory. When the code is executed, the computer equipped with the chip executes the method in Figure 6.
[0207] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive).
[0208] In this application, the terms "first," "second," and the like are used to distinguish between identical or similar items having substantially the same function or effect. It should be understood that "first," "second," and "nth" do not have a logical or temporal dependency, nor do they limit the quantity or order of execution. It should also be understood that although the following description uses the terms "first," "second," and the like to describe various elements, these elements should not be limited by these terms. These terms are simply used to distinguish one element from another.
[0209] It should also be understood that in the various embodiments of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0210] In this application, the term "at least one" means one or more, and the term "plurality" means two or more. For example, "plurality of second devices" means two or more second devices. The terms "system" and "network" are often used interchangeably herein.
[0211] It should be understood that the terminology used in the description of the various examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0212] It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the listed items. The term "and / or" describes an association between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this application generally indicates that the associated objects are in an "or" relationship.
[0213] It should also be understood that the terms “if” and “if” may be interpreted to mean “when” or “upon” or “in response to determining” or “in response to detecting.” Similarly, the phrases “if it is determined that ” or “if [stated condition or event] is detected” may be interpreted to mean “upon determining ” or “in response to determining ” or “upon detecting [stated condition or event]” or “in response to detecting [stated condition or event],” depending on the context.
[0214] The above description is merely an embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A flow control method, characterized in that: The method comprises: A first device receives a first message sent by a second device, where the first message is sent when the receiving capability of the second device for the data flow is insufficient, and the first message includes identification information and a control identifier of the second device, where the control identifier instructs the first device to perform flow control on the data flow sent to the second device; Based on the identification information of the second device, determining a first data stream to be sent to the second device from the data streams to be sent by the first device; The flow of the first data flow is controlled according to the control identifier.
2. The method according to claim 1, characterized in that The performing flow control on the first data flow according to the control identifier includes: Acquire a control strategy according to the control identifier, wherein the control strategy includes at least one of a type of data stream to be sent or a sending rate; The flow of the first data flow is controlled according to the control strategy.
3. The method according to claim 2, characterized in that The first data stream includes a first critical data stream of a critical data stream type and a first non-critical data stream of a non-critical data stream type, the control strategy includes the type of the transmitted data stream, and the type of the transmitted data stream is the critical data stream; The performing flow control on the first data flow according to the control strategy includes: suspending sending the first non-critical data stream to the second device; The first critical data stream is sent to the second device.
4. The method according to claim 2 or 3, characterized in that: The control strategy includes the sending rate, and the performing flow control on the first data flow according to the control strategy includes: The first data stream is sent to the second device at a first rate, where the first rate is determined based on resources used by the second device to receive the data stream.
5. The method according to any one of claims 1 to 4, characterized in that: The performing flow control on the first data flow according to the control identifier includes: Get the effective time of the control; Get the control failure time; During the effective time and the expiration time, flow control is performed on the first data flow according to the control identifier.
6. The method according to claim 5, characterized in that The first message also includes the effective time or the pre-effective time, and the effective time of the acquisition control includes: In a case where the first message includes the effective time, obtaining the effective time from the first message; In the case where the first message includes the pre-effective time, the pre-effective time is obtained from the first message; the effective buffer time of the first device is obtained, and the effective time is determined according to the pre-effective time and the effective buffer time.
7. The method according to claim 5 or 6, characterized in that: The first message also includes the expiration time or the pre-expiration time, and the expiration time of the acquisition control includes: In a case where the first message includes the expiration time, obtaining the expiration time from the first message; In the case where the first message includes the pre-failure time, the pre-failure time is obtained from the first message; the failure buffer time of the first device is obtained, and the failure time is determined according to the pre-failure time and the failure buffer time.
8. The method according to any one of claims 1 to 7, characterized in that: The first device and the second device belong to the same multicast group, the multicast group includes multiple devices connected to the second device, the multiple devices include the first device, the first message is a multicast message sent by the second device to the multiple devices, the first message also includes device information, and the device information is information of a device used to control a data stream sent to the second device; The determining, from the data stream to be sent by the first device, a first data stream to be sent to the second device, comprises: Based on the fact that the device information is the same as the device information of the first device, the first data stream is determined from the data streams to be sent by the first device according to the identification information of the second device.
9. A flow control method, characterized in that: The method comprises: The second device determines, when the receiving capability of the second device for the data stream is insufficient, a first device for flow control of the data stream, the first device being connected to the second device; A first message is sent to the first device, where the first message includes identification information and a control identifier of the second device, and the control identifier instructs the first device to perform flow control on a data stream sent to the second device.
10. The method according to claim 9, characterized in that Before the second device determines the first device for performing flow control on the data flow when the receiving capability of the second device for the data flow is insufficient, the second device further includes: Obtaining an amount of resources occupied by the second device for receiving the data stream; Based on the occupancy being greater than or equal to an occupancy threshold of the resource, it is determined that the receiving capability of the second device for the data stream is insufficient.
11. The method according to claim 10, characterized in that The occupancy is determined based on at least one of an occupancy ratio of a cache queue of the second device for caching data flows, an occupancy ratio of a bandwidth of the second device for receiving data flows, or a usage rate of a processing unit of the second device for processing data flows.
12. The method according to any one of claims 9 to 11, characterized in that: The sending a first message to the first device includes: Obtain a historical sending time at which the second device last sent a second message of the same type as the first message; Based on the time interval between the historical sending time and the time when it is determined that the second device has insufficient receiving capacity for the data stream is greater than or equal to a time threshold, the first message is sent to the first device, and the time threshold is determined based on the transmission delay between the second device and the first device.
13. The method according to any one of claims 9 to 12, characterized in that: The second device and the first device belong to the same multicast group, the multicast group includes multiple devices connected to the second device, the multiple devices include the first device, the first message is a multicast message, the first message also includes device information of the first device, and the device information of the first device is used by the first device to determine flow control of the first data stream.
14. The method according to any one of claims 9 to 13, characterized in that: The first message also includes at least one of a start time and an end time indicating that the first device performs flow control on a data stream sent to the second device, the start time includes an effective time or a pre-effective time, and the end time includes an expiration time or a pre-expiration time.
15. The method according to any one of claims 9 to 14, characterized in that: The step of determining a first device for performing flow control on the data stream when the receiving capability of the second device for the data stream is insufficient includes: In a case where the receiving capability of the second device for the data flow is insufficient, determining the service to which the data flow used for flow control belongs; Determine the first device to which the service belongs.
16. The method according to any one of claims 1 to 15, characterized in that: The first device and the second device are devices in a vehicle network.
17. A flow control device, characterized in that: The device is applied to a first device, and includes: a receiving module, configured to receive a first message sent by a second device, wherein the first message is sent when the receiving capability of the second device for the data stream is insufficient, and the first message includes identification information and a control identifier of the second device, and the control identifier indicates that the first device performs flow control on the data stream sent to the second device; a determining module, configured to determine, based on the identification information of the second device, a first data stream to be sent by the first device to the second device; A control module is used to perform flow control on the first data flow according to the control identifier.
18. A flow control device, characterized in that: The device is applied to a second device, and includes: a determination module, configured to determine, when the receiving capability of the second device for the data stream is insufficient, a first device for flow control of the data stream, the first device being connected to the second device; A sending module is used to send a first message to the first device, wherein the first message includes identification information and a control identifier of the second device, and the control identifier indicates that the first device performs flow control on a data stream sent to the second device.
19. A flow control device, characterized in that: The flow control device includes a processor, which is coupled to a memory; the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor so that the flow control device implements the flow control method described in any one of claims 1-16.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and the instruction is loaded and executed by the processor to implement the flow control method as described in any one of claims 1-16.
21. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and the computer program / instruction is executed by a processor to enable a computer to implement the flow control method according to any one of claims 1-16.
Citation Information
Patent Citations
Flow control method and device
CN110856222A
RoCE network flow control method and device, equipment and storage medium
CN113162864A
Flow control method and device, electronic equipment and storage medium
CN116032853A
Data storage method, device and equipment and computer readable storage medium
CN116366552A
Receiver-based precision congestion control
US20210112002A1