Flow control method, device and equipment and computer readable storage medium
After receiving the packets after the control identifier sent by the receiving end at the sending end, the data flow control is performed, and the packet loss problem caused by traffic bursts in the communication system is solved, and precise control of the data flow is achieved.
Patent Information
- Application Number
- CN202311739757.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-15
- Publication Date
- 2025-06-17
AI Technical Summary
In the communication system, too many messages sent by the sending end in a short time leads to bursts of traffic in the data stream, exceeding the receiving capability of the receiving end, resulting in packet loss and other problems.
After receiving the message containing the control identifier sent by the receiving end at the sending end, the data flow to be sent to the receiving end is determined, and the flow control is performed according to the control identifier, including pausing or adjusting the transmission rate of the data flow.
Accurate flow control of the data stream is realized, which slows down the reception pressure at the receiver and avoids packet loss.
Smart Images

Figure CN120166080A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and particularly to a traffic control method, apparatus, device, and computer-readable storage medium. Background Art
[0002] In a communication system, a sender and a receiver can transmit a data stream through transmission packets. During the transmission of the data stream, it may cause a traffic burst of the data stream due to the sender sending too many packets in a short period of time, resulting in a sharp increase in the packets received by the receiver, exceeding the receiver's ability to receive packets, and thus problems such as packet loss may occur. Therefore, traffic control needs to be performed at the sender to avoid problems such as packet loss caused by the traffic burst of the data stream. Summary of the Invention
[0003] This application provides a traffic control method, apparatus, device, and computer-readable storage medium to accurately control the traffic of a data stream. The technical solutions are as follows:
[0004] In a first aspect, a traffic control method is provided. The method is applied to a first device and includes: the first device receives a first packet sent by a second device. The first packet is sent when the second device has insufficient receiving capacity for the data stream. The first packet includes the identification information of the second device and a control flag. The control flag instructs the first device to perform traffic control on the data stream sent to the second device; based on the identification information of the second device, determine a first data stream sent to the second device from the data streams to be sent by the first device; perform traffic control on the first data stream according to the control flag.
[0005] In this application, the second device can send a first packet to the first device when the receiving capacity is insufficient. Since the control flag included in the first packet can instruct the first device to control the traffic of the data stream sent to the second device, and the identification information of the second device included in the first packet can be used by the first device to determine the first data stream that needs to be sent to the second device from the data streams to be sent by the first device, the first device can accurately control the traffic of the first data stream according to the control flag and relieve the receiving pressure of the second device for the data stream.
[0006] In a possible implementation manner, performing traffic control on the first data stream according to the control flag includes: obtaining a control policy according to the control flag. The control policy includes at least one of the type or sending rate of the data stream to be sent; perform traffic control on the first data stream according to the control policy. The control policy in this application includes at least one of the type or sending rate of the data stream to be sent. Therefore, after obtaining the control policy, it is possible to perform more accurate traffic control on at least one of the type of the data stream that needs to be sent in the first data stream or the sending rate of the first data stream according to the control policy.
[0007] In a possible implementation, the first data stream includes 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. The control policy 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. Performing traffic control on the first data stream according to the control policy includes: pausing sending the first non-critical data stream to the second device; sending the first critical data stream to the second device. When the control policy includes the type of the data stream to be sent and the type is the critical data stream, the first device can, according to the control policy, send the first critical data stream of the critical data stream type in the first data stream and pause sending the first non-critical data stream of the non-critical data stream type in the first data stream, reducing the number of data streams sent to the second device, and thus achieving precise traffic control.
[0008] In a possible implementation, the control policy includes a sending rate. Performing traffic control on the first data stream according to the control policy includes: sending the first data stream to the second device at a first rate, where the first rate is determined based on the resources of the second device for receiving data streams. In this application, the resources of the second device for receiving data streams can be used to determine the receiving capacity of the second device for data streams, and the first rate is also determined based on the resources of the second device for receiving data streams. Therefore, the first rate is consistent with the receiving capacity of the second device for data streams. Sending the first data stream to the second device at the first rate consistent with the receiving capacity can perform precise traffic control on the first data stream.
[0009] In a possible implementation, performing traffic control on the first data stream according to a control identifier includes: obtaining the effective time of the control; obtaining the expiration time of the control; within the effective time and the expiration time, performing traffic control on the first data stream according to the control identifier. By obtaining the effective time and the expiration time of the control and performing traffic control on the first data stream within the effective time and the expiration time, precise traffic control of the data stream can be achieved in the time dimension.
[0010] In a possible implementation, the first message further includes an effective time or a pre-effective time. Obtaining the effective time of the control includes: when the first message includes an effective time, obtaining the effective time from the first message; when the first message includes a 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 according to the pre-effective time and the effective buffer time. If the first message includes an effective time, the effective time can be efficiently obtained from the first message. If the first message includes a pre-effective time, the effective time can be accurately determined according to the effective buffer time of the first device and the pre-effective time.
[0011] In a possible implementation, the first message further includes a failure time or a pre-failure time. Obtaining the failure time of the control includes: when the first message includes a failure time, obtaining the failure time from the first message; when the first message includes a pre-failure time, obtaining the pre-failure time from the first message, and obtaining the failure buffer time of the first device, and determining the failure time according to the pre-failure time and the failure buffer time. If the first message includes a failure time, the failure time can be efficiently obtained from the first message. If the first message includes a pre-failure time, the failure time can be accurately determined according to the failure buffer time of the first device and the pre-failure time.
[0012] In a 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, and 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 further includes device information, where the device information is the information of the device used to control the data stream sent to the second device; determining the first data stream sent to the second device from the data streams 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 streams to be sent by the first device according to the identification information of the second device.
[0013] Since the first message is 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. Therefore, carrying the device information of the device that needs to perform flow control on the data stream sent to the second device in the first message can enable multiple devices to determine whether each device needs to perform flow control on the data stream sent to the second device according to the device information in the first message. The multiple devices include the first device. Therefore, the first device can also determine whether the first device needs to perform flow control on the data stream sent to the second device according to 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 flow control needs to be performed on the data stream sent to the second device. Furthermore, the first device can determine the first data stream according to the identification information of the second device and implement flow control on the first data stream according to the control identifier.
[0014] In a second aspect, a flow control method is provided. The method is applied to the second device, and the method includes: when the second device has insufficient receiving capacity for the data stream, determining a first device for performing flow control on the data stream, where the first device is connected to the second device; sending a first message to the first device, where the first message includes the identification information of the second device and a control identifier, and the control identifier instructs the first device to perform flow control on the data stream sent to the second device.
[0015] When the receiving capacity of the second device is insufficient, the second device sends a first message to the first device, and carries a control identifier and the identifier information of the second device in the first message, so that the first device can control the flow rate of the data stream sent to the second device according to the control identifier, and determine the first data stream to be sent to the second device from the data streams to be sent by the first device according to the identifier information of the second device, and then accurately control the flow rate of the first data stream to be sent to the second device according to the control identifier, so as to relieve the receiving pressure of the second device for the data stream.
[0016] In a possible implementation, before the second device determines the first device for controlling the flow rate of the data stream when the receiving capacity of the second device for the data stream is insufficient, the method further includes: obtaining the occupancy of the resources used by the second device to receive the data stream; determining that the receiving capacity of the second device for the data stream is insufficient based on that the occupancy is greater than or equal to the occupancy threshold of the resources. Since the second device receives and processes the data stream through the resources used to receive the data stream, the receiving capacity of the second device for the data stream can be determined according to the resources used to receive the data stream. If the occupancy of the resources used by the second device to receive the data stream is greater than or equal to the occupancy threshold of the resources, it means that the remaining available resources of the second device are less and the number of data streams that can be continuously received is less. Therefore, it can be considered that the receiving capacity of the second device for the data stream is insufficient, so as to control the flow rate of the data stream in time.
[0017] In a possible implementation, the occupancy is determined based on at least one of the occupancy ratio of the buffer queue used by the second device to buffer the data stream, the occupancy ratio of the bandwidth of the second device to receive the data stream, or the utilization rate of the processing unit of the second device for processing the data stream. The buffer queue for buffering the data stream, the bandwidth for receiving the data stream, and the processing unit for processing the data stream are all resources used by the second device to receive the data stream. According to the usage conditions of at least one of these resources, the occupancy of the resources used by the second device to receive the data stream can be accurately determined.
[0018] In a possible implementation, sending a first message to a first device includes: obtaining the historical sending time when a 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 being greater than or equal to a time threshold, sending the first message to the first device, where the time threshold is determined based on the transmission delay between the second device and the first device. 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 determined based on the transmission delay, and the second message has not been received by the first device yet, the second device sends the first message to the first device, resulting in the first device receiving the first message of the same type as the second message when it has received the second message but has not started flow control for the data stream destined for the second device, or the first device receiving the first message of the same type as the second message before it has completed the flow control for the data stream indicated by the second message. Since the first message and the second message are of the same type, the first message and the second message have the same function, and the first message and the second message are repeated, making the first message unable to function and causing waste of resources.
[0019] In a 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 first message is a multicast message, and the first message further includes the device information of the first device. The device information of the first device is used for the first device to determine flow control for a first data stream. 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, carrying the device information of the first device that needs to perform flow control on the data stream destined for the second device in the first message can enable the first device to accurately determine based on the device information in the first message that flow control needs to be performed on the data stream destined for the second device, and prevent other devices among the multiple devices from performing flow control on the data stream destined for the second device, improving the accuracy of flow control.
[0020] In a possible implementation, the first message further includes at least one of the start time or the end time indicating the first device to perform 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, and then achieve precise flow control in the time dimension.
[0021] In a possible implementation, when the receiving capacity of the second device for the data stream is insufficient, determining the first device for performing flow control on the data stream includes: when the receiving capacity of the second device for the data stream is insufficient, determining the service to which the data stream for which flow control is to be performed belongs; determining the first device to which the service belongs. By determining the service that requires flow control and then determining the first device to which the service belongs, the first device corresponding to the data stream that requires flow control can be accurately determined, enabling the first device to perform precise flow control on the data stream that requires flow control.
[0022] In a possible implementation, the first device and the second device in the first aspect and the second aspect above are devices in a vehicle network.
[0023] In a third aspect, a flow control device is provided. The device is applied to the first device and includes:
[0024] A receiving module, configured to receive a first message sent by the second device. The first message is sent when the receiving capacity of the second device for the data stream is insufficient. The first message includes the identification information of the second device and a control flag, and the control flag 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 sent to the second device from the data streams to be sent by the first device; a control module, configured to perform flow control on the first data stream according to the control flag.
[0025] In a possible implementation, the control module is configured to obtain a control policy according to the control flag. The control policy includes at least one of the type or the sending rate of the data stream to be sent; and perform flow control on the first data stream according to the control policy.
[0026] In a possible implementation, the first data stream includes a first critical data stream of the type of critical data stream and a first non-critical data stream of the type of non-critical data stream. The control policy includes the type of the data stream to be sent, and the type of the data stream to be sent is a critical data stream. The control module is configured to pause sending the first non-critical data stream to the second device; and send the first critical data stream to the second device.
[0027] In a possible implementation, the control policy includes a sending rate. The control module is configured to send the first data stream to the second device at a first rate, and the first rate is determined based on the resources used by the second device to receive the data stream.
[0028] In a possible implementation, the control module is configured to obtain the effective time of the control; obtain the expiration time of the control; and perform flow control on the first data stream according to the control flag within the effective time and the expiration time.
[0029] In a possible implementation, the first message further includes an effective time or a pre-effective time. The control module is configured 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 according to the pre-effective time and the effective buffer time.
[0030] In a possible implementation, the first message further includes an expiration time or a pre-expiration time. The control module is configured to obtain the expiration time from the first message when the first message includes the expiration time; when the first message includes the pre-expiration time, obtain the pre-expiration time from the first message, and obtain the expiration buffer time of the first device, and determine the expiration time according to the pre-expiration time and the expiration buffer time.
[0031] In a 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, and 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 further includes device information, and the device information is information about the device used to control the data stream sent to the second device; the determination module is configured to, based on the device information being the same as the device information of the first device, determine a first data stream from the data streams to be sent by the first device according to the identification information of the second device.
[0032] In a fourth aspect, a traffic control device is provided. The device is applied to the second device, and the device includes:
[0033] A determination module, configured to determine a first device for performing traffic control on a data stream when the receiving capacity of the second device for the data stream is insufficient, and the first device is connected to the second device;
[0034] A sending module, configured to send a first message to the first device, where the first message includes the identification information of the second device and a control identifier, and the control identifier indicates that the first device performs traffic control on the data stream sent to the second device.
[0035] In a possible implementation, the device further includes an obtaining module, and the obtaining module is configured to obtain the occupancy of the resources used by the second device to receive the data stream; the determination module is further configured to determine that the receiving capacity of the second device for the data stream is insufficient based on the occupancy being greater than or equal to the occupancy threshold of the resources.
[0036] In a possible implementation, the occupancy is determined based on at least one of the occupancy ratio of the buffer queue used by the second device to cache the data stream, the occupancy ratio of the bandwidth for the second device to receive the data stream, or the utilization rate of the processing unit used by the second device to process the data stream.
[0037] In a possible implementation, a sending module is configured to obtain the historical sending time when the second device last sent a second message of the same type as the first message; and 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 being greater than or equal to a time threshold, send the first message to the first device, where the time threshold is determined based on the transmission delay between the second device and the first device.
[0038] In a 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 further includes the device information of the first device, and the device information of the first device is used for the first device to determine traffic control for the first data stream.
[0039] In a possible implementation, the first message further includes at least one of the start time and the end time indicating traffic control for the data stream sent to the second device by the first 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.
[0040] In a possible implementation, a determining module is configured to, when the second device has insufficient receiving capacity for the data stream, determine the service to which the data stream for traffic control belongs; and determine the first device to which the service belongs.
[0041] In a possible implementation, the first device and the second device in the above third aspect and fourth aspect are devices in a vehicle-mounted network.
[0042] In a fifth aspect, another communication device is provided, which includes: a network interface, a memory, and a processor. Wherein, the network interface, the memory, and the processor communicate with each other through an internal connection path, the memory is used to store instructions, the processor is used to execute the instructions stored in the memory to control the network interface to receive signals and control the network interface to send signals, and when the processor executes the instructions stored in the memory, the processor is caused to execute the methods in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0043] Optionally, the processor is one or more, and the memory is one or more.
[0044] Optionally, the memory may be integrated with the processor, or the memory and the processor are separately arranged.
[0045] In a sixth aspect, a communication system is provided, which includes the device in the third aspect or any possible implementation manner of the third aspect and the device in the fourth aspect or any possible implementation manner of the fourth aspect.
[0046] In a seventh aspect, a computer program (product) is provided, which includes computer program code that, when run on a computer, causes the computer to execute the methods in the first aspect, the second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
[0047] In an eighth aspect, a computer-readable storage medium is provided, which stores a program or instructions that, when run on a computer, cause the methods in the first aspect, the second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect to be executed.
[0048] In a ninth aspect, a chip is provided, which includes a processor for calling and running instructions stored in a memory, causing a computer installed with the chip to execute the methods in the first aspect, the second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
[0049] In a tenth aspect, another chip is provided, which includes 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 code in the memory, and when the code is executed, a computer installed with the chip executes the methods in the first aspect, the second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
[0050] It should be understood that for the beneficial effects obtained by the technical solutions in the third aspect to the tenth aspect of this application and their corresponding possible implementation manners, reference can be made to the technical effects of the first aspect and the second aspect and their corresponding possible implementation manners described above, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a schematic structural diagram of a local area network provided by an embodiment of this application;
[0052] Figure 2 It is a schematic diagram of the effect of traffic burst caused by not restricting the maximum transmission rate provided by an embodiment of this application;
[0053] Figure 3 It is a schematic diagram of the effect of avoiding traffic burst by restricting the maximum transmission rate provided by an embodiment of this application;
[0054] Figure 4 Schematic diagram of the effect of traffic superposition provided by an embodiment of the present application;
[0055] Figure 5 Implementation scenario diagram provided by an embodiment of the present application;
[0056] Figure 6 Flowchart of a traffic control method provided by an embodiment of the present application;
[0057] Figure 7 Schematic diagram of the process of configuring the occupancy threshold provided by an embodiment of the present application;
[0058] Figure 8 Schematic diagram of the process of a second device sending a first message provided by an embodiment of the present application;
[0059] Figure 9 Schematic diagram of a one-to-many connection relationship provided by an embodiment of the present application;
[0060] Figure 10 Schematic diagram of the process of a second device and a first device joining the same multicast group provided by an embodiment of the present application;
[0061] Figure 11 Schematic diagram of the structure of a first device provided by an embodiment of the present application;
[0062] Figure 12 Schematic diagram of the process of configuring a traffic shaping policy provided by an embodiment of the present application;
[0063] Figure 13 Schematic diagram of the effect of traffic control of a data stream provided by an embodiment of the present application;
[0064] Figure 14 Process diagram of traffic control of a data stream provided by an embodiment of the present application;
[0065] Figure 15 Flow schematic diagram of a traffic control method for a data stream provided by an embodiment of the present application;
[0066] Figure 16 Another schematic diagram of the effect of traffic control of a data stream provided by an embodiment of the present application;
[0067] Figure 17 Schematic diagram of the process of a first device controlling the traffic of a data stream provided by an embodiment of the present application;
[0068] Figure 18 Schematic diagram of the structure of a traffic control device provided by an embodiment of the present application;
[0069] Figure 19Schematic diagram of another flow control device provided by an embodiment of the present application;
[0070] Figure 20 Schematic diagram of a flow control device provided by an embodiment of the present application;
[0071] Figure 21 Schematic diagram of another flow control device provided by an embodiment of the present application. Detailed implementation manners
[0072] The terms used in the implementation manners part of the present application are only for explaining the specific embodiments of the present application, rather than aiming to limit the present application.
[0073] A communication network generally includes network nodes of different types or functions. For example, a transmitter (Tx) for sending data streams and a receiver (Rx) for receiving data streams. The transmitter and receiver in the communication network can be connected to each other to form a network topology, and the connected transmitter and receiver can realize the transmission of data streams through the established connection. The connection established between the transmitter and the receiver can be a connection established through an intermediate device, so the network nodes may also include intermediate devices. Intermediate devices can be devices such as switches or routers that can be used for data stream forwarding. According to the different coverage ranges of the communication network, the communication network can be divided into different types of communication networks, such as local area networks and wide area networks. The switch in the local area network can also be called a local area network switch (LSW).
[0074] In the case where there are intermediate devices in the communication network, the transmitter can send data streams to the intermediate device, and the receiver receives the data streams forwarded by the intermediate device to realize the transmission of data streams between the transmitter and the receiver. Exemplarily, referring to Figure 1 , a schematic diagram of a local area network is shown. Transmitter 0, Transmitter 1 and Receiver 0 are all connected to Switch 0, Receiver 1 and Transmitter 2 are all connected to Switch 1, and a communication connection is established between Switch 0 and Switch 1 and they can communicate with each other. Both Switch 0 and Switch 1 can be local area network switches. Each transmitter and receiver can realize the transmission of data streams through Switch 0 and Switch 1. Taking the transmission process of the data stream between Transmitter 0 and Receiver 1 as an example, Transmitter 0 sends a data stream with the 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 the destination address indicated Receiver 1, and Receiver 1 receives the data stream to complete the transmission process of the data stream.
[0075] Due to limited resources for processing the received data stream at the receiving end, or rather, limited resources for receiving the data stream at the receiving end. For example, there are limitations in the resources of the central processing unit (CPU) on the receiving end for processing the data stream, the bandwidth of the network card on the receiving end for receiving the data stream, etc. Therefore, the ability of the receiving end to receive the data stream at each moment is limited. In some cases, the available resources for receiving the data stream at the receiving end are less than the available resources for sending the data stream at the receiving end or the switch, resulting in the maximum rate at which the receiving end can receive the data stream being lower than the maximum rate at which the sending end and the switch can send the data stream to the receiving end. Furthermore, if the sending end and the switch send the data stream to the receiving end at the maximum rate, traffic bursts will occur, and the data stream will accumulate at the receiving end, overloading the receiving capacity of the receiving end, which may lead to the loss of the data stream or the loss of packets in the data stream. Among them, the overload of the receiving capacity of the receiving end can also be referred to as the overload of the communication capacity of the receiving end, and traffic burst means that the number of data streams suddenly increases within a unit time.
[0076] For example, the bandwidth of the network card on the receiving end for receiving the data stream is 100 megabits per second (Mbps), that is, the maximum receiving rate of the receiving end for the data stream is 100 Mbps, while the maximum sending rate of the sending end or the switch for sending the data stream is 1000 Mbps. In this case, the maximum receiving rate of the receiving end for the data stream is less than the maximum sending rate of the sending end or the switch for sending the data stream. Therefore, if the sending end or the switch sends the data stream to the receiving end at a sending rate of 1000 Mbps and the receiving end receives the data stream at a receiving rate of 100 Mbps, it will cause the data stream to accumulate at the receiving end, resulting in an overload of the receiving end. Also, because the sending end or the switch may continuously send the data stream to the receiving end, if the receiving end has not completed the processing of the previously received data stream when it receives the data stream sent by the sending end or the switch, the receiving end may discard the unprocessed data stream in the previously received data stream, leading to the loss of the data stream and thus unable to complete the service corresponding to the discarded data stream.
[0077] To prevent the phenomenon of data stream loss caused by the 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 restricted 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 restricted maximum sending rate can be deployed or configured at the sending end, so that the sending rate of the sending end for the data stream does not exceed the restricted maximum sending rate. Exemplarily, in the embodiments of the present application, Figure 2 and Figure 3 are taken as examples to illustrate the effect of restricting the maximum sending rate of the sending end.
[0078] Figure 2 It is a schematic diagram of the effect of traffic bursts caused by not restricting the maximum transmission rate. The dotted line in the figure represents the maximum reception rate of the receiving end. The sending end starts sending data streams to the receiving end at time t21, and the sending rate of the data streams by the sending end gradually increases until it exceeds the maximum reception rate of the receiving end, causing a traffic burst. The receiving end is unable to process the received data streams in time, resulting in the loss of data streams. Figure 3 It is a schematic diagram of the effect of restricting the maximum transmission rate to avoid traffic bursts. The maximum reception rate represented by the dotted line in the figure can be the same as that in Figure 2 . By restricting the maximum transmission rate of the sending end (indicated by the half-line in Figure 3 ), the sending end can only send data streams at a rate less than or equal to the maximum transmission rate, achieving the restriction on the number of data streams sent per unit time, that is, shaping the traffic, and avoiding the sending rate of the data streams from exceeding the maximum reception rate of the receiving end.
[0079] In addition, by comparing Figure 2 and Figure 3 , it can be seen that Figure 3 the shaped traffic has a smaller change range compared to the traffic before shaping in Figure 2 . For the same number of data streams, the sending time shown in Figure 3 is from t31 to t32, and the sending time shown in Figure 2 is from t21 to t22. Thus, it can be seen that for the same number of data streams, the sending time required after restricting the maximum transmission rate is greater than the sending time required before restricting the maximum transmission rate. Therefore, after restricting the maximum transmission rate, the receiving end can have more time to process the data streams, thereby avoiding the loss of data streams.
[0080] In some other cases, multiple services may be deployed on the receiving end. All these multiple services need to be realized by receiving and processing different data streams. These multiple services may be respectively deployed in multiple sending ends connected to the receiving end. Therefore, the multiple sending ends connected to the same receiving end can send multiple data streams corresponding to multiple services to the receiving end at non-fixed times respectively. Since multiple sending ends may send multiple data streams to the receiving end simultaneously, the number of data streams received by the receiving end increases within a short period of time, which also causes a traffic burst at the receiving end. If the burst traffic exceeds the receiving capacity of the receiving end, it will also cause the loss of data streams or packets in the data streams at the receiving end. Moreover, in this case, even if the maximum transmission rate of each sending end is restricted, when multiple sending ends send data streams to the same receiving end simultaneously, the superimposed traffic of the data streams may still exceed the receiving capacity of the receiving end, resulting in an overload of the receiving capacity of the receiving end.
[0081] Exemplarily, refer to Figure 4 the schematic diagram of the traffic superposition effect shown in the figure. The receiving capacity of the receiving end is 4 kilo packets per second (Kpps), that is, the receiving end can process 4,000 data packets in the data stream received per second. Transmitter 0, Transmitter 1, and Transmitter 2 are all connected to the receiving end, and the maximum transmission rate of data packets for Transmitter 0, Transmitter 1, and Transmitter 2 is limited to 3 Kpps. When the transmission time of the data stream by each transmitter is staggered (for example, the transmission situation in the time period from t0 to t1), that is, at most one transmitter sends the data stream to the receiving end at the same moment, then the rate of sending data packets to the receiving end in the communication network will not exceed 3 Kpps and will not exceed the receiving capacity of the receiving end. When the transmission time of the data packets by multiple transmitters overlaps (for example, the transmission situation in the time period from t1 to t2 or the time period from t2 to t3), that is, two or three transmitters send the data stream to the receiving end at the same moment, then the superposition rate of sending data packets to the receiving end in the communication network may be 6 Kpps or 9 Kpps, exceeding the receiving capacity of the receiving end, which will cause the receiving capacity of the receiving end to be overloaded, and then lead to data packet loss.
[0082] Therefore, in a communication scenario where multiple services are respectively deployed on multiple transmitters, the maximum transmission rate of each transmitter is usually limited to a relatively low level to ensure that when multiple transmitters send data streams to the receiving end simultaneously, the superposed transmission rate is still lower than the receiving capacity of the receiving end, avoiding overloading the receiving capacity of the receiving end. However, this method is likely to limit the transmission rate of each transmitter too low, reducing the utilization rate of the resources used by the transmitter to send the data stream. For example, if the maximum receiving rate of the receiving end is 10 Mbps and the receiving end is connected to a total of 9 transmitters, and the maximum transmission rate of each transmitter is limited to 1 Mbps, then even if the 9 transmitters send data streams to the receiving end simultaneously at the maximum transmission rate, the superposed transmission rate of the data stream is 9 Mbps, and the superposed transmission rate of the data stream is still less than the maximum receiving rate of the receiving end, and will not cause overloading of the receiving capacity of the receiving end.
[0083] However, if the maximum transmission rate of the transmitter is continuously limited to a relatively low level, for the resources used by the transmitter to send the data stream, too few resources are called. For example, the utilization rate of the bandwidth used to send the data stream is too low, reducing the performance of the transmitter. Moreover, multiple transmitters do not continuously send data streams simultaneously. Only in a small number of cases will multiple transmitters send data streams to the same receiving end simultaneously. Therefore, in most cases, limiting the maximum transmission rate of each transmitter too low will instead lead to resource waste.
[0084] In the field of communication technology, to avoid the above situation, the receiving end will sense whether its receiving ability is insufficient. If the receiving ability of the receiving end is okay, the sending end will send a data stream to the receiving end at a relatively high sending rate. If the receiving ability is insufficient, the receiving end will feedback to the sending end connected to it that the receiving ability of the receiving end is insufficient. After receiving the feedback, the sending end will immediately stop sending all data streams to implement flow control of the data stream. However, this method will cause other receiving ends with sufficient receiving ability to also be unable to receive the data stream, affecting the services of other receiving ends. The embodiment of the present application provides a flow control method that can accurately control the flow of the data stream sent to the receiving end with insufficient receiving ability.
[0085] See Figure 5 , which shows the implementation scenario diagram of the embodiment of the present application. This implementation scenario includes a first device 51 and a second device 52. The first device 51 and the second device 52 can be communicatively connected by wire or wirelessly. Optionally, an intermediate device can also 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 of the first device 51 sending 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 of the second device 52 sending 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.
[0086] The communication network to which the first device 51 and the second device 52 belong can be a vehicle-mounted network, a vehicle-mounted Ethernet network, an industrial Internet network or other types of communication networks. The embodiment of the present application does not limit the type of the 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 a vehicle-mounted network, the first device 51 and the second device 52 can be devices in the vehicle-mounted network such as vehicle-mounted terminals.
[0087] The flow control method provided by the embodiment of the present application can be applied to Figure 5 the implementation scenario shown in Figure 6 the method flow chart shown. This method includes but is not limited to the following S601 to S605.
[0088] S601. When the receiving ability of the second device for the data stream is insufficient, the second device determines a first device for flow control of the data stream, and the first device is connected to the second device.
[0089] 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. In the embodiments of the present application, the resources used by the second device to receive the data stream are not limited. Exemplarily, the resources may include at least one of a buffer queue for the second device to cache the data stream, the bandwidth for the second device to receive the data stream, or the resources of the processing unit used by the second device to process the data stream. According to the maximum value of the resources, the maximum receiving capacity can be determined, that is, the maximum receiving capacity of the second device. For example, according to at least one of the maximum length of the buffer queue, the maximum value of the bandwidth, and the maximum utilization rate of the resources of the processing unit, the maximum receiving capacity of the second device can be determined. Taking the resource as the bandwidth for the second device to receive the data stream as an example, if the maximum value of the bandwidth for the second device to receive the data stream is 400 Mbps, then 400 Mbps 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 400 Mbps, it will cause the receiving capacity of the second device to be overloaded, resulting in the loss of the data stream or the packets in the data stream.
[0090] The insufficient receiving capacity of the second device for the data stream may mean that the margin of the receiving capacity of the second device for the data stream is small and it is difficult to continue receiving a large amount of data streams. The margin of the receiving capacity may be the difference between the maximum receiving capacity and the usage amount of the receiving capacity of the second device. The usage amount of the receiving capacity of the second device can be determined based on the occupancy of the resources used by the second device to receive the data stream. Therefore, in the embodiments of the present application, it is possible to determine whether the second device has insufficient receiving capacity by the size of the resources used by the second device to receive the data stream and the occupancy of the resources.
[0091] Exemplarily, the second device can obtain the occupancy of the resources used by the second device to receive the data stream, and judge the size of the occupancy and the occupancy threshold. Based on the occupancy being greater than or equal to the occupancy threshold of the resources, it is determined that the second device has insufficient receiving capacity for the data stream. Optionally, the occupancy can be determined based on at least one of the occupancy ratio of the buffer queue for the second device to cache the data stream, the occupancy ratio of the bandwidth for the second device to receive the data stream, or the utilization rate of the processing unit used by the second device to process the data stream.
[0092] In a possible implementation, the occupancy threshold can be set according to experience or user requirements, or can be determined according to the service 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 is implemented through a configuration tool or a configuration file. See Figure 7, which shows a schematic diagram of a process for configuring an occupancy threshold. The second device or a control device connected to the second device can determine the occupancy threshold according to the magnitude of the traffic flow of the first device connected to the second device and the resource size of the second device. Among them, the magnitude of the traffic flow of the first device refers to the average rate at which the first device sends traffic data streams within a period of time, and the size of the period of time can be set according to experience or user requirements. For example, it can be 1 hour.
[0093] In some cases, the occupancy threshold of the resources of the second device can be positively correlated with the resource size of the second device. The reason is that if, when the resource size of the second device is large, the occupancy threshold of the resources of the second device is set to a small value, it will cause the occupancy amount of the resources of the second device to easily reach the occupancy threshold of the resources, and then the first device will frequently perform traffic control on the data stream sent to the second device, reducing the traffic of the data stream sent to the second device, so that most of the resources of the second device for receiving and processing the data stream are not used, and the utilization rate of the bandwidth for receiving the data stream is low, resulting in waste. On the other hand, if, when the resource size of the second device is large, the occupancy threshold of the resources of the second device is set to a large value, the occupancy amount of the resources of the second device is not likely to reach the occupancy threshold of the resources of the second device, and the first device sends data streams to the second device at a relatively large rate in most cases, which can reduce the waste of resources of the second device for receiving and processing the data stream.
[0094] In addition, the occupancy threshold of the resources of the second device may be negatively correlated with the magnitude of the service traffic of the first device. The reason is that if the occupancy of the resources of the second device reaches the occupancy threshold at the first moment, and 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 magnitude of the service traffic of the first device is large and the occupancy threshold of the resources of the second device is large, and the occupancy threshold of the resources 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 occupancy of the resources of the second device has reached the occupancy threshold, resulting in the overload of the receiving capacity of the second device. If the magnitude of the service traffic of the first device is small, even if the occupancy threshold of the resources of the second device is large and the occupancy threshold of the resources of the second device is closer to the maximum value of the resources of the second device, but between the first moment and the second moment, the number of data streams received by the second device increases slowly, and it is not easy to reach the maximum value of the resources of the second device on the basis that the occupancy of the resources of the second device has reached the occupancy threshold, nor is it easy to cause the overload of the receiving capacity of the second device. Therefore, when the magnitude of the service traffic of the first device is small, the occupancy threshold of the resources of the second device can be determined as a larger value. For similar reasons, when the magnitude of the service traffic of the first device is large, the occupancy threshold of the resources of the second device can be determined as a smaller value.
[0095] Continue to refer to Figure 7 After determining the occupancy threshold of the resources of the second device, the occupancy threshold of the resources of the second device can be configured. The embodiments of the present application do not limit the method for configuring the occupancy threshold of the resources. For example, the occupancy threshold of the second device can be configured by configuring a file or a script in the second device that can indicate the occupancy threshold of the resources.
[0096] After completing the configuration of the occupancy threshold of the resources of the second device, it can be determined whether the second device has insufficient receiving capacity according to the relative magnitudes of the occupancy of the resources of the second device and the occupancy threshold. Taking the resources of the second device for receiving the data stream as the buffer queue of the second device for receiving the data stream, the occupancy threshold can be 80% of the length of the buffer queue. If the occupancy of the resources is 80% and the occupancy 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 less, and the margin of the receiving capacity is not enough 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.
[0097] In a possible implementation, after the first device establishes a connection with the second device, the first device can start continuously sending service data streams for realizing service interaction to the second device. The service data stream includes service packets, and the service packets can also be referred to as network packets. Then the second device can continuously receive the service data stream sent by the first device. Therefore, after each time the second device receives the service data stream sent by the first device, the second device can obtain the occupancy of the resources of the second device in real time, so as to determine in a timely manner whether the second device has insufficient receiving capacity, and avoid packet loss in the data stream caused by traffic control after the receiving capacity of the second device is overloaded.
[0098] When the second device determines that the receiving capacity of the second device for the data stream is insufficient, the second device can determine the first device for performing traffic control on the data stream sent to the second device. The embodiments of the present application do not limit the method for the second device to determine the first device. Exemplarily, when the receiving capacity of the second device for the data stream is insufficient, the second device can determine the service to which the data stream for performing traffic control belongs, and then determine the first device to which the service belongs.
[0099] In some cases, multiple services are deployed on the second device, and different services have different priorities. Different services are all realized by processing different data streams. Different services may be deployed on different devices connected to the second device. When the receiving capacity of the second device is insufficient, traffic control can be first performed on the data stream corresponding to the service with a lower priority, and traffic control is not performed on the data stream corresponding to the service with a higher priority, so as to reduce the impact on the service with a higher priority. After determining the service to which the data stream that needs to perform traffic control belongs, the first device connected to the second device and deploying the determined service can be determined, and the determined first device is the first device that needs to perform traffic control on the data stream sent to the second device.
[0100] In addition, the first device can also be determined according to the service traffic sizes of multiple devices connected to the second device. For example, the device with a larger service traffic can be determined as the first device, so as to perform traffic control on the service data stream with a larger traffic and improve the efficiency of traffic control.
[0101] S602, the second device sends a first packet to the first device. The first packet includes the identification information of the second device and a control identifier, and the control identifier instructs the first device to perform traffic control on the data stream sent to the second device.
[0102] After the second device determines the first device that needs to perform flow control, it can generate a first message and add the identification information of the second device and a 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, since 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 also be used to feedback the situation of 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.
[0103] Among them, the identification information of the second device can 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 it can also be information such as the name or label of the second device that can identify the second device. The control identifier can be a symbol or string that can indicate the first device to perform flow control on the data stream sent to the second device.
[0104] Since the first device continuously sends service data streams to the second device, during the process of the second device continuously receiving service data streams, the situation of insufficient receiving capacity may occur multiple times, and each time the receiving capacity is insufficient, it is necessary to send a first message to the first device. If within a short period of time, the second device consecutively has two situations of insufficient receiving capacity, and if the second device continuously sends two first messages to the first device within a short period of time, and the functions of the two first messages are the same, it may cause one of the first messages to be ineffective, resulting in waste of resources. Therefore, during the process of the second device sending the first message to the first device, it can obtain the historical sending time of the second message of the same type as the first message sent by the second device last time; 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 being greater than or equal to a time threshold, send the 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. Among them, the second message is the first message sent by the second device before sending the currently generated first message. To avoid confusion in concepts, in the embodiments of the present application, the first message sent by the second device last time is temporarily referred to as the second message, and the content of the second message can be the same as or different from that of the first message.
[0105] Exemplarily, the historical transmission time of the second message can be obtained through the timestamp determined by sending the second message. If the time interval between the historical transmission 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 before the second message has been received by the first device, resulting in the first device receiving the first message with the same function as the second message when the first device has received the second message but has not yet started flow control for the data stream sent to the second device, or the first device receives the first message with the same function as the second message before completing the flow control of the data stream indicated by the second message, causing the first message to repeat with the second message and the first message being unable to function, resulting in waste of resources. If the time interval between the historical transmission 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 after the second message has been received by the first device, avoiding waste of resources caused by the repetition of the first message and the second message.
[0106] See Figure 8 , which shows a schematic diagram of the process of the second device sending the first message. After the first device and the second device start communicating, the first device continuously sends service data streams to the second device, and then the second device continuously receives the service data streams 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 the 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 streams sent by the first device without sending the first message to the first device.
[0107] In a 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, and the multiple devices have a one-to-many connection relationship with the second device. Exemplarily, see Figure 9 , which shows a schematic diagram of the one-to-many 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 through at least one of switch 0 or switch 1, realizing the one-to-many connection relationship between the multiple devices and the second device.
[0108] In a multicast group, the first message may be 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. 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 for the first device to determine the flow control of the first data stream, enabling the first device to accurately determine that it needs to perform flow control on the data stream sent to the second device based on the device information in the first message, and preventing 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 may 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.
[0109] 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 for transmitting the first message. The embodiments of the present application do not limit the method for the first device and the second device to join the multicast group. Exemplarily, refer to Figure 10 , which shows a schematic diagram of the process of the second device and the first device joining the same multicast group. First, the address of a multicast group for transmitting the first message can be determined, and the address of this multicast group can be configured on each device that needs to join this multicast group, such as on the first device and the second device, so that the first device and the second device join this multicast group.
[0110] In a possible implementation manner, if the number of first devices determined by the second device is multiple, the second device can add the device information of the multiple first devices to a first message and multicast this one first message, so that multiple first devices can all receive the first message. In this implementation manner, by sending one first message, the second device can enable multiple first devices to all implement flow control of the data stream based on this first message, reducing the number of first messages sent by the second device and reducing the consumption of resources for generating the first message.
[0111] In addition, the first message may further include at least one of an indication of the start time or the end time for the first device to perform flow control on the 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 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, and then achieve 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 for the first device to determine the effective time or the end time of the control based on the start time and the end time can refer to the description in S605 below, and will not be elaborated here.
[0112] 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 capacity for the data stream. The first message includes the identification information of the second device and a control identifier, and the control identifier indicates that the first device performs flow control on the data stream sent to the second device.
[0113] 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 perform flow control on the data stream sent to the second device according to the identification information of the second device and the control identifier in the first message. The process for the first device to perform flow control on the data stream sent to the second device can refer to S604 and S605 below, and will not be elaborated here.
[0114] Based on the foregoing description, it can be known that the first device, the second device, and multiple other devices may belong to the same multicast group. Therefore, in addition to being able to receive the first message sent by the second device, the first device can also receive messages sent by other devices for indicating flow control on the data stream. Since 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 the messages sent by these devices. Then, the first device can screen the received messages and discard the messages sent by these devices.
[0115] Optionally, the first device may screen the message according to the address of the source device in the message. After receiving the message, the first device may obtain the information or data in the message through protocol stack conversion. Therefore, the first device may 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 may filter specific multicast sources by using the Internet Group Management Protocol version 3 (IGMPv3), where the specific multicast source may be a second device that has a data stream interaction requirement with the first device. Therefore, the first device may discard the message whose source device address is not the address of the second device and does 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 messages.
[0116] In addition, after the protocol stack conversion, the first device may 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 may also discard the message whose source device address is not the address of the second device and does not process the message, and retain the message whose source device address is the address of the second device.
[0117] S604, the first device determines a first data stream to be sent to the second device from the data streams to be sent by the first device based on the identification information of the second device.
[0118] In an implementation where 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 first message is a multicast message sent by the second device to the multiple devices. The first message transmitted by multicast can be received by multiple devices. Therefore, the first message may also include device information, where the device information is the information of the device used to control the data stream sent to the second device, and the device information can also be used by multiple devices to determine whether traffic control needs to be performed on the data stream sent to the second device. The first device is included in the multiple devices. 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.
[0119] Therefore, in the process of the first device determining the first data stream to be sent to the second device from the data streams to be sent by the first device based on the identification information of the second device, it may first determine whether the first device needs to perform traffic control on the data stream sent to the second device according to whether the device information in the first message is the same as the device information of the first device. Based on the device information in the first message being the same as the device information of the first device, the first device may determine that traffic control needs to be performed on the data stream sent to the second device. After that, the first device may determine the first data stream from the data streams to be sent by the first device according to the identification information of the second device.
[0120] The embodiments of the present application do not limit the method for the first device to determine the first data stream from the data stream to be sent. Exemplarily, the first device may store the mapping relationship between each data stream and the destination address of each data stream, and may also store the 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 according to the identification information of the second device in the first message, and thus determine the data stream having a mapping relationship with the destination address according to the destination address, and determine the data stream as the first data stream.
[0121] S605, the first device performs traffic control on the first data stream according to the control identifier.
[0122] The embodiments of the present application do not limit the method for the first device to perform traffic control on the first data stream. Exemplarily, the first device may obtain a control policy according to the control identifier and perform traffic control on the first data stream according to the control policy. Among them, the control policy includes at least one of the type of the data stream to be sent or the sending rate.
[0123] In a possible implementation manner, the control policy may be determined by the user and configured in the first device, or sent by a control device connected to the first device and autonomously configured by the first device. The control policies for different data streams may be the same or different, and the control policies of different first devices for the data streams sent to the same second device may be the same or different.
[0124] For control policies with different contents, traffic control on the first data stream can be divided into different situations. Taking situation A1 and situation A2 as examples below, the process of performing traffic control on the first data stream according to the control policy will be described.
[0125] Situation A1, the control policy includes the type of the data stream to be sent, and the type of the data stream to be sent is a critical data stream. The first data stream includes a first critical data stream of the type of critical data stream and a first non-critical data stream of the type of non-critical data stream. Then in this situation, performing traffic control on the first data stream according to the control policy includes: pausing sending the first non-critical data stream to the second device; sending the first critical data stream to the second device.
[0126] In a possible implementation, the first device may classify each data stream to be sent, or the first device may also classify each service deployed on the first device. The types of data streams corresponding to different services are different. For example, the first device may classify each service deployed on the first device into critical services and non-critical services according to 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 embodiments of the present application do 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, the critical service may be a service for ensuring the basic function operation of the second device, and the non-critical service may be a service for enhancing the function richness of the second device.
[0127] Taking the first device as a vehicle-mounted terminal as an example, the first device may classify the deployed services into critical vehicle control services and non-critical vehicle control services. The critical service may be a service for ensuring the basic function operation of the second device, such as reporting steering signals or braking signals. The non-critical service may be a service for enhancing the function richness of the second device, such as music playback. 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 according to experience. The embodiments of the present application do not limit this.
[0128] After the first device completes the classification of the data streams, it can also create different sending queues. Different sending queues are used to send different types of data streams. For example, a low-latency sending queue and a shaping 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 streams are sent to the second device with a lower latency. The shaping sending queue is used to send non-critical data streams with a lower degree of importance, so that when traffic control needs to be performed on the data streams, the non-critical data streams are preferentially traffic-shaped through the shaping sending queue to achieve traffic control. Both the low-latency sending queue and the shaping sending queue can be software sending queues, that is, queues created at the software level, without changing the hardware structure of the first device, reducing the difficulty of creating the sending queue.
[0129] See Figure 11 , Figure 11A schematic structural diagram of a first device is shown. The first device includes a network card and an operating system running on the hardware of the first device. The operating system includes two running states: user mode and kernel mode. The kernel mode is used to operate the programs in the operating system and also to operate the hardware of the first device through instructions. The user mode is used to run the applications (APPs) deployed on the sending end.
[0130] The operating system in the kernel mode may include a TCP / UDP module for processing the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP), an overload feedback module for processing the first packet, an IP / MAC module for processing IP addresses or MAC addresses, a low-latency transmission queue module for sending critical data streams, a shaping transmission queue module for sending non-critical data streams, and a receiving queue module for receiving data streams.
[0131] The process by which the first device classifies data streams and configures different types of data streams into different transmission queues can be referred to as the process of the first device configuring a traffic shaping policy. Exemplarily, see Figure 12 , which shows a schematic diagram of the process of configuring a traffic shaping policy. 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 into different transmission queues to send different types of data streams in different ways of sending. For example, the data streams can be divided into critical data streams and non-critical data streams. Then, by determining whether the data stream is a critical data stream, different types of data streams can be configured into different transmission queues. If the data stream is a critical data stream, the critical data stream can be configured into the low-latency transmission queue, and if the data stream is a non-critical data stream, the non-critical data stream can be configured into the shaping transmission queue.
[0132] Since there may be multiple different services deployed on the second device, and the multiple different services may include critical services and non-critical services, the first data stream to be sent to the second device may include a first critical data stream of the type of critical data stream and a first non-critical data stream of the type of non-critical data stream. After the first device obtains the control policy and determines that the type of the data stream to be sent is a critical data stream, the first device can continue to send the first critical data stream to the second device while pausing the sending of the first non-critical data stream. Sending some of the data streams in the first data stream to the second device according to the control policy reduces the traffic of the data streams sent to the second device, realizing the traffic control of the first data stream sent to the second device.
[0133] 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, where the first rate is determined based on the resources of the second device for receiving data streams. Optionally, the first rate may be determined based on one or more of the resources of the second device for receiving data streams. Exemplarily, the maximum receiving rate of the second device for the data stream can be determined based on the resources of the second device for receiving data streams, and then the first rate can be determined according to the maximum receiving rate of the second device. Taking the example where the first rate is determined based on the bandwidth of the second device for receiving data streams, if the bandwidth of the second device for receiving data streams is 400 Mbps, the first rate can be determined as 30% of the bandwidth, that is, the first rate is 120 Mbps, so that when the first device performs flow control on the first data stream, the first data stream is sent at a relatively small rate, avoiding overloading the receiving capacity of the second device on the basis of insufficient receiving capacity of the second device.
[0134] In the embodiments of the present application, the receiving capacity of the second device for the data stream is determined based on the resources of the second device for receiving data streams. Therefore, the first rate determined based on the resources of the second device for receiving data streams is consistent with the receiving capacity 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 capacity can achieve precise flow control of the first data stream.
[0135] In a possible implementation manner, before the second device feeds back insufficient receiving capacity to the first device, the first device can also limit the sending rate of the data stream. For example, the first device can send the critical data stream to the second device at a second rate and send the non-critical data stream at a third rate. Both the second rate and the third rate can be determined based on the resources of the second device for receiving data streams. Optionally, the second rate may be greater than the first rate, so that when there is enough margin in the receiving capacity of the second device, the first device sends the critical data stream to the second device at a higher rate to improve 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 that of the critical data stream, and it is avoided that both the critical data stream and the non-critical data stream are large, resulting in insufficient receiving capacity of the second device.
[0136] See Figure 13, which shows a schematic diagram of the effect of flow control of a data stream. 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 addresses) of data stream 1 and data stream 2 are both 192.0.0.2, and this dst ip address indicates the second device 0, that is, both data stream 1 and data stream 2 are data streams 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 this dst ip address indicates the second device 1, that is, data stream 3 is a data stream to be sent to the second device 1. Data stream 3 includes critical and non-critical data streams to be sent to the second device 1.
[0137] In the case where the receiving capacity of the second device 0 is insufficient, the second device 0 sends a first message to the first device. The first device receives the first message through the interface and controls data stream 1 and data stream 2 sent to the second device 0 based on the first message. According to the control policy, since data stream 1 is a non-critical data stream, the first device can suspend the sending of data stream 1. Since data stream 2 is a critical data stream, the first device can send data stream 2 to the second device 0 at a lower first rate. The second device 1 does not have insufficient receiving capacity, so the first device normally sends data stream 3 to the second device 1 through the port.
[0138] Based on this example, it can be seen that in the embodiments of the present application, the first device can perform flow control on the data streams sent to the second device according to the identification information of the second device in the first message, without performing flow control on the data streams sent to other devices, and without affecting the services deployed on other devices, and the flow control has a high accuracy.
[0139] See Figure 14 , which shows a process diagram of the flow control of the data stream. 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 communicatively connected through the switch 0 and the switch 1. Before the first device 0 starts communicating with the second device 0, 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 11Description, where the APPs running in the user state include critical service APPs and non-critical service APPs. The critical service APPs are used to generate critical data streams, and the non-critical service 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 transmission queue module, a shaping transmission queue module, and a reception queue module, but includes a software transmission queue module and a reception detection queue module. The software transmission queue module is used to transmit data streams (such as service data streams or first messages), and the reception detection queue module is used to detect whether the reception ability of the second device is insufficient. The functions of the other structures of the second device 0 can be referred to the description of the structure of the first device 0 above, and will not be elaborated here.
[0140] Next, Figure 14 an example will be given for the transmission paths of various data streams in
[0141] After determining insufficient receiving capacity through the receiving detection queue module, the second device 0 reports the situation of 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, and 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 policy based on the first message and sends the control policy 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 sending mode of the data stream according to the control policy to achieve traffic control of the data stream.
[0142] Since in the embodiments of the present application, the first device can be both the sending end and the receiving end of the service data stream, therefore, the structure of the first device can be converted based on different functions, that is, when the first device is the sending end of the service data stream, the structure of the first device is as Figure 14 shown by the first device 0 in, and when the first device is the receiving end of the service data stream, the structure of the first device is as Figure 14 shown by the second device 0 in. Correspondingly, the structure of the second device can also be converted based on different functions, which will not be elaborated here.
[0143] In the embodiments of the present application, in addition to being able to adjust the sending mode of the data stream through the control policy, it is also possible to determine the traffic control time. Exemplarily, traffic control of the first data stream according to the control identifier may include: obtaining the effective time of the control; obtaining the expiration time of the control; and performing traffic control on the first data stream according to the control policy within the effective time and the expiration time.
[0144] The embodiments of the present application do not limit the methods for the first device to obtain the effective implementation and the expiration time. Exemplarily, the first message may further include the effective time or the pre-effective time. In this implementation manner, for the first device to obtain the effective time of the control, it includes: when the first message includes the effective time, the first device can obtain the effective time from the first message. And when the first message includes the pre-effective time, the first device can obtain the pre-effective time from the first message and obtain the effective buffer time of the first device, and determine the effective time according to the pre-effective time and the effective buffer time.
[0145] Among them, the effective buffer time can be specified and configured by the user, and can also be determined by the first device according to the sending situation of the current data stream. For example, when the first device receives the first packet, it may not have completed the sending of the data stream including multiple packets, and the data stream is the data stream sent to the second device. Then, the first device can estimate the time required to complete the complete sending of the data stream based on the number of packets in the data stream that have not been sent, and use this time as the effective buffer time. This way of determining the effective time enables the first device to perform flow control after completing the complete sending of the data stream, avoiding pausing the sending of the data stream and resulting in an incomplete data stream being sent, thereby causing packet loss problems.
[0146] After determining the effective buffer time, the sum of the pre-effective time and the effective buffer time can be determined as the effective time of control, and flow control is started on the first data stream sent to the second device at the effective time.
[0147] In a possible implementation, the first packet does not include the effective time and the pre-effective time. Then, the first device can start flow control on the first data stream after receiving the first packet and completing the data stream that is currently being sent to the second device.
[0148] Correspondingly, the first packet can also include the expiration time or the pre-expiration time. In this implementation, the first device obtains the expiration time of control, including: in the case where the first packet includes the expiration time, the first device can obtain the expiration time from the first packet; in the case where the first packet includes the pre-expiration time, the first device can obtain the pre-expiration time from the first packet and obtain the expiration buffer time of the first device, and determine the expiration time according to the pre-expiration time and the expiration buffer time.
[0149] Among them, the expiration buffer time can be specified and configured by the user, or can be randomly generated by the first device. Therefore, the expiration buffer time can also be called the random time. The expiration buffer times generated by multiple first devices connected to the second device can be different, avoiding multiple first devices simultaneously resuming the normal sending of the data stream, resulting in a sudden increase in the instantaneous traffic again and causing insufficient receiving capacity of the second device.
[0150] After the first device determines the effective time and the expiration time, traffic control can be performed on the first data stream within the effective time to 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 embodiments of the present application can pause the transmission of the first non-critical data stream within the control time period, the control time can also be referred to as the 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 reception bandwidth of the second device when the reception capacity of the second device is sufficient.
[0151] In a possible implementation, if the first message does not include the expiration time and the pre-expiration time, the first device can independently determine the end control time according to the start control time and the control time period according to the control time period configured by the user, and stop the traffic control of the first data stream after reaching the end control time.
[0152] Next, the process of the traffic control method provided by the embodiments of the present application will be exemplarily described through different examples.
[0153] See Figure 15 , Figure 15 shows a schematic flowchart of a traffic control method for a data stream. Before starting data stream control, the second device configures an occupancy threshold, the first device configures a control policy, and the second device and the first device join the same multicast group for transmitting the first message. The first device and the second device start communicating, the first device sends a service data stream to the second device, the second device receives the service data stream, and each time the second device receives the service data stream, it determines whether the second device has insufficient reception capacity. If the second device has insufficient reception capacity, the second device sends a first message to each first device in the multicast group through multicast. The first device that needs to perform traffic control performs traffic control on the first data stream after receiving the first message. Correspondingly, if the second device does not have insufficient reception capacity, the second device can continue to receive the service data stream sent by the first device.
[0154] See Figure 16, which shows a schematic diagram of the effect of flow control of a data stream. The second device 0 determines that the receiving capacity of the second device is insufficient according to the occupancy of resources having reached the occupancy threshold. The second device 0 generates a first message and sends the first message to the switch connected to the second device. The switch determines, according to the forwarding list of the multicast group to which the second device 0 belongs, that the first devices belonging to the same multicast group as the second device 0 are the first device 0, the first device 1, and the first device 2. Then the switch copies the first message into three identical copies and sends one copy of the first message to each of the first device 0, the first device 1, and the first device 2. After receiving the first message, the first device 0, the first device 1, and the first device 2 perform verification according to the device information of the first device in the first message, determine that the data stream needs to be controlled according to the first message, and then determine, according to the identification information of the second device in the first message, the first data stream to be sent to the second device and the corresponding control strategy. Moreover, each of the first devices generates a failure buffer time respectively, that is, the first device 0 generates the failure buffer time 0, the first device 1 generates the failure buffer time 1, and the first device 2 generates the failure buffer time 2. The failure buffer times can be the same or different. Each of the first devices determines the failure time according to the generated failure buffer time and the pre-failure time carried in the first message, and performs flow control on the first data stream. Taking the first device 2 controlling the first data stream as an example, the first device 2 sends the first critical data stream to the second device 0 at the first rate through the low-latency transmission queue, and the first device 2 suspends sending the first non-critical data stream through the shaping transmission queue. The first device 0 and the first device 1 can also perform flow control on the first data stream in the same way, which will not be elaborated here.
[0155] See Figure 17, which shows a schematic process diagram of a first device controlling the traffic of a data stream. After receiving a first message, the first device starts to process the first message and determines whether the first message comes from a second device connected to the first device. If the first message comes from a second device not connected to the first device, the first device may discard the first message and not perform traffic control on the data stream based on the first message. If the first message comes from a second device connected to the first device, the first device may perform traffic control on a first data stream sent to the second device according to the first message. After determining the effective time and the expiration time, the first device starts a timer, sets the timer to start timing at the effective time, and stop timing at the expiration time, that is, the timeout period of the timer is the expiration time. The first device performs traffic control on the first data stream during the period from the effective time to the expiration time, pauses the transmission of the first non-critical data stream in the shaping transmission queue, and sends the first critical data stream to the second device at the first rate. After the timer times out, that is, after reaching the expiration time, the control of the first data stream ends, the first message is discarded, the processing of the first message ends, and the shaping transmission queue resumes sending the first non-critical data stream.
[0156] In summary, in the traffic control method provided in this application, the second device may send a first message to the first device when the receiving capacity is insufficient. Since the control identifier included in the first message can indicate the first device to control the traffic 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 among the data streams to be sent by the first device, the first device can accurately perform traffic control on the first data stream according to the control identifier, reducing the receiving pressure of the second device for the data stream.
[0157] The traffic control method provided in the embodiments of this application is introduced above. Corresponding to the above method, the embodiments of this application also provide a traffic control device. Among them, this device is applied to the first device. This device is used to perform the traffic control method executed by the first device in the above Figure 18 through the Figure 6 each module shown. As Figure 18 shown, the traffic control device provided in the embodiments of this application includes the following modules.
[0158] A receiving module 1801, configured to receive a first message sent by a second device. The first message is sent when the second device has insufficient receiving capabilities for a data stream. The first message includes identification information of the second device and a control flag, and the control flag indicates that the first device performs flow control on the data stream to be sent to the second device. A determining module 1802, configured to determine, 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. A control module 1803, configured to perform flow control on the first data stream according to the control flag.
[0159] In a possible implementation, the control module 1803 is configured to obtain a control policy according to the control flag. The control policy includes at least one of the type or transmission rate of the data stream to be sent. The control module 1803 performs flow control on the first data stream according to the control policy.
[0160] In a possible implementation, the first data stream includes a first critical data stream of the type of critical data stream and a first non-critical data stream of the type of non-critical data stream. The control policy includes the type of the data stream to be sent, and the type of the data stream to be sent is a critical data stream. The control module 1803 is configured to suspend sending the first non-critical data stream to the second device and send the first critical data stream to the second device.
[0161] In a possible implementation, the control policy includes a transmission rate. The control module 1803 is configured to send the first data stream to the second device at a first rate, and the first rate is determined based on the resources used by the second device to receive the data stream.
[0162] In a possible implementation, the control module 1803 is configured to obtain the effective time of the control, obtain the expiration time of the control, and perform flow control on the first data stream according to the control flag within the effective time and the expiration time.
[0163] In a possible implementation, the first message further includes an effective time or a pre-effective time. The control module 1803 is configured to, when the first message includes an effective time, obtain the effective time from the first message; when the first message includes a 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 according to the pre-effective time and the effective buffer time.
[0164] In a possible implementation, the first message further includes an expiration time or a pre-expiration time. The control module 1803 is configured to, when the first message includes an expiration time, obtain the expiration time from the first message; when the first message includes a pre-expiration time, obtain the pre-expiration time from the first message and obtain the expiration buffer time of the first device, and determine the expiration time according to the pre-expiration time and the expiration buffer time.
[0165] In a 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, and 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 further includes device information, where the device information is information about a device for controlling the data stream sent to the second device; a determination module 1802, configured to determine a first data stream from the data streams to be sent by the first device according to the identification information of the second device based on the device information being the same as the device information of the first device.
[0166] An embodiment of the present application further provides a traffic control device. Among them, the device is applied to the second device. The device is used to Figure 19 perform the traffic control method executed by the second device in the above Figure 6 through the respective modules shown. As Figure 19 shown, the traffic control device provided by the embodiment of the present application includes the following modules.
[0167] A determination module 1901, configured to determine a first device for performing traffic control on a data stream in the case where the receiving capacity of the second device for the data stream is insufficient, and the first device is connected to the second device;
[0168] A sending module 1902, configured to send a first message to the first device, where the first message includes the identification information of the second device and a control identification, and the control identification indicates that the first device performs traffic control on the data stream sent to the second device.
[0169] In a possible implementation, the device further includes an acquisition module, where the acquisition module is configured to acquire the occupancy of the resources used by the second device for receiving the data stream; the determination module 1901 is further configured to determine that the receiving capacity of the second device for the data stream is insufficient based on the occupancy being greater than or equal to the occupancy threshold of the resources.
[0170] In a possible implementation, the occupancy is determined based on at least one of the occupancy ratio of the buffer queue used by the second device for buffering the data stream, the occupancy ratio of the bandwidth for the second device to receive the data stream, or the usage rate of the processing unit of the second device for processing the data stream.
[0171] In a possible implementation, the sending module 1902 is configured to acquire the historical sending time of the second message of the same type as the first message sent by the second device last time; and send the first message to the first device based on the time interval between the historical sending time and the time when it is determined that the receiving capacity of the second device for the data stream is insufficient being greater than or equal to a time threshold, where the time threshold is determined based on the transmission delay between the second device and the first device.
[0172] In a 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 further includes device information of the first device, and the device information of the first device is used for the first device to determine traffic control for the first data stream.
[0173] In a possible implementation, the first message further includes at least one of a start time and an end time indicating traffic control for a data stream sent by the first device 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.
[0174] In a possible implementation, the determination module 1901 is configured to determine the service to which the data stream for traffic control belongs in the case where the receiving capability of the second device for the data stream is insufficient; and determine the first device to which the service belongs.
[0175] It should be understood that, when the device provided above Figure 18 or 19 implements its functions, the beneficial effects it has are the same as those of the Figure 6 provided traffic control method, which will not be elaborated here. Additionally, Figure 18 when the device provided above or 19 implements its functions, only the above division of each functional module is used as an example for illustration. In practical applications, the above functions can be allocated to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. Additionally, the device provided in the above embodiments and the method embodiments belong to the same concept, and the specific implementation process can be seen in the method embodiments, which will not be elaborated here.
[0176] See Figure 20 , Figure 20 shows a schematic structural diagram of an exemplary traffic control device 2000 of the present application. The traffic control device 2000 includes at least one processor 2001, a memory 2003, and at least one network interface 2004.
[0177] 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 this 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 should be noted that the processor can be a processor that supports the advanced RISC machines (ARM) architecture. It can implement or execute various logic blocks, modules, and circuits described in combination with the disclosure of this application. The processor can also be a combination that implements computing functions, such as including a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and so on.
[0178] Optionally, the flow control device 2000 further includes a bus 2002. The bus 2002 is used to transfer information between the components of the flow control device 2000. The bus 2002 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 2002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 20 only one line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
[0179] The memory 2003 is, for example, a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache.
[0180] By way of example but not limitation, many forms of ROM and RAM are available. For example, the ROM is a compact disc read-only memory (CD-ROM). The RAM includes but is not limited to a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous DRAM (SDRAM), a double data rate SDRAM (DDR SDRAM), an enhanced SDRAM (ESDRAM), a synchlink DRAM (SLDRAM), and a direct rambus RAM (DR RAM).
[0181] The memory 2003 may also be other types of storage devices that can store static information and instructions. Or it may be other types of dynamic storage devices that can store information and instructions. Or it may be other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the 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 exists independently, for example, and is connected to the processor 2001 through the bus 2002. The memory 2003 may also be integrated with the processor 2001.
[0182] The network interface 2004 uses any transceiver-like device for communicating with other devices or communication networks, which can be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc. The network interface 2004 can include a wired network interface and can also include a wireless network interface. Specifically, the network interface 2004 can be an Ethernet interface, such as: Fast Ethernet (FE) interface, Gigabit Ethernet (GE) interface, Asynchronous Transfer Mode (ATM) interface, WLAN interface, cellular network interface, or a combination thereof. The Ethernet interface can be an optical interface, an electrical interface, or a combination thereof. In some embodiments of the present application, the network interface 2004 can be used for the traffic control device 2000 to communicate with other devices.
[0183] In a specific implementation, as some embodiments, the processor 2001 can include one or more CPUs, such as Figure 20 CPU0 and CPU1 shown in. Each of these processors can be a single-core processor or a multi-core processor. Here, the processor can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0184] In a specific implementation, as some embodiments, the traffic control device 2000 can include multiple processors, such as Figure 20 the processor 2001 and the processor 2005 shown in. Each of these processors can be a single-core processor or a multi-core processor. Here, the processor can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0185] In some embodiments, the memory 2003 is used to store the 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. That is, the traffic control device 2000 can implement the method provided in the method embodiment through the processor 2001 and the program instructions 2010 in the memory 2003, that is Figure 6 the method in. The program instructions 2010 can include one or more software modules. Optionally, the processor 2001 itself can also store the program instructions for executing the solution of the present application.
[0186] In a specific implementation process, the traffic 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 traffic control device 2000 reads the instructions in the memory 2003, so that Figure 20 the traffic control device 2000 shown can execute all or part of the steps in the method embodiment.
[0187] The traffic control device 2000 may also correspond to the above Figure 18 or the device shown in 19, Figure 18 or each functional module in the device shown in 19 is implemented by the software of the traffic control device 2000. In other words, Figure 18 the functional modules included in the device shown in 19 or 19 are generated after the processor 2001 of the traffic control device 2000 reads the program instructions 2010 stored in the memory 2003.
[0188] Among them, Figure 6 each step of the method shown is completed by the integrated logic circuit of the hardware in the processor of the traffic control device 2000 or the instructions in the form of software. Combining the steps of the method embodiment disclosed in the present application can be directly embodied as being executed and completed by the hardware processor, or executed and completed by the combination of the hardware and software modules in the processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method embodiment. To avoid repetition, it will not be described in detail here.
[0189] See Figure 21 , Figure 21 which shows a schematic structural diagram of an exemplary traffic control device 2100 of the present application. The traffic control device 2100 includes: a main control board 2110 and an interface board 2130. Figure 21 The traffic control device 2100 shown is used to perform the operations involved in the above Figure 6 shown traffic control method. The traffic control device 2100 is, for example, a traffic control device such as a switch, a router, a controller, etc. The traffic control device 2100 can be an example of the first device or the second device.
[0190] The main control board 2110 is also called a main processing unit (MPU) or a route processor card. The main control board 2110 is used for the control and management of each component in the traffic control device 2100, including routing calculation, device management, device maintenance, and protocol processing functions. The main control board 2110 includes: a central processor 2111 and a memory 2112.
[0191] The interface board 2130 is also known as a line processing unit (LPU), linecard, or service board. The interface board 2130 is used to provide various service interfaces and implement packet forwarding. The service interfaces include, but are not limited to, Ethernet interfaces, POS (Packet over SONET / SDH) interfaces, etc. The Ethernet interface is, for example, a flexible ethernet clients (FlexE Clients). The interface board 2130 includes: a central processor 2131, a network processor 2132, a forwarding table entry memory 2134, and a physical interface card (PIC) 2133.
[0192] The central processor 2131 on the interface board 2130 is used to control and manage the interface board 2130 and communicate with the central processor 2111 on the main control board 2110.
[0193] The network processor 2132 is used to implement packet forwarding processing. The form of the network processor 2132 can be a forwarding chip. Specifically, the network processor 2132 is used to forward the received packet based on the forwarding table stored in the forwarding table entry memory 2134. If the destination address of the packet is the address of the traffic control device 2100, the packet is sent to the CPU (such as the central processor 2111) for processing; if the destination address of the packet is not the address of the traffic control device 2100, the next hop and outgoing interface corresponding to the destination address are found from the forwarding table according to the destination address, and the packet is forwarded to the outgoing interface corresponding to the destination address. Among them, the processing of the upstream packet includes: the processing of the packet incoming interface, the forwarding table lookup; the processing of the downstream packet: the forwarding table lookup, etc.
[0194] The physical interface card 2133 is used to implement the docking function at the physical layer. The original traffic enters the interface board 2130 from here, and the processed packet is sent out from the physical interface card 2133. The physical interface card 2133 is also called a daughter card and can be installed on the interface board 2130. It is responsible for converting optical and electrical signals into packets, performing a legality check on the packets, and then forwarding them to the network processor 2132 for processing. In some embodiments, the central processor can also execute the function of the network processor 2132, such as implementing software forwarding based on a general CPU, so that the network processor 2132 is not required in the physical interface card 2133.
[0195] 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 processor 2141, a network processor 2142, a forwarding table entry memory 2144, and a physical interface card 2143.
[0196] Optionally, the traffic control device 2100 further includes a switch fabric board 2120. The switch fabric board 2120 may also be referred to as a switch fabric unit (SFU). When the traffic control device has multiple interface boards 2130, the switch fabric board 2120 is used to complete data exchange between the interface boards. For example, communication can be performed between the interface board 2130 and the interface board 2140 through the switch fabric board 2120.
[0197] The main control board 2110 is coupled to the interface board 2130. For example. The main control board 2110, the interface board 2130, and the interface board 2140, as well as the switch fabric board 2120, are interconnected through a system bus and a system backplane. In a possible implementation, an inter-process communication (IPC) channel is established between the main control board 2110 and the interface board 2130, and communication is performed between the main control board 2110 and the interface board 2130 through the IPC channel.
[0198] Logically, the traffic control device 2100 includes a control plane and a forwarding plane. The control plane includes the main control board 2110 and the central processing unit 2131, and the forwarding plane includes various components that perform forwarding, such as a forwarding table entry memory 2134, a physical interface card 2133, and a network processor 2132. The control plane executes functions such as acting as a router, generating a forwarding table, processing signaling and protocol messages, and configuring and maintaining the status of the device. The control plane distributes the generated forwarding table to the forwarding plane. In the forwarding plane, the network processor 2132 looks up the table and forwards the packets received by the physical interface card 2133 based on the forwarding table distributed by the control plane. The forwarding table distributed by the control plane can be stored in the forwarding table entry memory 2134. In some embodiments, the control plane and the forwarding plane can be completely separated and not on the same device.
[0199] It should be noted that there may be one or more main control boards. When there are multiple main control boards, it may include an active main control board and a standby main control board. There may be one or more interface boards. The stronger the data processing ability of the flow control device, the more interface boards are provided. There may also be one or more physical interface cards on the interface board. There may be no switching network board, or there may be one or more switching network boards. When there are multiple switching network boards, they can jointly implement load sharing and redundant backup. In the centralized forwarding architecture, the flow control device may not require a switching network board, and the interface board undertakes the processing function of the service data of the entire system. In the distributed forwarding architecture, the flow control device may have at least one switching network board, and data exchange between multiple interface boards is achieved through the switching network board, providing a large-capacity data exchange and processing ability. Therefore, the data access and processing ability of the flow control device in the distributed architecture is greater than that of the device in the centralized architecture. Optionally, the form of the flow control device may also be a single board card, that is, there is no switching network board, and the functions of the interface board and the main control board are integrated on this single board card. At this time, the central processing unit on the interface board and the central processing unit on the main control board can be combined into one central processing unit on this single board card to execute the functions after the superposition of the two. The data exchange and processing ability of this form of device is relatively low (for example, communication devices such as low-end switches or routers). Which architecture is specifically adopted depends on the specific networking deployment scenario and is not limited here.
[0200] In an exemplary embodiment, a flow control system is provided. The system includes a first device and a second device. The first device is configured to execute Figure 6 the method executed by the first device in Figure 6 and the second device is configured to execute
[0201] the method executed by the second device in Figure 6 .
[0202] In an exemplary embodiment, a computer program (product) is provided. The computer program (product) includes: computer program code. When the computer program code is run on a computer, it causes the computer to execute Figure 6 the method in
[0203] In an exemplary embodiment, a chip is provided, including a processor configured to call and run instructions stored in a memory, such that a computer installed with the chip executes the method in the figure.
[0204] 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 configured to execute the code in the memory. When the code is executed, the computer installed with the chip executes Figure 6 the method in
[0205] In the above embodiment, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part 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, the processes or functions described in this application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. 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 by wire (such as coaxial cable, optical fiber, digital subscriber line) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk).
[0206] In this application, terms such as "first" and "second" are used to distinguish between identical or similar items with basically the same function and role. It should be understood that there is no logical or temporal dependence between "first", "second", and "nth", nor are the quantity and execution order limited. It should also be understood that although the following description uses terms such as first and second to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another.
[0207] It should also be understood that in various embodiments of this application, the magnitude of the serial numbers 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 to the implementation process of the embodiments of this application.
[0208] As used in this application, the term "at least one" means one or more, and the term "a plurality" means two or more. For example, a plurality of second devices means two or more second devices. The terms "system" and "network" are often used interchangeably herein.
[0209] It should be understood that the terms used in the description of the various examples herein are only for describing specific examples and are 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.
[0210] 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 associated listed items. The term "and / or" describes an associative relationship between associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.
[0211] It should further be understood that the terms "if" and "when" can be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "if determined..." or "if [stated condition or event] is detected" can be interpreted to mean "when determining..." or "in response to determining..." or "when [stated condition or event] is detected" or "in response to detecting [stated condition or event]".
[0212] The above are only embodiments of this application and are not used to limit this application. Any modifications, equivalent replacements, improvements, etc. made within the principles of this application shall be included within the protection scope of this application.
Claims
1. A flow control method, characterized in that, The method includes: A 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 a data stream. The first message includes identification information of the second device and a control flag, and the control flag indicates that the first device performs flow control on the data stream sent to the second device. Based on the identification information of the second device, a first data stream sent to the second device is determined from the data streams to be sent by the first device. Flow control is performed on the first data stream according to the control flag.
2. The method according to claim 1, characterized in that, The performing flow control on the first data stream according to the control flag includes: Obtaining a control policy according to the control flag, where the control policy includes at least one of the type of the data stream to be sent or the sending rate. Performing flow control on the first data stream according to the control policy.
3. The method according to claim 2, characterized in that, The first data stream includes a first critical data stream of the type of critical data stream and a first non-critical data stream of the type of non-critical data stream. The control policy 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. The performing flow control on the first data stream according to the control policy includes: Pausing sending the first non-critical data stream to the second device. Sending the first critical data stream to the second device.
4. The method according to claim 2 or 3, characterized in that, The control policy includes the sending rate. The performing flow control on the first data stream according to the control policy includes: Sending the first data stream to the second device at a first rate, where the first rate is determined based on the resources used by the second device to receive the data stream.
5. The method according to any one of claims 1 - 4, characterized in that, The performing flow control on the first data stream according to the control flag includes: Obtaining the effective time of the control. Obtaining the expiration time of the control. Within the effective time and the expiration time, performing flow control on the first data stream according to the control flag.
6. The method according to claim 5, characterized in that, The first message further includes the effective time or the pre-effective time. The obtaining the effective time of the control includes: When the first message includes the effective time, obtaining the effective time from the first message. When the first message includes the pre-effective time, obtaining the pre-effective time from the first message; obtaining the effective buffer time of the first device, and determining the effective time 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 further includes the expiration time or the pre-expiration time. The obtaining the expiration time of the control includes: When the first message includes the expiration time, obtaining the expiration time from the first message. When the first message includes the pre-expiration time, obtaining the pre-expiration time from the first message; obtaining the expiration buffer time of the first device, and determining the expiration time according to the pre-expiration time and the expiration buffer time.
8. The method according to any one of claims 1 - 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, and 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 further includes device information, where the device information is information of a device used to control the data stream sent to 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 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 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 includes: When the receiving capacity of the second device for a data stream is insufficient, the second device determines a first device for performing flow control on the data stream, where the first device is connected to the second device; Sending a first message to the first device, where the first message includes the identification information of the second device and a control identifier, and the control identifier indicates that the first device performs flow control on the data stream sent to the second device.
10. The method according to claim 9, characterized in that, Before the second device determines a first device for performing flow control on a data stream when the receiving capacity of the second device for the data stream is insufficient, it further includes: Obtaining the occupancy of the resources of the second device for receiving the data stream; Based on the occupancy being greater than or equal to the occupancy threshold of the resources, determining that the receiving capacity of the second device for the data stream is insufficient.
11. The method according to claim 10, wherein, The occupancy is determined based on at least one of the occupancy ratio of the buffer queue for buffering the data stream by the second device, the occupancy ratio of the bandwidth for receiving the data stream by the second device, or the utilization rate of the processing unit for processing the data stream by the second device.
12. The method according to any one of claims 9-11, wherein, Sending the first message to the first device includes: Obtaining 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 receiving capacity of the second device for the data stream is insufficient being greater than or equal to a time threshold, sending the first message to the first device, where 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-12, wherein, 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 first message is a multicast message, and the first message further includes the device information of the first device, where 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-13, wherein, The first message further includes at least one of a start time and an end time indicating that the first device performs flow control on the 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-14, wherein, When the receiving capability of the second device for the data stream is insufficient, determining a first device for performing flow control on the data stream, including: When the receiving capability of the second device for the data stream is insufficient, determining the service to which the data stream for which flow control is to be performed belongs; Determining the first device to which the service belongs.
16. The method according to any one of claims 1-15, wherein, The first device and the second device are devices in a vehicle network.
17. A flow control device, wherein, The apparatus is applied to a first device, and the apparatus includes: A receiving module, configured to receive 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 stream is insufficient, and the first message includes identification information of the second device and a control flag, and the control flag indicates that the first device performs flow control on the data stream sent to the second device; A determining module, configured to determine a first data stream sent to the second device from the data streams to be sent by the first device based on the identification information of the second device; A control module, configured to perform flow control on the first data stream according to the control flag.
18. A flow control device, wherein, The apparatus is applied to a second device, and the apparatus includes: A determining module, configured to determine 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, where the first device is connected to the second device; A sending module, configured to send a first message to the first device, where the first message includes identification information of the second device and a control flag, and the control flag indicates that the first device performs flow control on the data stream sent to the second device.
19. A flow control device, wherein, The flow control device includes a processor, and the processor is coupled to a memory; at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to enable the flow control device to implement the flow control method according to any one of claims 1-16.
20. A computer-readable storage medium, wherein, At least one instruction is stored in the computer-readable storage medium, and the instruction is loaded and executed by a processor to implement the flow control method according to any one of claims 1-16.
21. A computer program product, wherein, The computer program product includes a computer program / instructions, and the computer program / instructions are executed by a processor to enable a computer to implement the flow control method according to any one of claims 1-16.
Citation Information
Cited By
Method for transmitting streaming data through streaming processing bus and transmission system
CN120675949A