Congestion control method and device, electronic equipment and storage medium
By monitoring the network interface card's outbound bandwidth and RTT, and using a gain coefficient to cyclically adjust the packet sending rate, the problem of PFC in RoCE being unable to adapt to dynamic load was solved, achieving adaptive rate adjustment, avoiding congestion and latency jitter, and improving network stability and resource utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XINHUASAN INFORMATION TECH CO LTD
- Filing Date
- 2026-02-14
- Publication Date
- 2026-04-28
AI Technical Summary
In existing technologies for Remote Direct Memory Access (RoCE) over converged Ethernet, pre-priority flow control (PFC) is difficult to adapt to dynamic service loads, leading to congestion and latency jitter under high loads. Hardware-level flow control cannot predict network congestion, and software-level feedback has high latency and cannot be adjusted in real time.
By monitoring the network interface card (NIC) egress bandwidth and round-trip time (RTT), the packet transmission rate is dynamically adjusted using a gain coefficient cyclically, combined with a congestion level strategy. This includes gradually adjusting the rate under uncongested bandwidth conditions, monitoring RTT changes and flow control events, and adaptively adjusting the transmission rate to avoid congestion.
It enables adaptive rate adjustment in high-performance network connection scenarios, avoiding congestion problems caused by pre-planned flow control, improving network resource utilization and service stability, reducing the dropping of critical service data packets, and avoiding the risk of deadlock.
Smart Images

Figure CN121940358A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network communication technology, and in particular to congestion control methods, devices, electronic equipment, and storage media. Background Technology
[0002] Currently, large amounts of data are transmitted in networking scenarios such as carrier networks, enterprise networks, data center networks, and home networks using Fiber to the Room (FTTR). Remote Direct Memory Access over Converged Ethernet (RoCE) can be applied to data transmission in these scenarios due to its advantages such as zero packet loss and low latency at the underlying network. While Priority Flow Control (PFC) can mitigate congestion to some extent during data transmission, it requires pre-prioritizing, making it difficult to adapt to dynamic service loads. Under high loads, congestion can easily occur, leading to latency jitter. Summary of the Invention
[0003] This invention provides a congestion control method, apparatus, electronic device, and storage medium to avoid problems caused by PFC (Power Flow Control), which relies on pre-planning for flow control, such as difficulty in adapting to dynamic service loads and susceptibility to congestion under high loads.
[0004] According to a first aspect of the present invention, a congestion control method is provided, the method comprising: When it is detected that the network card's outgoing bandwidth meets the set bandwidth congestion-free condition, the packet transmission rate sent to the network card is adjusted sequentially according to the order of each gain coefficient in the set gain coefficient loop group. After adjusting the packet transmission rate sent to the network card according to the last gain coefficient, if it is detected that the network card's outgoing bandwidth still meets the set bandwidth congestion-free condition, then the step of adjusting the packet transmission rate sent to the network card sequentially according to the order of each gain coefficient in the set gain coefficient loop group is returned. If the change in the current round-trip time (RTT) compared to the previous RTT exceeds a preset threshold, then the current minimum RTT is determined. When a flow control event is detected, the congestion level is determined based on the current minimum RTT and the egress bandwidth of the network interface card (NIC), and the packet transmission rate to the NIC is adjusted based on the congestion policy corresponding to the congestion level.
[0005] Optionally, in another embodiment of this application, the method further includes: reducing the packet transmission rate to the network card when the network card's outbound bandwidth is detected to meet a set bandwidth bottleneck condition; The monitoring of the network interface card's outbound bandwidth meeting the set bandwidth bottleneck conditions includes: In the initial stage when the network card starts receiving packets, or during the process of adjusting the packet transmission rate to the network card according to a specified strategy after the network card's egress recovers from congestion, it is detected that the bandwidth growth rate of the egress is less than a set threshold for N consecutive RTTs.
[0006] Optionally, in another embodiment of this application, adjusting the packet transmission rate sent to the network card sequentially according to the order of each gain coefficient in the set gain coefficient cyclic group includes: The first gain coefficient in the set gain coefficient loop group is taken as the current gain coefficient; Adjust the packet transmission rate to the network card based on the current gain coefficient; After maintaining the adjusted message transmission rate for M RTTs, if the current gain coefficient is not the last gain coefficient in the set gain coefficient cycle group, then the next gain coefficient in the set gain coefficient cycle group is taken as the current gain coefficient, and the process returns to the step of adjusting the message transmission rate to the network card based on the current gain coefficient.
[0007] Optionally, in another embodiment of this application, the method further includes: Periodically send RTT packets to the network interface card to obtain candidate RTTs; Determining the current minimum RTT includes: If there is no current minimum RTT, then select the smallest candidate RTT from the obtained candidate RTTs as the current minimum RTT; If a current minimum RTT exists, then if the most recently obtained candidate RTT is less than the current minimum RTT, the current minimum RTT will be updated to that candidate RTT.
[0008] Optionally, in another embodiment of this application, the congestion level is related to the utilization rate of the network interface card's egress bandwidth, the change in the current minimum RTT, and the reception frequency of the received network congestion flag; Among them, the utilization rate of the network card's outbound bandwidth is positively correlated with the congestion level; the receiving frequency of the network congestion identifier is positively correlated with the congestion level; the current minimum RTT is positively correlated with the congestion level; the higher the congestion level, the more severe the congestion.
[0009] Optionally, in another embodiment of this application, adjusting the packet transmission rate sent to the network interface card based on the congestion policy corresponding to the congestion level includes: When the congestion level is greater than or equal to the first level, the packet transmission rate sent to the network card is adjusted sequentially according to the order of each gain coefficient in the set gain coefficient loop group. When the congestion level is greater than or equal to the second level, the packet transmission rate to the network card is adjusted to be transmitted according to a set first transmission rate, which is less than the transmission rate before adjustment. When the congestion level is greater than or equal to the third level, the packet transmission rate to the network card is adjusted to be transmitted at a set second transmission rate, which is less than the first transmission rate. Wherein, the third level number is greater than the second level number, and the second level number is greater than the first level number.
[0010] Optionally, in another embodiment of this application, the method is applied to a flow control component in a user-space basic network library. When the outbound bandwidth of the network card is detected to meet the set bandwidth bottleneck condition, the flow control component reduces the packet sending rate to the network card to clear the queue of the user-space driver layer. The packet is sent to the network card by the flow control component in response to the service request of the upper-layer service software.
[0011] According to a second aspect of the present invention, a congestion control device is provided, the device comprising: The monitoring module is used to monitor the network interface card's outbound bandwidth, minimum RTT, and flow control events. The transmission control module is used to control the packet transmission rate sent to the network card in the order of each gain coefficient in the set gain coefficient loop group when the network card's outgoing bandwidth meets the set bandwidth congestion condition. After adjusting the packet transmission rate sent to the network card according to the last gain coefficient, if the network card's outgoing bandwidth still meets the set bandwidth congestion condition, the module returns to the step of adjusting the packet transmission rate sent to the network card in the order of each gain coefficient in the set gain coefficient loop group. The congestion regulation module is used to determine the current minimum RTT when the change in the currently detected round-trip time (RTT) compared to the previously detected RTT exceeds a preset threshold; and when a flow control event is detected, to determine the congestion level based on the current minimum RTT and the network interface card's (NIC) egress bandwidth, and to adjust the packet transmission rate to the NIC based on the congestion policy corresponding to the congestion level.
[0012] The device further includes an initialization module, used to reduce the packet transmission rate to the network card when the network card's outbound bandwidth is detected to meet a set bandwidth bottleneck condition.
[0013] According to a third aspect of the present invention, an electronic device is provided, the electronic device comprising: Processor; and A computer-readable storage medium storing computer program instructions that, when executed by the processor, cause the processor to perform the steps of the method described above.
[0014] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein computer program instructions are stored thereon, which, when executed by a processor, cause the processor to perform the steps of the method described above.
[0015] This invention is applied to networking scenarios such as carrier networks, enterprise networks, data center networks, and home network FTTR. This embodiment monitors the network interface card's (NIC) egress bandwidth and adjusts the packet transmission rate to the NIC when the NIC's egress bandwidth meets a set congestion-free condition. When the change in the currently monitored round-trip time (RTT) compared to the previously monitored RTT exceeds a preset threshold, the current minimum RTT is determined. Upon detecting a flow control event, the congestion level is determined based on the current minimum RTT and the NIC's egress bandwidth to adjust the NIC's packet transmission rate. This achieves adaptive rate adjustment, avoiding problems caused by pre-planned flow control methods like PFC, such as difficulty adapting to dynamic service loads and susceptibility to congestion under high loads. Attached Figure Description
[0016] Figure 1 A network architecture diagram provided for embodiments of this application; Figure 2 A flowchart illustrating the method provided in this application embodiment; Figure 3 Another method flowchart provided for embodiments of this application; Figure 4 This is a structural diagram of the device provided in the embodiments of this application. Detailed Implementation
[0017] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, and to make the above-mentioned objectives, features and advantages of the embodiments of the present invention more apparent and understandable, the technical solutions in the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0018] The following description uses RoCE network as an example to describe the embodiments of this application in detail. In practical applications, the present invention can also be applied to networks using FTTR architecture.
[0019] See Figure 1In the network architecture diagram, client A can remotely access server E via network devices, such as a switch, to obtain data information. Server E needs to send the data information to the switch, which then sends it back to client A. When server E sends data information in RDMA mode, flow control typically relies on hardware-level flow control mechanisms, such as PFC / ECN. For example, PFC provides per-hop priority-based flow control for various types of traffic. When forwarding packets, network devices allocate packets to queues for scheduling and forwarding by looking up their priority in a priority mapping table. The core idea is that when the receiver's buffer is full, a pause frame is sent to the sender, requesting it to pause the transmission of data with a specific priority.
[0020] This flow control scheme relies on hardware control mechanisms, namely gateways or network controllers, and can only guarantee no packet loss at the hardware link level. However, network congestion is not reported to the upper application layer. In this situation, relying solely on hardware-level flow control mechanisms cannot provide prediction. For example, PFC can only trigger a pause after a buffer overflow, and cannot adjust the sending rate in advance to avoid network congestion. Furthermore, hardware-level flow control is passive and carries the risk of deadlock. For instance, pause frames from PFC in multi-level switches may form loops, causing network traffic to periodically drop to zero or even be interrupted. In addition, since hardware-level flow control only controls the link layer, it cannot obtain the service priority of the software application layer. In some cases, it may drop packets of critical services, leading to the collapse of critical services.
[0021] The software-layer flow control schemes of related technologies are based on the TCP protocol, which is incompatible with RoCEv2's UDP protocol. Furthermore, this scheme suffers from high feedback latency and lag, failing to accurately detect network congestion in real time and adjust rates rapidly. Additionally, the software-layer scheme does not adequately match the actual traffic changes after the service is running, failing to achieve smooth adjustments. Software flow control only adjusts the sending rate, failing to provide multi-level feedback of congestion signals, resulting in a disconnect between service concurrency and network conditions.
[0022] To address this, this application proposes a congestion control method applicable to high-speed, high-performance network connection scenarios, such as carrier networks, enterprise networks, data center networks, and home FTTR networks. In a typical embodiment, this invention can also be deployed in FTTR fiber-to-the-room networks for adaptive adjustment of service traffic at each room level. The solution in this application improves network resource utilization and service stability by monitoring multiple network communication parameters to determine the degree of network congestion and adjust the communication status.
[0023] The specific implementation process of various embodiments of the present invention will now be described with reference to the accompanying drawings.
[0024] See Figure 2 A flowchart of an embodiment of a congestion control method of the present invention is shown. The method is applied to a network device and includes: When the network interface card's (NIC) outbound bandwidth is detected to meet the set bandwidth congestion-free condition, the packet transmission rate to the NIC is adjusted sequentially according to the order of the gain coefficients in the set gain coefficient loop group. After adjusting the packet transmission rate to the NIC according to the last gain coefficient, if the NIC's outbound bandwidth still meets the set bandwidth congestion-free condition, the process returns to the step of adjusting the packet transmission rate to the NIC sequentially according to the order of the gain coefficients in the set gain coefficient loop group. If the change in the currently detected round-trip time (RTT) compared to the previously detected RTT exceeds a preset threshold, the current minimum RTT is determined. When a flow control event is detected, the congestion level is determined based on the current minimum RTT and the NIC's outbound bandwidth, and the packet transmission rate to the NIC is adjusted based on the congestion strategy corresponding to the congestion level. For example, the preset threshold here can be set to any value between 5% and 10% of the previously detected RTT. A flow control event refers to a network congestion event where the frequency of received network congestion indicators exceeds a set threshold, such as a PFC / CNP trigger level exceeding 100pps.
[0025] In embodiments of this application, the method further includes: reducing the packet transmission rate to the network card when the network card's outbound bandwidth is detected to meet a set bandwidth bottleneck condition; The monitoring of the network interface card's outbound bandwidth meeting the set bandwidth bottleneck conditions includes: In the initial stage when the network interface card (NIC) begins receiving packets, or during the process of adjusting the packet transmission rate to the NIC according to a specified strategy after the NIC's egress recovers from congestion, if it is detected that the bandwidth growth rate of the egress is less than a set threshold for N consecutive RTTs, the specified strategy involves adjusting the packet transmission rate to the NIC according to a set gain coefficient based on the initial rate in the initial stage or after the NIC's egress recovers from congestion. Simultaneously, the bandwidth growth rate of the NIC's egress is monitored. If the bandwidth growth rate is greater than or equal to the set threshold, the packet transmission rate to the NIC is adjusted again according to the set gain coefficient until the bandwidth growth rate of the NIC's egress is detected to be less than the set threshold for N consecutive RTTs. The initial rate can be set to a value lower than the NIC's egress bandwidth, for example, 30% of the NIC's egress bandwidth. The initial rate after the NIC's egress recovers from congestion is the packet transmission rate of the NIC in the last RTT before congestion recovery. The gain coefficient is a coefficient greater than 1. For example, 1.5; the threshold can be set to 5%, that is, the packet sending rate to the network card is 1.5 times the initial rate after one RTT time after the initial rate, and the bandwidth growth rate is monitored. If the bandwidth growth rate is greater than or equal to 5%, then in the next RTT, packets are sent to the network card again at 1.5 times the sending rate of the previous RTT, and the bandwidth growth rate is monitored. Under the premise that the bandwidth growth rate is greater than or equal to 5%, the steps of sending packets to the network card at 1.5 times the sending rate of the previous RTT and monitoring the bandwidth growth rate are repeatedly executed in the next RTT until the bandwidth growth rate in multiple RTTs is less than 5%, which can determine that the network card's outbound bandwidth has reached the set bandwidth bottleneck condition.
[0026] The step of adjusting the packet transmission rate sent to the network card sequentially according to the order of the gain coefficients in the set gain coefficient cyclic group includes: The first gain coefficient in the set gain coefficient loop group is taken as the current gain coefficient; Adjust the packet transmission rate to the network card based on the current gain coefficient; After maintaining the adjusted message transmission rate for M RTTs, if the current gain coefficient is not the last gain coefficient in the set gain coefficient cycle group, then the next gain coefficient in the set gain coefficient cycle group is taken as the current gain coefficient, and the process returns to the step of adjusting the message transmission rate to the network card based on the current gain coefficient. The gain coefficient cycle group includes multiple gain coefficients, arranged as follows: a first gain coefficient greater than 1, a second gain coefficient less than 1, a third gain coefficient less than the first gain coefficient but greater than 1, a fourth gain coefficient greater than the second gain coefficient but less than 1, and so on, until the final gain coefficient converges to 1.
[0027] The method further includes: Periodically send RTT packets to the network interface card to obtain candidate RTTs; Determining the current minimum RTT includes: If there is no current minimum RTT, then select the smallest candidate RTT from the obtained candidate RTTs as the current minimum RTT; If a current minimum RTT exists, then if the most recently obtained candidate RTT is less than the current minimum RTT, the current minimum RTT will be updated to that candidate RTT.
[0028] In this embodiment, periodically sending RTT packets to the network card to obtain candidate RTTs includes: sending RTT packets to the network card through the flow control component, using Q units of time as the current interval, determining whether the current interval is the set maximum interval, where Q is a positive integer 1; if so, after the current interval has elapsed, sending RTT packets to the network card through the flow control component, increasing the current interval by K units of time as the current interval, returning to determine whether the current interval is the set maximum interval; if not, ending the current process, where K is a positive integer 1, and the maximum interval is a positive integer 10.
[0029] The congestion level is related to the utilization rate of the network interface card's egress bandwidth, the change in the current minimum RTT, and the reception frequency of the received network congestion flags. Specifically, the utilization rate of the network interface card's (NIC) egress bandwidth is positively correlated with the congestion level; the reception frequency of the network congestion identifier is positively correlated with the congestion level; and the current minimum RTT is positively correlated with the congestion level. A higher congestion level indicates more severe congestion. The network congestion identifier here includes PFC or CNP trigger values, which are sent externally (e.g., by a switch) and can be read by the NIC through hardware counting.
[0030] The adjustment of the packet transmission rate to the network interface card based on the congestion policy corresponding to the congestion level includes: When the congestion level is greater than or equal to the first level, the packet transmission rate sent to the network card is adjusted sequentially according to the order of each gain coefficient in the set gain coefficient loop group. When the congestion level is greater than or equal to the second level, the packet transmission rate to the network card is adjusted to be transmitted according to a set first transmission rate, which is less than the transmission rate before adjustment. When the congestion level is greater than or equal to the third level, the packet transmission rate to the network card is adjusted to a set second transmission rate, which is less than the first transmission rate.
[0031] Wherein, the third level number is greater than the second level number, and the second level number is greater than the first level number.
[0032] The method is applied to the flow control component in the user-space basic network library. When the network interface card's (NIC) egress bandwidth is detected to meet the set bandwidth bottleneck condition, the flow control component reduces the packet sending rate to the NIC to clear the queue of the user-space driver layer. The packet is sent to the NIC by the flow control component in response to the service request from the upper-layer service software. Specifically, after receiving the service request from the upper-layer service software, the upper-layer service software responds by sending a packet to the NIC through the flow control component. The flow control component controls the packet sending rate to the NIC based on the monitored egress bandwidth of the network interface to solve problems such as queue accumulation in the user-space driver layer and even congestion at the NIC egress. At the same time, when congestion occurs at the NIC egress, the congestion level is fed back to the upper-layer service software, which then adjusts the time interval and concurrency of service request delivery.
[0033] The following section continues with a detailed description of this application using RoCE networks as an example. See also: Figure 1 The network architecture diagram illustrates that each client accesses one or more servers providing corresponding services through a switch based on its own business needs. For example, client A accesses server E providing the corresponding service through switch X, client B accesses servers F and H providing the corresponding services through switch X, and client C accesses server G through switch X. Each server sends data information to the client on the other end via the corresponding switch according to the business needs it receives. For example, switch X may simultaneously receive data information from servers E, F, G, and H, resulting in a large influx of data packets onto switch X, potentially causing network congestion. This, in turn, limits the outbound bandwidth of the network cards of servers E, F, G, and H, leading to congestion. To avoid network card congestion on each server, the method of this application can be applied to each server. Taking server E as an example, see [link to application details]. Figure 3As shown, in the initial stage when server E establishes a connection with switch X for network communication and the flow control component starts sending packets to the network interface card (NIC), or in the recovery stage after server E's NIC egress has recovered from congestion, the flow control component sends data packets to server E's NIC using a high gain coefficient. Taking the initial stage of communication between server E and switch X as an example, assuming the maximum available bandwidth of server E's NIC egress is 100G, the packet sending rate to the NIC can initially use 30% of the NIC egress bandwidth as the initial rate, for example, 30G. Since this sending rate is much smaller than the maximum available bandwidth of the NIC egress, the packets received by the NIC can be successfully sent out through the NIC egress. Subsequently, based on the initial rate, a gain coefficient higher than 1 is used to send packets to the NIC, for example, packets can be sent to the NIC at 1.5 times the initial rate. Here, the rate is defined as the number of packets sent per second, and the maximum rate refers to the theoretically maximum rate that the NIC egress bandwidth can withstand without causing congestion. It should also be noted that during the recovery phase after the network interface card (NIC) recovers from congestion (such as a sudden surge in traffic triggering extensive flow control), the initial rate refers to the current transmission rate of packets sent to the NIC by the flow control component when the NIC's egress point recovers from congestion. Furthermore, the egress bandwidth of server E's NIC can be determined based on the packet size and the round-trip time (RTT). Here, the NIC's egress bandwidth is monitored as real-time bandwidth, i.e.: Real-time bandwidth = Total number of bytes in the packet / Round-trip time. Furthermore, the real-time bandwidth measured when sending packets at 1.5 times the initial rate is compared with the real-time bandwidth measured when sending packets at the initial rate. In other words, the current real-time bandwidth is compared with the previous real-time bandwidth. Here, both the current real-time bandwidth and the previous real-time bandwidth are values measured over one RTT cycle. If the current real-time bandwidth increases by more than 5% compared to the previous real-time bandwidth, the flow control component continues to send packets to the network card at 1.5 times the sending rate of the previous (previous RTT cycle). That is, when the real-time bandwidth increases by more than 5%, the flow control component repeatedly sends packets at 1.5 times the sending rate of the previous time, causing the real-time bandwidth to increase rapidly. If the real-time bandwidth growth rate is measured to be less than 5% multiple times consecutively (e.g., 3 times consecutively, i.e., within 3 RTT cycles), it indicates that the real-time bandwidth, which is the network card's outbound bandwidth, has reached the bottleneck bandwidth. The transmission rate sent by the flow control component to the network card has reached the standard rate corresponding to the bottleneck bandwidth, and the standard rate is close to the maximum rate. The server's network card can no longer withstand a higher transmission rate, and the packet transmission queue in the network card is saturated and gradually accumulates. At this time, the flow control component should no longer send packets with a high gain coefficient to avoid severe accumulation of the packet transmission queue and congestion of the server's network card.
[0034] To avoid severe congestion in the packet transmission queue, the flow control component adjusts to send packets to the network interface card (NIC) at a lower gain coefficient to initiate the queue clearing phase. For example, it sends packets at 0.75 times the standard rate, thereby reducing the injection of new packets. This allows the packets accumulated in the transmission queue to be sent out gradually until the queue is cleared, and the NIC is in a congestion-free state. It's important to note that the criterion for determining when the packet transmission queue is cleared is that In-flight data volume ≤ BDP (Bandwidth-Delay Product, where BDP = bottleneck bandwidth × minimum round-trip time). In other words, when the amount of data sent but for which no acknowledgment has been received is less than or equal to the product of the bottleneck bandwidth and the minimum RTT, the transmission queue is considered cleared.
[0035] When the packet transmission queue is cleared and the network is no longer congested, the flow control component adjusts the transmission rate to send packets to the network interface card (NIC) using a stable gain coefficient. Simultaneously, it continues to monitor the NIC's real-time bandwidth, entering the bandwidth probing phase. Here, an 8-phase gain coefficient cycle can be used to maintain a balance between high network throughput and low latency. Specifically, the transmission rate to the NIC is adjusted to 1.2 times the standard rate in the first RTT, 0.8 times in the second RTT, 1.1 times in the third RTT, 0.9 times in the fourth RTT, 1.05 times in the fifth RTT, and finally back to the standard rate in the sixth RTT. The network interface card (NIC) initially sends packets at 0.95 times the standard rate. Within the seventh RTT, this is adjusted to 1.0 times the standard rate, and again within the eighth RTT, it continues at 1.0 times the standard rate. In other words, the gain coefficient is switched every RTT cycle. By adjusting the packet transmission rate using eight sets of gain coefficients [1.20, 0.80, 1.10, 0.90, 1.05, 0.95, 1.0, 1.0], the NIC's outgoing bandwidth cycles through "probe-release-cruise" and gradually contracts. Simultaneously, if the monitored outgoing bandwidth and RTT remain stable without significant fluctuations, the aforementioned eight-phase gain coefficients are continuously used to ensure a balance between high throughput and low latency. If a 5% increase in RTT occurs during this process, it indicates that the NIC is entering a congestion precursor phase and requires further RTT probing.
[0036] When network interface cards (NICs) show signs of impending congestion, the flow control component sends packets to the NIC at a standard rate and periodically probes the minimum time-to-reach (RTT). For example, an RTT probe is forcibly triggered every 1 second, lasting 100 milliseconds each time. If the measured current RTT is less than the previously measured minimum RTT, the minimum RTT is updated, and the RTT probe interval is increased by 1 second, meaning an RTT probe is forcibly triggered every 2 seconds, with a maximum interval of 10 seconds. If the measured current RTT is greater than or equal to the previous minimum RTT, the original minimum RTT remains unchanged, and after the interval reaches the maximum value of 10 seconds, an RTT probe is continuously triggered every 10 seconds. If the minimum RTT remains unchanged multiple times during the minimum RTT probe process, the receiving frequency of the network congestion flag sent by the switch is checked, i.e., the flow control trigger status. If the flow control trigger exceeds a set threshold, such as a PFC / CNP trigger exceeding 100 pps, the flow control probe phase needs to be initiated. Here, a PFC / CNP trigger rate exceeding 100pps means that the number of PFC triggers or CNP message generation per second exceeds 100. It should also be noted that when the minimum RTT obtained from multiple triggers remains constant, "multiple triggers" can also refer to three consecutive triggers, i.e., within three RTT cycles. Of course, in practical applications, those skilled in the art can adjust this according to the actual situation; this is merely an exemplary example.
[0037] When the PFC / CNP trigger rate exceeds 100pps, combined with the network card's outbound bandwidth utilization, minimum RTT, and flow control trigger rate, network congestion is classified into the following levels: Level I: Bandwidth utilization is greater than or equal to 80%, minimum RTT time value remains basically unchanged, and PFC / CNP trigger level exceeds 100pps.
[0038] Level II, with bandwidth utilization greater than or equal to 90%, minimum RTT time value increased by 1.5 times, and PFC / CNP trigger level exceeding 1000pps.
[0039] Level III: Bandwidth utilization is greater than or equal to 100%, minimum RTT time value is increased to 2 times, and PFC / CNP trigger level exceeds 10000pps.
[0040] It should be noted here that bandwidth utilization is the ratio of the current network card's outbound bandwidth to the bottleneck bandwidth.
[0041] To address the aforementioned network congestion level, the server needs to adjust its sending rate as follows: For Level I, the flow control component sends packets to the network interface card (NIC) in a loop according to a gain array. For example, it fine-tunes the transmission rate using eight gain coefficients: [1.20, 0.80, 1.10, 0.90, 1.05, 0.95, 1.0, 1.0], to avoid aggressive rate reduction. The specific adjustment method is the same as in the bandwidth detection phase, so it will not be repeated here.
[0042] For Level II, the flow control component adjusts the rate at which it sends packets to the network interface card (NIC) to 0.75 times the standard rate, thereby limiting the injection of new data into the network.
[0043] For Level III, the flow control component adjusts the rate at which it sends packets to the network interface card to 0.33 times the standard rate and suspends the transmission of non-urgent data.
[0044] It should be noted that, based on the preceding description, the standard rate refers to the transmission rate corresponding to the bottleneck bandwidth. Using the standard rate as a benchmark here is for ease of understanding. In other embodiments, the standard rate may not be used; instead, the current rate may be used, and a corresponding gain coefficient may be configured based on this current rate to transmit packets. Furthermore, the gain coefficients of 1.5 times, 0.75 times, and 0.33 times for the standard rate in this embodiment are merely examples. In practical applications, those skilled in the art can adjust the specific gain coefficients according to the actual network conditions.
[0045] To address the aforementioned network congestion levels, congestion metrics (such as congestion level, suggested concurrency, and IO delivery interval) are simultaneously exposed to upper-layer services, triggering adjustments on the service side. Congestion information can be transmitted via callback functions or shared memory.
[0046] Specifically, in one embodiment, when this application is applied to a distributed storage scenario, for the storage client, when the level is greater than or equal to Level II, the read / write concurrency is reduced, such as from 1000 IOPS to 500 IOPS.
[0047] In another embodiment, when this application is applied to an AI training task, when the level is III, the request issuance interval is increased to 100us, parameter synchronization is paused, and priority is given to ensuring the transmission of models that have completed iterations.
[0048] Corresponding to the aforementioned congestion control method embodiments, the present invention also provides embodiments of a congestion control device.
[0049] See Figure 4The device includes a monitoring module 10, a transmission control module 30, and a congestion regulation module 40. The monitoring module 10 monitors the network interface card's (NIC) egress bandwidth, minimum RTT, and flow control events. The transmission control module 30, when detecting that the NIC's egress bandwidth meets the set bandwidth congestion-free condition, controls the packet transmission rate to be sequentially adjusted according to the order of gain coefficients in a set gain coefficient cyclic group. After adjusting the packet transmission rate to be sent to the NIC according to the last gain coefficient, if the NIC's egress bandwidth still meets the congestion condition... If the set bandwidth has no congestion conditions, then return to the step of adjusting the packet transmission rate to the network card in the order of the gain coefficients in the set gain coefficient loop group; the congestion adjustment module 40 is used to determine the current minimum RTT when the change in the currently detected round-trip time (RTT) compared with the previously detected RTT exceeds a preset threshold; and when a flow control event is detected, determine the congestion level based on the current minimum RTT and the network card's outgoing bandwidth, and adjust the packet transmission rate to the network card based on the congestion strategy corresponding to the congestion level.
[0050] The device also includes an initialization module 20, which reduces the packet transmission rate to the network card when the network card's outgoing bandwidth is detected to meet the set bandwidth bottleneck conditions.
[0051] The present invention also provides an electronic device comprising: a processor and a computer-readable storage medium, wherein computer program instructions are stored in the computer-readable storage medium, the computer program instructions, when executed by the processor, cause the processor to perform the steps of the method described above.
[0052] Based on the same application concept as the methods described above, embodiments of this application also provide a machine-readable storage medium storing computer program instructions, which, when executed by the processor, cause the processor to perform the steps of the methods described above. Exemplarily, the aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device, and can contain or store information such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid-state drive, any type of storage disk (such as optical disc, DVD, etc.), or similar storage media, or combinations thereof.
[0053] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.
[0054] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A congestion control method, characterized in that, include: When it is detected that the network card's outgoing bandwidth meets the set bandwidth congestion-free condition, the packet transmission rate sent to the network card is adjusted sequentially according to the order of each gain coefficient in the set gain coefficient loop group. After adjusting the packet transmission rate sent to the network card according to the last gain coefficient, if it is detected that the network card's outgoing bandwidth still meets the set bandwidth congestion-free condition, then the step of adjusting the packet transmission rate sent to the network card sequentially according to the order of each gain coefficient in the set gain coefficient loop group is returned. If the change in the current round-trip time (RTT) compared to the previous RTT exceeds a preset threshold, then the current minimum RTT is determined. When a flow control event is detected, the congestion level is determined based on the current minimum RTT and the egress bandwidth of the network interface card (NIC), and the packet transmission rate to the NIC is adjusted based on the congestion policy corresponding to the congestion level.
2. The congestion control method according to claim 1, characterized in that, The method further includes: when the network interface card's outbound bandwidth is detected to meet the set bandwidth bottleneck condition, reducing the packet transmission rate to the network interface card; The monitoring of the network interface card's outbound bandwidth meeting the set bandwidth bottleneck conditions includes: In the initial stage when the network card starts receiving packets, or during the process of adjusting the packet transmission rate to the network card according to a specified strategy after the network card's egress recovers from congestion, it is detected that the bandwidth growth rate of the egress is less than a set threshold for N consecutive RTTs.
3. The congestion control method according to claim 1, characterized in that, The step of adjusting the packet transmission rate sent to the network card sequentially according to the order of the gain coefficients in the set gain coefficient cyclic group includes: The first gain coefficient in the set gain coefficient loop group is taken as the current gain coefficient; Adjust the packet transmission rate to the network card based on the current gain coefficient; After maintaining the adjusted message transmission rate for M RTTs, if the current gain coefficient is not the last gain coefficient in the set gain coefficient cycle group, then the next gain coefficient in the set gain coefficient cycle group is taken as the new current gain coefficient, and the process returns to the step of adjusting the message transmission rate to the network card based on the current gain coefficient.
4. The congestion control method according to claim 1, characterized in that, The method further includes: Periodically send RTT packets to the network interface card to obtain candidate RTTs; Determining the current minimum RTT includes: If there is no current minimum RTT, then select the smallest candidate RTT from the obtained candidate RTTs as the current minimum RTT; If a current minimum RTT exists, then if the most recently obtained candidate RTT is less than the current minimum RTT, the current minimum RTT will be updated to that candidate RTT.
5. The congestion control method according to claim 1, characterized in that, The congestion level is related to the utilization rate of the network interface card's egress bandwidth, the change in the current minimum RTT, and the reception frequency of the received network congestion flags. Among them, the utilization rate of the network card's outbound bandwidth is positively correlated with the congestion level; the receiving frequency of the network congestion identifier is positively correlated with the congestion level; the current minimum RTT is positively correlated with the congestion level; the higher the congestion level, the more severe the congestion.
6. The congestion control method according to claim 5, characterized in that, The adjustment of the packet transmission rate to the network interface card based on the congestion policy corresponding to the congestion level includes: When the congestion level is greater than or equal to the first level, the packet transmission rate sent to the network card is adjusted sequentially according to the order of each gain coefficient in the set gain coefficient loop group. When the congestion level is greater than or equal to the second level, the packet transmission rate to the network card is adjusted to be transmitted according to a set first transmission rate, which is less than the transmission rate before adjustment. When the congestion level is greater than or equal to the third level, the packet transmission rate to the network card is adjusted to be transmitted at a set second transmission rate, which is less than the first transmission rate. Wherein, the third level number is greater than the second level number, and the second level number is greater than the first level number.
7. The congestion control method according to any one of claims 1-6, characterized in that, The method is applied to the flow control component in the user-space basic network library. When the outbound bandwidth of the network card is detected to meet the set bandwidth bottleneck condition, the flow control component reduces the packet sending rate to the network card to clear the queue of the user-space driver layer. The packet is sent to the network card by the flow control component in response to the service request of the upper-layer service software.
8. A congestion control device, characterized in that, include: The monitoring module is used to monitor the network interface card's outbound bandwidth, minimum RTT, and flow control events. The transmission control module is used to control the packet transmission rate sent to the network card in the order of each gain coefficient in the set gain coefficient loop group when the network card's outgoing bandwidth meets the set bandwidth congestion condition. After adjusting the packet transmission rate sent to the network card according to the last gain coefficient, if the network card's outgoing bandwidth still meets the set bandwidth congestion condition, the module returns to the step of adjusting the packet transmission rate sent to the network card in the order of each gain coefficient in the set gain coefficient loop group. The congestion regulation module is used to determine the current minimum RTT when the change in the currently detected round-trip time (RTT) compared to the previously detected RTT exceeds a preset threshold; and when a flow control event is detected, to determine the congestion level based on the current minimum RTT and the network interface card's (NIC) egress bandwidth, and to adjust the packet transmission rate to the NIC based on the congestion policy corresponding to the congestion level.
9. An electronic device, characterized in that, The electronic device includes: Processor; and A computer-readable storage medium storing computer program instructions that, when executed by the processor, cause the processor to perform the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, cause the processor to perform the steps of the method as described in any one of claims 1 to 7.