TECHNICAL FIELD

This disclosure relates to the field of data communication technologies, and in particular, to a network congestion notification method, an agent node, and a computer device.

BACKGROUND

Remote direct memory access (RDMA) is a data transmission technology. Data can be directly read from a memory of another computer through a network without using a processor, a cache, an operating system, or the like of a computer. Therefore, a data processing delay is reduced in network transmission. However, a Clos manner is usually used to perform networking in an RDMA data center. An uplink interface bandwidth and a downlink interface bandwidth of a switch are asymmetrical in a network. When data is transmitted in the network, network congestion usually occurs, and RDMA communication performance is further affected. To avoid network congestion and improve RDMA communication performance, network congestion needs to be notified in time.

Currently, when network congestion is notified, the following method is mainly used: In a connection management (CM) process, a transmit end and a receive end each obtain a queue pair number of the peer end. When the transmit end needs to send data to the receive end, the transmit end generates a first data packet based on a link layer transport protocol. A destination queue pair number of the first data packet is the queue pair number of the receive end, an explicit congestion notification (ECN) bit is set in an Internet Protocol (IP) header of the first data packet, the ECN bit is used to identify that the first data packet has an ECN capability, and different values of the ECN bit indicate different states of a network. The transmit end sends the first data packet to a network node. When receiving the first data packet and detecting network congestion, the network node changes a value of the ECN bit in the IP header of the first data packet to a value corresponding to a congestion state, to obtain a processed first data packet, and sends the processed first data packet to the receive end. When receiving the processed first data packet and learning through reading that the value of the ECN bit is the value corresponding to the congestion state, the receive end obtains a source queue pair number (the queue pair number of the transmit end), and generates a first congestion notification packet. A destination queue pair number of the first congestion notification packet is the source queue pair number (the queue pair number of the transmit end). The receive end sends the first congestion notification packet to the transmit end through a network. The first congestion notification packet is used to instruct the transmit end to obtain the destination queue pair number of the first congestion notification packet; and instruct the transmit end to decrease, when the destination queue pair number of the first congestion notification packet is the same as the queue pair number of the transmit end, a sending rate of a data flow to which the first data packet belongs.

In the foregoing solution, when network congestion is detected, each network node on a transmission link between the transmit end and the receive end cannot send the first congestion notification packet to the transmit end, and only the receive end can send the first congestion notification packet. As a result, the transmit end cannot decrease, in time, the sending rate of the data flow to which the first data packet belongs. Consequently, a subsequent packet of the data flow to which the first data packet belongs is lost in a transmission process.

SUMMARY

To resolve a prior-art problem, embodiments of this disclosure provide a network congestion notification method, an agent node, and a computer device. The technical solutions are as follows:

According to a first aspect, a network congestion notification method is provided, and the method includes the following content:

In a data transmission process, an agent node receives a first data packet of a transmit end, where the first data packet carries a destination queue pair number. The agent node obtains a source queue pair number of the first data packet based on the destination queue pair number of the first data packet, adds the source queue pair number to the first data packet to obtain a second data packet, and further sends the first data packet to a receive end by using a network node. In a process of forwarding the second data packet, when detecting network congestion, the network node generates a first congestion notification packet based on the second data packet, and further sends the first congestion notification packet to the agent node. A destination queue pair number of the first congestion notification packet is actually a source queue pair number of the second data packet. When receiving the first congestion notification packet, the agent node sends the first congestion notification packet to the transmit end, so that when the destination queue pair number of the first congestion notification packet is the same as a queue pair number of the transmit end, the transmit end decreases a sending rate of a data flow to which the first data packet belongs.

In the solution described in this embodiment of this disclosure, in a transmission process of the first data packet, the agent node adds the source queue pair number to the first data packet. When detecting network congestion, the network node generates the first congestion notification packet based on the first data packet, and further sends the first congestion notification packet to the transmit end through forwarding of the agent node, so that the transmit end can decrease, in time, the sending rate of the data flow to which the first data packet belongs, to avoid losing a subsequent packet of the data flow.

In a first possible implementation of this disclosure, the agent node maintains a queue pair tracking table, and each entry of the queue pair tracking table stores a correspondence between a destination queue pair number and a source queue pair number. Therefore, when receiving the first data packet, the agent node may find, from the queue pair tracking table based on the destination queue pair number, a source queue pair number corresponding to the destination queue pair number. The found source queue pair number is the source queue pair number of the first data packet.

The solution described in this embodiment of this disclosure provides a manner of obtaining a source queue pair number.

In a second possible implementation of this disclosure, to implement data transmission between the receive end and the transmit end, the transmit end and the receive end need to pre-establish a connection to each other. In a connection establishment process, the agent node may track a connection request packet sent by the transmit end, and use, as a destination queue pair number, a destination queue pair number extracted from a base transport header (BTH) of the connection request packet. In addition, the agent node may track a connection response packet sent by the receive end, use, as a source queue pair number, a destination queue pair number extracted from a BTH of the connection response packet, and further record a correspondence between the source queue pair number and the destination queue pair number in the queue pair tracking table.

In the solution described in this embodiment of this disclosure, the agent node establishes the queue pair tracking table by tracking packets sent by the transmit end and the receive end in the connection establishment process, so that when receiving the first data packet, the agent node can find the corresponding source queue pair number based on the destination queue pair number of the first data packet.

In a third possible implementation of this disclosure, after receiving the source queue pair number, the agent node may divide the source queue pair number into a first part and a second part, add the first part of the source queue pair number to a checksum field in a User Datagram Protocol (UDP) header of the first data packet, and add the second part of the source queue pair number to a reserved field in a base transport header BTH of the first data packet, to obtain the second data packet.

In the solution described in this embodiment of this disclosure, the agent node adds the source queue pair number to the first data packet, so that the first data packet carries the source queue pair number. Therefore, during network congestion, the agent node can quickly send the first congestion notification packet to the transmit end based on the source queue pair number. This increases a transmission rate of the first congestion notification packet.

In a fourth possible implementation of this disclosure, when receiving the second data packet and detecting network congestion, the network node parses the second data packet to obtain a source media access control (MAC) address of the second data packet, a destination MAC address of the second data packet, a source Internet Protocol (IP) address of the second data packet, a destination IP address of the second data packet, and a source queue pair number of the second data packet. Based on a parsing result, the network node obtains the first congestion notification packet by using the source MAC address of the second data packet as a destination MAC address of the first congestion notification packet, using the destination MAC address of the second data packet as a source MAC address of the first congestion notification packet, using the source IP address of the second data packet as a destination IP address of the first congestion notification packet, using the destination IP address of the second data packet as a source IP address of the first congestion notification packet, and using the source queue pair number of the second data packet as the destination queue pair number of the first congestion notification packet.

In a fifth possible implementation of this disclosure, the first congestion notification packet includes a queue depth, at a congestion moment, of a queue to which the data flow belongs on the network node. The agent node can determine a sending period of the first congestion notification packet based on the queue depth, and may subsequently send the first congestion notification packet based on the determined sending period.

In the solution described in this embodiment of this disclosure, the agent node can learn of a congestion degree of a current network based on the queue depth, at the congestion moment, of the queue to which the data flow belongs on the network node, and further send the first congestion notification packet to the transmit end based on the sending period determined based on the congestion degree of the network, so that the transmit end can determine, based on the congestion degree of the network, the sending rate of the data flow to which the first data packet belongs. Therefore, the transmit end sends the first data packet at a maximum sending rate while avoiding network congestion, to reduce a delay in the data transmission process.

According to a second aspect, a network congestion notification method is provided, and the method includes the following content:

In a data transmission process, an agent node receives a first data packet that carries a destination queue pair number and that is sent by a transmit end, and sends the first data packet to a receive end by using a network node. In a process of forwarding the first data packet, when detecting network congestion, the network node generates a second congestion notification packet based on the first data packet, and sends the second congestion notification packet to the agent node. A destination queue pair number of the second congestion notification packet is actually the destination queue pair number of the first data packet. When receiving the second congestion notification packet, the agent node obtains, based on the destination queue pair number of the second congestion notification packet, a source queue pair number corresponding to the destination queue pair number, replaces the destination queue pair number of the second congestion notification packet with the source queue pair number to obtain a first congestion notification packet, and further sends the first congestion notification packet to the transmit end, so that when a destination queue pair number of the first congestion notification packet is the same as a queue pair number of the transmit end, the transmit end decreases a sending rate of a data flow to which the first data packet belongs.

In the solution described in this embodiment of this disclosure, in a transmission process of the first data packet, when detecting network congestion, the network node generates the second congestion notification packet, and sends the second congestion notification packet to the agent node. The agent node obtains the first congestion notification packet after replacing the destination queue pair number of the second congestion notification packet with the source queue pair number of the first data packet, and further sends the first congestion notification packet to the transmit end, so that the transmit end can decrease, in time, the sending rate of the data flow to which the first data packet belongs, to avoid losing a subsequent packet of the data flow.

In a first possible implementation of this disclosure, when receiving the first data packet and detecting network congestion, the network node parses the first data packet to obtain a source media access control MAC address of the first data packet, a destination MAC address of the first data packet, a source Internet Protocol IP address of the first data packet, a destination IP address of the first data packet, and the destination queue pair number of the first data packet. Based on a parsing result, the network node may obtain the second congestion notification packet by using the source MAC address of the first data packet as a destination MAC address of the second congestion notification packet, using the destination MAC address of the first data packet as a source MAC address of the second congestion notification packet, using the source IP address of the first data packet as a destination IP address of the second congestion notification packet, using the destination IP address of the first data packet as a source IP address of the second congestion notification packet, and using the destination queue pair number of the first data packet as the destination queue pair number of the second congestion notification packet.

In a second possible implementation of this disclosure, the agent node maintains a queue pair tracking table, and each entry of the queue pair tracking table stores a correspondence between a destination queue pair number and a source queue pair number. Therefore, when receiving the first data packet, the agent node may find, from the queue pair tracking table based on the destination queue pair number, a source queue pair number corresponding to the destination queue pair number. The found source queue pair number is the source queue pair number of the first data packet.

The solution described in this embodiment of this disclosure provides a manner of obtaining a source queue pair number.

In a third possible implementation of this disclosure, to implement data transmission between the receive end and the transmit end, the transmit end and the receive end need to pre-establish a connection to each other. In a connection establishment process, the agent node may track a connection request packet sent by the transmit end, and use, as a destination queue pair number, a destination queue pair number extracted from a base transport header of the connection request packet. In addition, the agent node may track a connection response packet sent by the receive end, use, as a source queue pair number, a destination queue pair number extracted from a BTH of the connection response packet, and further establish a correspondence between the source queue pair number and the destination queue pair number in the queue pair tracking table.

In the solution described in this embodiment of this disclosure, the agent node establishes the queue pair tracking table by tracking packets sent by the transmit end and the receive end in the connection establishment process, so that when receiving the first data packet, the agent node can find the corresponding source queue pair number based on the destination queue pair number of the first data packet.

In a fourth possible implementation of this disclosure, the first congestion notification packet includes a queue depth, at a congestion moment, of a queue to which the data flow belongs on the network node. The agent node can determine a sending period of the first congestion notification packet based on the queue depth, and may subsequently send the first congestion notification packet based on the determined sending period.

In the solution described in this embodiment of this disclosure, the agent node can learn of a congestion degree of a current network based on the queue depth, at the congestion moment, of the queue to which the data flow belongs on the network node, and further send the first congestion notification packet to the transmit end based on the sending period determined based on the congestion degree of the network, so that the transmit end can determine, based on the congestion degree of the network, the sending rate of the data flow to which the first data packet belongs. Therefore, the transmit end sends the first data packet at a maximum sending rate while avoiding network congestion, to reduce a delay in the data transmission process.

According to a third aspect, an agent node for network congestion notification is provided. The agent node includes units for implementing the network congestion notification method in the first aspect, for example, a packet receiving unit, a number obtaining unit, a number adding unit, and a packet sending unit.

According to a fourth aspect, an agent node for network congestion notification is provided. The agent node includes units for implementing the network congestion notification method in the second aspect, for example, a packet receiving unit, a packet sending unit, a number obtaining unit, and a number replacement unit.

According to a fifth aspect, a computer device is provided, including a memory, a processor, a communications interface, and a bus.

The memory, the processor, and the communications interface are connected to each other by using the bus. The memory is configured to store a computer instruction, and the processor is configured to execute the computer instruction stored in the memory. When the computer device runs, the processor runs the computer instruction, so that the computer device performs the network congestion notification method in the first aspect.

According to a sixth aspect, a computer device is provided, including a memory, a processor, a communications interface, and a bus.

The memory, the processor, and the communications interface are connected to each other by using the bus. The memory is configured to store a computer instruction, and the processor is configured to execute the computer instruction stored in the memory. When the computer device runs, the processor runs the computer instruction, so that the computer device performs the network congestion notification method in the second aspect.

According to a seventh aspect, a storage medium is provided. The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the network congestion notification method in the first aspect.

According to an eighth aspect, a storage medium is provided. The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the network congestion notification method in the second aspect.

