Search

CN-122001816-A - Network congestion measurement method, device, network card and storage medium

CN122001816ACN 122001816 ACN122001816 ACN 122001816ACN-122001816-A

Abstract

The invention provides a network congestion measurement method, a network card and a storage medium, and relates to the technical field of communication. The method comprises the steps that after a preset periodic timer expires, a first network card sends a detection request message to a second network card with the highest priority, the second network card returns a detection response message with the highest priority after receiving the detection request message, when the first network card sends the detection request message, the first network card obtains the periodic sending byte number of a service message sent to the second network card based on a communication channel to be detected in the last period time of the periodic timer, obtains the periodic receiving byte number from the detection response message after receiving the detection response message, and determines the congestion degree of the communication channel to be detected according to the periodic sending byte number and the periodic receiving byte number, so that the whole congestion degree of the network end-to-end is fed back more accurately and timely.

Inventors

  • LU ZUYOU
  • LUO XIANGZHENG
  • LI JIANGUO

Assignees

  • 迈普通信技术股份有限公司

Dates

Publication Date
20260508
Application Date
20241104

Claims (10)

  1. 1. A network congestion measurement method, applied to a first network card, where at least one communication channel exists between the first network card and a second network card, the method comprising: After a preset periodic timer expires, sending a detection request message to the second network card with the highest priority, so that the second network card returns a detection response message with the highest priority after receiving the detection request message, wherein the detection response message carries the number of periodically received bytes of the second network card for receiving the service message from the first network card based on a communication channel to be detected in the last period time of the periodic timer; when the detection request message is sent, acquiring the number of bytes sent in the latest period time of the periodic timer based on the service message sent to the second network card by the communication channel to be detected, and acquiring the number of bytes received in the period after the detection response message is received; and determining the congestion degree of the communication channel to be detected according to the number of the periodic sending bytes and the number of the periodic receiving bytes.
  2. 2. The network congestion measurement method of claim 1, wherein said step of determining the congestion level of said communication channel to be detected based on said number of periodically transmitted bytes and said number of periodically received bytes comprises: calculating the difference between the number of the periodically transmitted bytes and the number of the periodically received bytes as the number of the on-network bytes of the communication channel to be detected in the last period time of the periodic timer; and determining the congestion degree of the communication channel to be detected according to the number of the on-line message bytes of the communication channel to be detected.
  3. 3. The network congestion measurement method of claim 1, wherein a counter is disposed on the first network card on the channel to be detected, and the counter counts in real time a first cumulative total number of bytes sent by the first network card based on the traffic message to be detected sent by the communication channel to the second network card, and a channel record table is disposed on the first network card, and is used for recording a second cumulative total number of bytes sent by the first network card based on the traffic message to be detected when the traffic message to be detected is sent by the first network card to the second network card up to the last time; The step of obtaining the number of bytes sent in the last period time of the periodic timer based on the period of the service message sent to the second network card by the communication channel to be detected includes: acquiring the total number of the first accumulated transmitted bytes from the counter when the detection request message is transmitted currently; Acquiring the second accumulated total number of transmitted bytes from the channel record table; And calculating a difference value between the total number of the first accumulated transmitted bytes and the total number of the second accumulated transmitted bytes, recording the difference value as the number of the periodic transmitted bytes into the channel record table, and updating the total number of the second accumulated transmitted bytes in the channel record table by using the total number of the first accumulated transmitted bytes.
  4. 4. A network congestion measurement method, applied to a second network card, where at least one communication channel exists between the second network card and the first network card, the method further includes: receiving a detection request message sent by the first network card at the highest priority after a preset periodic timer expires, and acquiring the number of periodically received bytes of a service message received from the first network card based on the communication channel to be detected in the last period time of the periodic timer when the detection request message is received; Writing the number of the periodically received bytes into a detection response message, and sending the detection response message to the first network card with the highest priority, so that the first network card determines the congestion degree of the communication channel to be detected according to the number of the periodically received bytes and the number of the periodically sent bytes of the service message sent to the second network card by the first network card in the last period time of the periodic timer based on the communication channel to be detected.
  5. 5. The network congestion measurement method of claim 4, wherein a counter is disposed on the channel to be detected on the second network card, and the counter counts in real time a first accumulated total number of received bytes of the service packet received by the second network card from the first network card based on the communication channel to be detected, and a channel record table is disposed on the second network card, and is used for recording a second accumulated total number of received bytes of the service packet received by the second network card from the first network card by the last time the detection request packet is received; the step of obtaining the number of periodically received bytes of the service message received from the first network card based on the to-be-detected communication channel in the last period time of the periodic timer includes: Acquiring the total number of the first accumulated received bytes from the counter until the detection request message is currently received; acquiring the second accumulated received byte total from the channel record table; And calculating a difference between the first accumulated received byte total and the second accumulated received byte total as the period received byte number, and updating the second accumulated received byte total in the channel record table by using the first accumulated received byte total.
  6. 6. The method of claim 4, wherein a counter is disposed on the to-be-detected channel on the second network card, the counter counts in real time a first accumulated total number of received bytes of the service message received by the second network card from the first network card based on the to-be-detected communication channel, a channel record table is disposed on the second network card, the channel record table is used for recording a second accumulated total number of received bytes of the service message received by the second network card from the first network card based on the to-be-detected communication channel by the last time the detection request message is received, a channel queue is disposed on the second network card, and the channel queue buffers the service message received by the second network card from the first network card based on the to-be-detected communication channel and to be processed; the step of obtaining the number of periodically received bytes of the service message received from the first network card based on the to-be-detected communication channel in the last period time of the periodic timer includes: Acquiring the total number of the first accumulated received bytes from the counter until the detection request message is currently received; acquiring the second accumulated received byte total from the channel record table; Acquiring the use depth of the channel queue; and calculating a difference value between the first total number of the accumulated received bytes and the second total number of the accumulated received bytes and the use depth of the channel queue as the period received byte number, and updating the second total number of the accumulated received bytes in the channel record table by using the first total number of the accumulated received bytes.
  7. 7. A network congestion measurement device, applied to a first network card, where at least one communication channel exists between the first network card and a second network card, the device comprising: the first detection message receiving and transmitting module is used for sending a detection request message to the second network card with the highest priority after a preset periodic timer expires, so that the second network card returns a detection response message with the highest priority after receiving the detection request message, wherein the detection response message carries the number of periodically received bytes of the second network card for receiving service messages from the first network card based on a communication channel to be detected in the last period time of the periodic timer; And the congestion statistics and assessment module is used for acquiring the number of periodically transmitted bytes of the service message which is transmitted to the second network card by the communication channel to be detected in the last period time of the periodic timer when the detection request message is transmitted, acquiring the number of periodically received bytes after the detection response message is received, and determining the congestion degree of the communication channel to be detected according to the number of periodically transmitted bytes and the number of periodically received bytes.
  8. 8. A network congestion measurement device, applied to a second network card, where at least one communication channel exists between the second network card and the first network card, the device further comprising: The second detection message receiving and transmitting module is used for receiving a detection request message sent by the first network card at the highest priority after a preset periodic timer expires; The processing module is used for acquiring the number of the periodical received bytes of the service message received from the first network card based on the communication channel to be detected in the last periodical time of the periodical timer when the second detection message receiving and transmitting module receives the detection request message; The second detection message transceiver module is further configured to send the detection response message to the first network card with a highest priority, so that the first network card determines, according to the number of bytes received in the period and the number of bytes sent in the period of the service message sent to the second network card by the first network card by the communication channel to be detected in the last period time of the periodic timer, the congestion degree of the communication channel to be detected.
  9. 9. A network card having integrated thereon machine executable instructions which when executed implement the network congestion measurement method of claims 1-3 and/or any of claims 4-6.
  10. 10. A computer readable storage medium having stored thereon a computer program, which when executed by a processor, implements the network congestion measurement method according to any of claims 1-3 and/or claims 4-6.

Description

Network congestion measurement method, device, network card and storage medium Technical Field The present invention relates to the field of communications technologies, and in particular, to a method and apparatus for measuring network congestion, a network card, and a storage medium. Background Network congestion refers to a phenomenon that a message in a network is lost or transmission delay is increased due to link congestion. Whether a packet is lost or delayed depends on the specific settings of the router, switch, etc. on the network link. Typically, when the network traffic is excessive, the messages are temporarily buffered in routers or switches, and if the device processing power is exceeded, the messages are discarded. For the network of the intelligent computation center, network congestion or packet loss is almost intolerable, the communication efficiency of the network can be seriously reduced, the training efficiency of an artificial intelligent large model in the intelligent computation center is further affected, the use efficiency of a large number of expensive computing acceleration cards of the intelligent computation center is seriously reduced, and the network becomes a bottleneck for improving the efficiency of the intelligent computation center. There are two methods for determining whether a network is congested currently in the industry, namely, a method for determining whether the network is congested based on a model estimation of delay, that is, a timestamp is attached when a message is sent, and a timestamp is returned after a receiving end receives the message, so that a transmitting end can calculate the delay from sending to receiving, and if the delay exceeds a certain threshold, the network can be determined to be in a congested state. Another method is based on a packet loss model, if the transmitted data packet is lost, the receiving end only receives a part of the data packet, and then informs the transmitting end, for example, if '10 data packets transmitted by you are received only 5, no. 1, 4, 7, 8 and 9 are received', the network is very likely to be congested. The delay-based model estimation only reflects congestion conditions of switching and routing devices in the network, and cannot feed back congestion conditions of communication endpoints, and visualization of network congestion is not the most intuitive. The packet loss based model is a metric comparison of congestion, and the discovery that packet loss occurs indicates that congestion is already very severe, which is unacceptable in intelligent computing networks. Therefore, it is important to feed back the congestion condition from the end to the end of the network as soon as possible, and avoid the congestion from deteriorating or even losing packets. Disclosure of Invention Accordingly, the present invention is directed to a method, apparatus, network card and storage medium for measuring network congestion. In order to achieve the above object, the technical scheme adopted by the embodiment of the invention is as follows: in a first aspect, the present invention provides a network congestion measurement method, applied to a first network card, where at least one communication channel exists between the first network card and a second network card, the method includes: After a preset periodic timer expires, sending a detection request message to the second network card with the highest priority, so that the second network card returns a detection response message with the highest priority after receiving the detection request message, wherein the detection response message carries the number of periodically received bytes of the second network card for receiving the service message from the first network card based on a communication channel to be detected in the last period time of the periodic timer; when the detection request message is sent, acquiring the number of bytes sent in the latest period time of the periodic timer based on the service message sent to the second network card by the communication channel to be detected, and acquiring the number of bytes received in the period after the detection response message is received; and determining the congestion degree of the communication channel to be detected according to the number of the periodic sending bytes and the number of the periodic receiving bytes. Optionally, the step of determining the congestion degree of the to-be-detected communication channel according to the number of bytes sent by the network card period and the number of bytes received by the opposite network card period includes: Calculating the difference value between the number of the periodically transmitted bytes and the number of the periodically received bytes of the network card and the number of the periodically received bytes of the opposite network card, and taking the difference value as the number of the on-line bytes of the communication channel to be detected i