WO2018113436A1 - Method and device for network congestion processing - Google Patents

Method and device for network congestion processing Download PDF

Info

Publication number
WO2018113436A1
WO2018113436A1 PCT/CN2017/110063 CN2017110063W WO2018113436A1 WO 2018113436 A1 WO2018113436 A1 WO 2018113436A1 CN 2017110063 W CN2017110063 W CN 2017110063W WO 2018113436 A1 WO2018113436 A1 WO 2018113436A1
Authority
WO
WIPO (PCT)
Prior art keywords
packet loss
packet
current
data packet
determining
Prior art date
Application number
PCT/CN2017/110063
Other languages
French (fr)
Chinese (zh)
Inventor
彭信木
Original Assignee
深圳创维数字技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳创维数字技术有限公司 filed Critical 深圳创维数字技术有限公司
Publication of WO2018113436A1 publication Critical patent/WO2018113436A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/11Identifying congestion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/23Bit dropping

Definitions

  • the present disclosure relates to computer network technologies, for example, to a network congestion processing method and apparatus.
  • the usage of the central processing unit (CPU) of the frequent network soft interruption may reach 100%. Because the level of the soft interrupt is higher than that of the normal application process, the router is locally localized. The service is not implemented.
  • CPU central processing unit
  • the Ethernet driver supports the NAPI (New Application Program Interface) scheduling method. This method cannot selectively drop packets when the network is congested, resulting in loss of key service data packets. At the same time, when the network data volume is moderate, frequent switching between soft interrupt and polling scheduling modes occurs, which affects system performance.
  • QOS Quality of Service
  • the TC flow control method itself consumes a large amount of CPU, and when the CPU is tight, the queue operation is inaccurate, and the control of the data stream is lost. When the total bandwidth cannot be suppressed, the CPU load is aggravated.
  • the embodiment of the invention provides a network congestion processing method and device, so as to implement dynamically adjustable selective packet loss and ensure normal operation of the system.
  • a network congestion processing method includes:
  • determining a current packet loss rate according to the current CPU usage including:
  • determining a current packet loss weight according to the current CPU usage including:
  • the current CPU usage is less than the second threshold, further determining whether the current packet loss value is zero. If it is zero, determining that the current packet loss weight is unchanged, if not, then Determining that the current packet loss weight is decreased by one;
  • the new CPU usage is cyclically acquired after the preset time interval.
  • determining the number of data packets that meet the packet loss condition according to the preset data packet selection criteria including:
  • the packet information includes a protocol type of the data packet, a data packet length, a source port, and a destination port;
  • the data packet length of the data packet is less than or equal to the preset length, determining that the data packet does not meet the packet loss condition, and if the data packet length of the data packet is greater than the preset length, determining that the data packet is satisfied.
  • the number of packets for the packet condition is increased by one.
  • the method before detecting whether the protocol type of the data packet is a preset protocol type, the method includes:
  • Detecting whether the data packet includes a preset protocol type flag if yes, determining that the data packet does not satisfy the packet loss condition, and if not, detecting whether the protocol type of the data packet is a preset protocol Type of discussion.
  • the method further includes:
  • Detecting whether the source port and/or the destination port of the data packet is a pre-release port If the port is pre-released, it is determined that the data packet does not meet the packet loss condition. If the port is not pre-released, the data is determined. The packet satisfies the packet loss condition.
  • performing selective packet loss according to the current packet loss rate and the number of data packets that meet the packet loss condition including:
  • the data packet with the number of lost packets is randomly selected in the data packet satisfying the packet loss condition for packet loss processing.
  • a network congestion processing device includes:
  • the packet loss processing judging module is configured to obtain the CPU usage of the current CPU of the soft interrupt, and determine whether to perform packet loss processing according to the current CPU usage rate;
  • the packet loss rate determining module is configured to determine a current packet loss rate according to the current CPU usage rate when determining that the packet loss processing is performed;
  • a data packet quantity determining module configured to determine, according to a preset data packet selection criterion, a number of data packets that meet the packet loss condition
  • the packet loss control module is configured to perform selective packet loss according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
  • the packet loss rate determining module includes:
  • the packet loss weight determining unit is configured to determine a current packet loss weight according to the current CPU usage ratio
  • the packet loss rate determining unit is configured to determine the current packet loss rate according to the current packet loss weight value.
  • the packet loss weight determining unit includes:
  • a first threshold determining subunit configured to determine whether the current CPU usage ratio is greater than a first threshold
  • a first packet loss weight determining subunit configured to determine that the current packet loss weight is increased by 1 if the current CPU usage is greater than the first threshold
  • a second threshold determining subunit configured to determine whether the CPU usage is less than a second threshold if the current CPU usage is less than or equal to the first threshold
  • the second packet loss determining unit is configured to determine whether the current packet loss value is zero if the current CPU usage is less than the second threshold, and if the current value is zero, determine the current lost The weight of the packet is unchanged, if not zero, it is determined that the current packet loss value is decreased by 1;
  • the CPU usage cycle acquires the sub-unit, and if the current CPU usage is greater than or equal to the second threshold, the CPU usage is cyclically acquired after the preset time interval.
  • the data packet quantity determining module includes:
  • a packet information obtaining unit configured to acquire data packet information, where the data packet information includes a protocol type, a data packet length, a source port, and a destination port of the data packet;
  • a protocol type determining unit configured to detect whether the protocol type of the data packet is a preset protocol type, and if it is not a preset protocol type, determining that the data packet does not satisfy a packet loss condition
  • a packet length determining unit configured to: if the protocol type of the data packet is a preset protocol type, perform a preset protocol type marking on the data packet, and detect whether the data packet length of the data packet is greater than a preset length;
  • a packet quantity determining unit configured to determine that the data packet does not satisfy the packet loss condition if the data packet length of the data packet is less than or equal to the preset length, if the data packet length of the data packet is greater than the The preset length determines the number of packets that meet the packet loss condition plus one.
  • the data packet quantity determining module includes:
  • a flag detecting unit before detecting whether the protocol type of the data packet is a preset protocol type, detecting whether the data packet includes a preset protocol type flag, and if yes, determining that the data packet does not satisfy a packet loss condition, if If not, it is detected whether the protocol type of the data packet is a preset protocol type.
  • the data packet quantity determining module further includes:
  • the port detecting unit is configured to: after determining the number of data packets satisfying the packet loss condition, detecting whether the source port and/or the destination port of the data packet is a pre-release port, and if the port is pre-released, determining the data packet If the packet loss condition is not met, if the port is not pre-released, it is determined that the data packet satisfies the packet loss condition.
  • the packet loss control module includes:
  • a packet loss determining unit configured to set the number of packets according to the current packet loss rate and the packet loss condition Determine the number of lost packets based on the number of packages;
  • the packet loss control unit is configured to randomly select the packet with the number of lost packets in a data packet satisfying the packet loss condition to perform packet loss processing.
  • Embodiments of the present invention provide a storage medium including a computer readable storage medium having computer executable instructions stored thereon, the computer executable instructions being executed by a computer processor to implement the network congestion processing method described above.
  • the embodiment of the present invention solves the problem that the selective packet loss processing or the selective packet loss processing increases the CPU load when the network is congested by the soft interrupt in the prior art, and the dynamically adjustable selective packet loss is implemented to ensure the normal operation of the system. run.
  • FIG. 1 is a flowchart of a network congestion processing method according to an embodiment
  • FIG. 2 is a flowchart of a network congestion processing method according to an embodiment
  • FIG. 3 is a flowchart of a network congestion processing method according to an embodiment
  • FIG. 4 is a flowchart of a network congestion processing method according to another embodiment
  • FIG. 5 is a schematic structural diagram of a network congestion processing apparatus according to an embodiment.
  • FIG. 1 is a flowchart of a network congestion processing method according to an embodiment.
  • This embodiment may be configured to have a large number of data flows in a router, and a soft terminal occupies a large number of CPUs to cause network congestion.
  • the method may be configured by the network congestion provided by this embodiment.
  • the processing device is implemented, and the device can be implemented in software and/or hardware, including:
  • step 110 the CPU usage of the current CPU of the soft interrupt is obtained, and whether the packet loss processing is performed is determined according to the current CPU usage. If the packet loss processing is performed, step 120 is performed. If the packet loss processing is not performed, step 110 is executed after the preset time.
  • the interrupt refers to the situation that the system has to be processed by the CPU immediately during the running of the program.
  • the CPU pauses the process of terminating the executing program and then processing the new situation.
  • the interrupt includes soft interrupt and hard interrupt.
  • the hard interrupt is generated by hardware, such as a disk, a network card, or a clock.
  • the soft interrupt is generated by a currently running process.
  • CPU usage refers to the number of running programs The CPU resources used, the higher the CPU usage, indicates that many programs are currently running. When the CPU usage reaches 100%, it affects the normal operation of the basic functions of the intelligent terminal.
  • the CPU usage of the frequent network soft interrupt may reach 100%, which affects the normal operation of the basic functions of the intelligent terminal, and is solved by selective packet loss.
  • the CPU usage of the current soft interrupt is detected. If the CPU usage of the current soft interrupt is greater than or equal to 91%, the packet loss processing is determined. If the CPU usage of the current soft interrupt is less than 91%, the determination is not performed. Packet loss processing.
  • step 120 the current packet loss rate is determined according to the current CPU usage.
  • the packet loss rate refers to the ratio of the number of dropped packets to the number of transmitted packets.
  • the packet loss rate may be 10%, that is, one data packet is discarded in every 10 data packets currently sent.
  • the current packet loss rate is determined according to the current CPU usage rate, and the packet loss rate can be dynamically adjusted.
  • the packet loss rate is increased, and the CPU resource release efficiency is improved.
  • the packet loss is reduced. Rate to avoid large packet loss.
  • step 130 the number of data packets satisfying the packet loss condition is determined according to a preset data packet selection criterion.
  • the preset data packet selection criterion refers to a packet selection condition of a selective packet loss preset in the system.
  • the discarded data packet does not include an interactive small data packet.
  • commonly used data packets such as HTTPS, HTTP or DNS.
  • the data packet satisfying the packet loss condition is selected in the buffer data packet in the buffer area of the Ethernet receiving and transmitting data packet.
  • step 140 selective packet loss is performed according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
  • the data packet that meets the packet loss condition is determined according to the current packet loss rate and the number of data packets satisfying the packet loss condition, and the packet loss processing is performed.
  • the data packet in the buffer area is selectively packetized, and the packet loss processing is performed to introduce a new CPU load.
  • the selective packet loss is performed according to the current packet loss rate that can be dynamically adjusted and the number of data packets that meet the packet loss condition, which solves the problem that the network packet is not properly lost when the soft interruption causes the network congestion in the prior art.
  • Packet processing increases the CPU load and implements dynamically adjustable selective loss. Package to ensure the normal operation of the system.
  • step 140 may also be:
  • the number of lost packets is determined according to the current packet loss rate and the number of data packets satisfying the packet loss condition;
  • the data packet with the number of lost packets is randomly selected in the data packet satisfying the packet loss condition for packet loss processing.
  • the current packet loss rate may be 10%
  • the number of data packets satisfying the packet loss condition may be 50
  • the number of lost packets may be determined to be 5
  • the current packet loss rate is determined according to the current CPU usage ratio
  • the current packet loss weight is determined according to the current CPU usage.
  • the current packet loss rate is determined according to the current packet loss weight.
  • step 210 the CPU usage of the current CPU of the soft interrupt is obtained, and whether the packet loss processing is performed is determined according to the current CPU usage. If the packet loss processing is performed, step 220 is performed. If the packet loss processing is not performed, step 210 is executed after the preset time.
  • step 220 the current packet loss weight is determined according to the current CPU usage.
  • the packet loss weight refers to an identifier used to indicate the current CPU usage.
  • the current packet loss weight may be 0, 1, or 2.
  • step 230 the current packet loss rate is determined according to the current packet loss weight.
  • the system determines the current packet loss weight
  • an instruction for generating a preset packet loss rate is generated, and the selective packet loss processing is performed according to the instruction.
  • the preset packet loss rate may be 10%.
  • the current packet loss weight is 1, determining that the current packet loss rate is 10%, and if the current packet loss weight is 2, determining that the current packet loss rate is 20%.
  • step 240 the number of data packets satisfying the packet loss condition is determined according to a preset data packet selection criterion.
  • step 250 selective packet loss is performed according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
  • the selective packet loss is performed according to the current packet loss rate that can be dynamically adjusted and the number of data packets that meet the packet loss condition, which solves the problem that the network packet is not properly lost when the soft interruption causes the network congestion in the prior art.
  • Packet processing increases the CPU load and implements dynamically adjustable selective loss. Package to ensure the normal operation of the system.
  • FIG. 3 is a network congestion processing method according to an embodiment.
  • a method for determining a current packet loss weight according to a current CPU usage ratio including:
  • step 310 the CPU usage of the current CPU of the soft interrupt is obtained, and whether the packet loss processing is performed is determined according to the current CPU usage. If the packet loss processing is performed, step 320 is performed. If the packet loss processing is not performed, step 310 is executed after the preset time.
  • step 320 it is determined whether the current CPU usage is greater than a first threshold. If the current CPU usage is greater than the first threshold, it is determined that the current packet loss value is incremented by one, and step 350 is performed. If the current CPU usage is less than or equal to the first threshold, step 330 is performed.
  • the first threshold may be 90%.
  • step 330 it is determined whether the CPU occupancy is less than a second threshold. If the current CPU usage is less than the second threshold, step 340 is performed. If the current CPU usage is greater than or equal to the second threshold, return to step 310 after the preset time interval.
  • the second threshold may be 68% and the preset time interval may be 3 minutes.
  • step 340 it is determined whether the current packet loss weight is zero. If it is zero, it is determined that the current packet loss weight is unchanged. If it is not zero, it is determined that the current packet loss weight is decremented by 1, and step 350 is performed.
  • the current CPU usage is obtained. If the current CPU usage is greater than the first threshold (for example, 90%), for example, the current CPU usage may be 92%, and the current packet loss weight is determined to be 1; The rate is less than the second threshold (for example, it may be 68%). For example, the current CPU usage may be 50%. Since the current packet loss weight is a positive integer greater than or equal to 0, if the current packet loss weight is zero, the current loss is determined. The weight of the packet is unchanged. If the current packet loss is greater than zero, the current packet loss is decremented by 1. If the current CPU usage is less than or equal to the first threshold and greater than or equal to the second threshold, for example. The current CPU usage can be 78%, and the current packet loss weight remains unchanged.
  • the first threshold for example, 90%
  • the current CPU usage may be 92%
  • the current packet loss weight is determined to be 1
  • the rate for example, it may be 68%.
  • the current CPU usage may be 50%. Since the current packet loss weight is a positive integer greater than or equal to 0,
  • step 350 the current packet loss rate is determined according to the current packet loss weight.
  • the current packet loss weight increases, the current current packet loss rate increases. If the current packet loss weight decreases, the corresponding current packet loss rate decreases, and the dynamic adjustment of the packet loss rate is implemented to avoid A fixed-size packet loss rate cannot quickly reduce the CPU usage of a soft interrupt when the network is heavily congested, or discard a large number of data packets when the CPU usage is not high, causing the system to retransmit the data packet.
  • the CPU usage at different times is obtained according to the preset time interval, and the packet loss weight and the packet loss rate at different times are determined, and the dynamic adjustment of the packet loss rate is implemented.
  • step 360 the number of data packets satisfying the packet loss condition is determined according to a preset data packet selection criterion.
  • step 370 selective packet loss is performed according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
  • the current CPU usage ratio is compared with a preset threshold, and the current packet loss weight and packet loss rate are determined according to the comparison result.
  • the CPU usage rate at different times is obtained at a preset time interval, and the packet loss rate is dynamically implemented. Adjustment.
  • FIG. 4 is a flowchart of a network congestion processing method according to another embodiment.
  • a method for determining a number of data packets that meets a packet loss condition including:
  • step 410 the CPU usage of the current CPU of the soft interrupt is obtained, and whether the packet loss processing is performed is determined according to the current CPU usage. If the packet loss processing is performed, step 420 is performed. If the packet loss processing is not performed, step 410 is executed after the preset time.
  • step 420 the current packet loss rate is determined according to the current CPU usage.
  • the packet information is obtained, wherein the packet information includes a protocol type of the data packet, a packet length, a source port, and a destination port.
  • the protocol type of the data packet refers to a four-layer protocol type, including an application process, a transport layer, a network interconnection layer, and a host to a network layer; a packet length refers to the number of bytes included in the data packet; the source port refers to It is the local terminal packet sending port, and the destination port refers to the packet receiving port of the destination terminal.
  • the packet information can be obtained by an unpacking method.
  • the unpacking process the second-layer packet type of the data packet is first obtained, and the unpacking mode is determined according to the second-layer packet type.
  • the data packet is a Point-to-Point Protocol over Ethernet (PPPOE) type packet on the Ethernet
  • PPOE Point-to-Point Protocol over Ethernet
  • the packet header of the data packet needs to be stripped first.
  • the related pointer moves down 8 bytes to obtain packet information such as the protocol type, destination port, and source port of the data packet. After obtaining the information, the data packet needs to be restored in time.
  • the data packet is an IP (Internet Protocol) protocol type packet, after stripping the packet header, The related pointer can directly acquire the packet information without shifting.
  • IP Internet Protocol
  • step 440 it is detected whether the protocol type of the data packet is a preset protocol type. If the packet If the protocol type is not the default protocol type, it is determined that the data packet does not meet the packet loss condition. If the protocol type of the data packet is the preset protocol type, step 460 is performed.
  • the default protocol type may be a UDP (User Datagram Protocol) and a TCP (Transmission Control Protocol) of the transport layer. If the protocol type of the data packet does not belong to UDP or TCP, It is determined that the data packet does not satisfy the packet loss condition and is not a data packet within the packet loss scope.
  • UDP User Datagram Protocol
  • TCP Transmission Control Protocol
  • the packet loss process only discards the data packets of the preset protocol type (UDP and TCP), and ensures that the basic services of the terminal are not affected.
  • step 450 the data packet is subjected to a preset protocol type flag, and it is detected whether the data packet length of the data packet is greater than a preset length. If the data packet length of the data packet is less than or equal to the preset length, it is determined that the data packet does not meet the packet loss condition. If the data packet length of the data packet is greater than the preset length, step 470 is performed.
  • the preset length may be 256 bytes, and the data packet length is less than or equal to 256 bytes, determining that the data packet does not satisfy the packet loss condition, and is not in the packet loss range; if the data packet length is greater than 256 bytes Then, it is determined that the data packet satisfies the packet loss condition and belongs to the data packet within the packet loss range.
  • the data packet that meets the packet loss condition may be a BT (Bit Torrent) download data packet.
  • the data packet whose packet length is longer than the preset length is selected for discarding, which can speed up the adjustment efficiency of the CPU usage.
  • step 460 it is determined that the number of packets satisfying the packet loss condition is increased by one. At the same time, returning to step 430, the next packet information is obtained.
  • the number of data packets satisfying the packet loss condition is increased by one.
  • the number of data packets satisfying the packet loss condition is determined to be unchanged.
  • step 470 selective packet loss is performed according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
  • the packet is selected according to the protocol type and the packet length of the data packet, and the data packet is selected in the discardable data packet according to the current packet loss rate and the number of data packets satisfying the packet loss condition, and the packet loss processing is performed. That is, when the network is guaranteed to operate normally, packet loss processing is performed, and selective packet loss is implemented.
  • the method may further include:
  • step 450 Check if the packet contains a preset protocol type tag. If yes, it is determined that the data packet does not satisfy the packet loss condition. If not, step 450 is performed.
  • the data packet when it is detected that the protocol type of the data packet belongs to the preset protocol type, the data packet is marked with a preset protocol type, indicating that the data packet is detected. Since the discarded data packet is randomly determined according to the packet loss rate, there is a data packet that is marked but not discarded, and the software interrupt processing function may make multiple calls to the same data packet. To avoid repeated detection of the same data packet, Before performing the preset packet selection standard detection on the data packet, it is detected whether the data packet contains the preset protocol type flag. If it exists, the data packet is not detected, the detection times are reduced, and the processing efficiency is improved.
  • the method may further include:
  • the pre-release port may be, for example, 80 ports, 443 ports, 53 ports, or 22 ports, etc.
  • the hash table is established according to the pre-release port, if the source port or the destination port of the data packet belongs to a hash.
  • a pre-release port in the table determines that the data packet does not meet the packet loss condition. If the source port and the destination port of the data packet do not belong to the pre-release port in the hash table, it is determined that the data packet satisfies the packet loss condition.
  • the data packet that the source port and/or the destination port belongs to the pre-release port is determined as a data packet that does not satisfy the packet loss condition, and the data packet loss is reduced.
  • FIG. 5 is a network congestion processing apparatus according to another embodiment 5, where the apparatus is configured to perform the network congestion processing method provided by the embodiment of the present invention, including:
  • the packet loss processing judging module 510 is configured to obtain the CPU usage of the current CPU of the soft interrupt, and determine whether to perform packet loss processing according to the current CPU usage rate;
  • the packet loss rate determining module 520 is configured to determine a current packet loss rate according to the current CPU usage rate when determining that the packet loss processing is performed;
  • the packet quantity determining module 530 is configured to determine, according to the preset data packet selection criterion, the number of data packets that meet the packet loss condition;
  • the packet loss control module 540 is configured to enter according to the current packet loss rate and the number of data packets satisfying the packet loss condition. Row selective packet loss.
  • the packet loss rate determining module 520 includes:
  • the packet loss weight determining unit 521 is configured to determine a current packet loss weight according to the current CPU usage rate
  • the packet loss rate determining unit 522 is configured to determine a current packet loss rate according to the current packet loss weight.
  • the packet loss weight determining unit 521 includes:
  • the first threshold determining subunit 5211 is configured to determine whether the current CPU usage ratio is greater than a first threshold
  • the first packet loss weight determining sub-unit 5212 is configured to determine that the current packet loss weight is increased by 1 if the current CPU usage is greater than the first threshold;
  • the second threshold determining sub-unit 5213 is configured to determine whether the CPU usage ratio is less than a second threshold if the current CPU usage is less than or equal to the first threshold;
  • the second packet loss determining unit 5214 is configured to determine whether the current packet loss value is zero if the current CPU usage is less than the second threshold, and if the value is zero, determine that the current packet loss value does not change. If it is not zero, it determines that the current packet loss weight is reduced by 1;
  • the CPU usage cycle acquisition sub-unit 5215 is configured to cycle to acquire a new CPU usage rate after the preset time interval if the current CPU usage is greater than or equal to the second threshold.
  • the data packet quantity determining module 530 includes:
  • the packet information obtaining unit 531 is configured to acquire data packet information, where the data packet information includes a protocol type of the data packet, a data packet length, a source port, and a destination port;
  • the protocol type determining unit 532 is configured to detect whether the protocol type of the data packet is a preset protocol type, and if it is not the preset protocol type, determine that the data packet does not satisfy the packet loss condition;
  • the packet length determining unit 533 is configured to: if the protocol type of the data packet is a preset protocol type, perform a preset protocol type marking on the data packet, and detect whether the data packet length of the data packet is greater than a preset length;
  • the packet quantity determining unit 534 is configured to determine that the data packet does not satisfy the packet loss condition if the data packet length of the data packet is less than or equal to the preset length, and if the data packet length of the data packet is greater than the preset length, determine that the packet loss is satisfied.
  • the number of packets for the condition is increased by one.
  • the data packet quantity determining module 530 includes:
  • the flag detecting unit 535 checks before detecting whether the protocol type of the data packet is a preset protocol type. Whether the data packet contains a preset protocol type flag, if it is included, determines that the data packet does not satisfy the packet loss condition, and if not, detects whether the protocol type of the data packet is a preset protocol type.
  • the data packet quantity determining module 530 further includes:
  • the port detecting unit 536 is configured to detect whether the source port and/or the destination port of the data packet are pre-release ports after determining the number of data packets satisfying the packet loss condition, and if the port is pre-released, determine that the data packet is not satisfied.
  • the packet condition if it is not pre-released, determines that the packet satisfies the packet loss condition.
  • the packet loss control module 540 includes:
  • the packet loss determining unit 541 is configured to determine the number of lost packets according to the current packet loss rate and the number of data packets satisfying the packet loss condition;
  • the packet loss control unit 542 is configured to randomly select a packet of the number of lost packets in the data packet satisfying the packet loss condition to perform packet loss processing.
  • the network congestion processing apparatus may perform the network congestion processing method provided by any embodiment of the present invention, and has a function module and a beneficial effect corresponding to the execution method.
  • a computer readable storage medium storing computer executable instructions arranged to perform the network congestion processing method described above.
  • the present disclosure solves the problem that the selective packet loss processing or the selective packet loss processing increases the CPU load when the network is congested due to the soft interruption in the prior art, and the dynamically adjustable selective packet loss is realized to ensure the normal operation of the system.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

A method and a device for network congestion processing. The method comprises: acquiring the current central processing unit (CPU) occupancy when a soft interrupt occurs, and determining, according to the current CPU occupancy, whether to perform packet discard processing; when it is determined to perform packet discard processing, determining the current packet loss rate according to the current CPU occupancy; determining, according to preset packet selection criteria, the number of packets that satisfy a packet discard condition; and selectively discarding packets according to the current packet loss rate and the number of packets that satisfy the packet discard condition.

Description

一种网络拥塞处理方法及装置Network congestion processing method and device 技术领域Technical field
本公开涉及计算机网络技术,例如涉及一种网络拥塞处理方法及装置。The present disclosure relates to computer network technologies, for example, to a network congestion processing method and apparatus.
背景技术Background technique
随着网络大数据的不断发展,由于网络拥塞导致系统服务器卡死的情况时常出现。With the continuous development of network big data, the situation in which system servers are stuck due to network congestion often occurs.
当路由器中存在大量数据流时,频繁网络软中断的系统中央处理器(Central Processing Unit,CPU)的占用率可能会达到100%,由于软中断的级别比普通应用进程的级别高,导致路由器本地服务得不到执行。When there are a large number of data streams in the router, the usage of the central processing unit (CPU) of the frequent network soft interruption may reach 100%. Because the level of the soft interrupt is higher than that of the normal application process, the router is locally localized. The service is not implemented.
常用的解决方式:一、以太网驱动支持NAPI(New Application Program Interface)调度的方式。该方法在网络拥塞时不能选择性丢包,导致关键业务数据包丢失,同时,网络数据量适中时,会出现软中断与轮询两种调度方式的频繁切换,影响系统性能。二、应用服务质量(Quality of Service,QOS)限定接口带宽的方式。由于TC流量控制方式本身耗费大量CPU,且在当CPU紧张时会导致队列运算不准确,并失去对数据流的控制,当不能压制总带宽时,会加剧CPU的负载。三、缩小以太网接收和发送的缓存区的大小。但是该方式不能实现丢包率的动态调整,不能对数据包的选择性丢包。Commonly used solutions: First, the Ethernet driver supports the NAPI (New Application Program Interface) scheduling method. This method cannot selectively drop packets when the network is congested, resulting in loss of key service data packets. At the same time, when the network data volume is moderate, frequent switching between soft interrupt and polling scheduling modes occurs, which affects system performance. Second, the application of Quality of Service (QOS) to limit the interface bandwidth. Because the TC flow control method itself consumes a large amount of CPU, and when the CPU is tight, the queue operation is inaccurate, and the control of the data stream is lost. When the total bandwidth cannot be suppressed, the CPU load is aggravated. Third, reduce the size of the buffer area received and sent by Ethernet. However, this method cannot implement dynamic adjustment of the packet loss rate, and cannot selectively packetize packets.
发明内容Summary of the invention
本发明实施例提供一种网络拥塞处理方法及装置,以实现可动态调整的选择性丢包,保证系统的正常运行。The embodiment of the invention provides a network congestion processing method and device, so as to implement dynamically adjustable selective packet loss and ensure normal operation of the system.
一种网络拥塞处理方法,包括:A network congestion processing method includes:
获取软中断的当前中央处理器CPU占用率,根据所述当前CPU占用率判断是否进行丢包处理;Obtaining the CPU usage of the current CPU of the soft interrupt, and determining whether to perform packet loss processing according to the current CPU usage;
当确定进行丢包处理时,根据所述当前CPU占用率确定当前丢包率; When it is determined that the packet loss processing is performed, determining a current packet loss rate according to the current CPU usage rate;
根据预设数据包选择标准确定满足丢包条件的数据包数量;Determining the number of data packets satisfying the packet loss condition according to a preset data packet selection criterion;
根据所述当前丢包率和所述满足丢包条件的数据包数量进行选择性丢包。Selective packet loss according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
可选地,根据所述当前CPU占用率确定当前丢包率,包括:Optionally, determining a current packet loss rate according to the current CPU usage, including:
根据所述当前CPU占用率确定当前丢包权值;Determining a current packet loss weight according to the current CPU usage;
根据所述当前丢包权值确定所述当前丢包率。Determining the current packet loss rate according to the current packet loss weight.
可选地,根据所述当前CPU占用率确定当前丢包权值,包括:Optionally, determining a current packet loss weight according to the current CPU usage, including:
判断所述当前CPU占用率是否大于第一阈值;Determining whether the current CPU usage is greater than a first threshold;
若所述当前CPU占用率大于所述第一阈值,则确定所述当前丢包权值加1,若所述当前CPU占用率小于或等于所述第一阈值,则判断所述CPU占用率是否小于第二阈值;If the current CPU usage is greater than the first threshold, determining that the current packet loss value is increased by one, and if the current CPU usage is less than or equal to the first threshold, determining whether the CPU usage rate is Less than the second threshold;
若所述当前CPU占用率小于所述第二阈值,则进一步判断所述当前丢包权值是否为零,若为零,则确定所述当前丢包权值不变,若不为零,则确定所述当前丢包权值减1;If the current CPU usage is less than the second threshold, further determining whether the current packet loss value is zero. If it is zero, determining that the current packet loss weight is unchanged, if not, then Determining that the current packet loss weight is decreased by one;
若所述当前CPU占用率大于或等于所述第二阈值,则在预设时间间隔后循环获取新的CPU占用率。If the current CPU usage is greater than or equal to the second threshold, the new CPU usage is cyclically acquired after the preset time interval.
可选地,根据预设数据包选择标准确定满足丢包条件的数据包数量,包括:Optionally, determining the number of data packets that meet the packet loss condition according to the preset data packet selection criteria, including:
获取数据包信息,其中,所述数据包信息包括数据包的协议类型、数据包长度、源端口和目的端口;Obtaining packet information, where the packet information includes a protocol type of the data packet, a data packet length, a source port, and a destination port;
检测所述数据包的所述协议类型是否是预设协议类型,若不是预设协议类型,则确定所述数据包不满足丢包条件,若是预设协议类型,对数据包进行预设协议类型标记,并检测所述数据包的所述数据包长度是否大于预设长度;Determining whether the protocol type of the data packet is a preset protocol type, if it is not a preset protocol type, determining that the data packet does not satisfy a packet loss condition, and if it is a preset protocol type, performing a preset protocol type on the data packet Marking, and detecting whether the length of the data packet of the data packet is greater than a preset length;
若所述数据包的数据包长度小于或等于所述预设长度,则确定所述数据包不满足丢包条件,若所述数据包的数据包长度大于所述预设长度,则确定满足丢包条件的数据包数量加1。If the data packet length of the data packet is less than or equal to the preset length, determining that the data packet does not meet the packet loss condition, and if the data packet length of the data packet is greater than the preset length, determining that the data packet is satisfied The number of packets for the packet condition is increased by one.
可选地,在检测所述数据包的协议类型是否是预设协议类型之前,所述方法包括:Optionally, before detecting whether the protocol type of the data packet is a preset protocol type, the method includes:
检测所述数据包是否含有预设协议类型标记,若含有,则确定所述数据包不满足丢包条件,若不含有,则检测所述数据包的所述协议类型是否是预设协 议类型。Detecting whether the data packet includes a preset protocol type flag, if yes, determining that the data packet does not satisfy the packet loss condition, and if not, detecting whether the protocol type of the data packet is a preset protocol Type of discussion.
可选地,在确定满足丢包条件的数据包数量之后,所述方法还包括:Optionally, after determining the number of data packets that meet the packet loss condition, the method further includes:
检测所述数据包的源端口和/或目的端口是否是预放开端口,若是预放开端口,则确定所述数据包不满足丢包条件,若不是预放开端口,则确定所述数据包满足所述丢包条件。Detecting whether the source port and/or the destination port of the data packet is a pre-release port. If the port is pre-released, it is determined that the data packet does not meet the packet loss condition. If the port is not pre-released, the data is determined. The packet satisfies the packet loss condition.
可选地,根据所述当前丢包率和所述满足丢包条件的数据包数量进行选择性丢包,包括:Optionally, performing selective packet loss according to the current packet loss rate and the number of data packets that meet the packet loss condition, including:
根据所述当前丢包率和所述满足丢包条件的数据包数量确定丢包数量;Determining the number of lost packets according to the current packet loss rate and the number of data packets satisfying the packet loss condition;
在满足丢包条件的数据包中随机选择所述丢包数量的数据包进行丢包处理。The data packet with the number of lost packets is randomly selected in the data packet satisfying the packet loss condition for packet loss processing.
一种网络拥塞处理装置,包括:A network congestion processing device includes:
丢包处理判断模块,设置为获取软中断的当前中央处理器CPU占用率,根据所述当前CPU占用率判断是否进行丢包处理;The packet loss processing judging module is configured to obtain the CPU usage of the current CPU of the soft interrupt, and determine whether to perform packet loss processing according to the current CPU usage rate;
丢包率确定模块,设置为当确定进行丢包处理时,根据所述当前CPU占用率确定当前丢包率;The packet loss rate determining module is configured to determine a current packet loss rate according to the current CPU usage rate when determining that the packet loss processing is performed;
数据包数量确定模块,设置为根据预设数据包选择标准确定满足丢包条件的数据包数量;a data packet quantity determining module, configured to determine, according to a preset data packet selection criterion, a number of data packets that meet the packet loss condition;
丢包控制模块,设置为根据所述当前丢包率和所述满足丢包条件的数据包数量进行选择性丢包。The packet loss control module is configured to perform selective packet loss according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
可选地,所述丢包率确定模块包括:Optionally, the packet loss rate determining module includes:
丢包权值确定单元,设置为根据所述当前CPU占用率确定当前丢包权值;The packet loss weight determining unit is configured to determine a current packet loss weight according to the current CPU usage ratio;
丢包率确定单元,设置为根据所述当前丢包权值确定所述当前丢包率。The packet loss rate determining unit is configured to determine the current packet loss rate according to the current packet loss weight value.
可选地,所述丢包权值确定单元包括:Optionally, the packet loss weight determining unit includes:
第一阈值判断子单元,设置为判断所述当前CPU占用率是否大于第一阈值;a first threshold determining subunit, configured to determine whether the current CPU usage ratio is greater than a first threshold;
第一丢包权值确定子单元,设置为若所述当前CPU占用率大于所述第一阈值,则确定所述当前丢包权值加1;;a first packet loss weight determining subunit, configured to determine that the current packet loss weight is increased by 1 if the current CPU usage is greater than the first threshold;
第二阈值判断子单元,设置为若所述当前CPU占用率小于或等于所述第一阈值,则判断所述CPU占用率是否小于第二阈值; a second threshold determining subunit, configured to determine whether the CPU usage is less than a second threshold if the current CPU usage is less than or equal to the first threshold;
第二丢包权值确定子单元,设置为若所述当前CPU占用率小于所述第二阈值,则进一步判断所述当前丢包权值是否为零,若为零,则确定所述当前丢包权值不变,若不为零,则确定所述当前丢包权值减1;The second packet loss determining unit is configured to determine whether the current packet loss value is zero if the current CPU usage is less than the second threshold, and if the current value is zero, determine the current lost The weight of the packet is unchanged, if not zero, it is determined that the current packet loss value is decreased by 1;
CPU占用率循环获取子单元,设置为若所述当前CPU占用率大于或等于所述第二阈值,则在预设时间间隔后循环获取新的CPU占用率。The CPU usage cycle acquires the sub-unit, and if the current CPU usage is greater than or equal to the second threshold, the CPU usage is cyclically acquired after the preset time interval.
可选地,所述数据包数量确定模块包括:Optionally, the data packet quantity determining module includes:
数据包信息获取单元,设置为获取数据包信息,其中,所述数据包信息包括数据包的协议类型、数据包长度、源端口和目的端口;a packet information obtaining unit, configured to acquire data packet information, where the data packet information includes a protocol type, a data packet length, a source port, and a destination port of the data packet;
协议类型判断单元,设置为检测所述数据包的所述协议类型是否是预设协议类型,若不是预设协议类型,则确定所述数据包不满足丢包条件;a protocol type determining unit, configured to detect whether the protocol type of the data packet is a preset protocol type, and if it is not a preset protocol type, determining that the data packet does not satisfy a packet loss condition;
数据包长度判断单元,设置为若所述数据包的协议类型是预设协议类型,对数据包进行预设协议类型标记,并检测所述数据包的所述数据包长度是否大于预设长度;a packet length determining unit, configured to: if the protocol type of the data packet is a preset protocol type, perform a preset protocol type marking on the data packet, and detect whether the data packet length of the data packet is greater than a preset length;
数据包数量确定单元,设置为若所述数据包的数据包长度小于或等于所述预设长度,则确定所述数据包不满足丢包条件,若所述数据包的数据包长度大于所述预设长度,则确定满足丢包条件的数据包数量加1。a packet quantity determining unit, configured to determine that the data packet does not satisfy the packet loss condition if the data packet length of the data packet is less than or equal to the preset length, if the data packet length of the data packet is greater than the The preset length determines the number of packets that meet the packet loss condition plus one.
可选地,所述数据包数量确定模块包括:Optionally, the data packet quantity determining module includes:
标记检测单元,在检测所述数据包的协议类型是否是预设协议类型之前,检测所述数据包是否含有预设协议类型标记,若含有,则确定所述数据包不满足丢包条件,若不含有,则检测所述数据包的所述协议类型是否是预设协议类型。a flag detecting unit, before detecting whether the protocol type of the data packet is a preset protocol type, detecting whether the data packet includes a preset protocol type flag, and if yes, determining that the data packet does not satisfy a packet loss condition, if If not, it is detected whether the protocol type of the data packet is a preset protocol type.
可选地,所述数据包数量确定模块还包括:Optionally, the data packet quantity determining module further includes:
端口检测单元,设置为在确定满足丢包条件的数据包数量之后,检测所述数据包的源端口和/或目的端口是否是预放开端口,若是预放开端口,则确定所述数据包不满足丢包条件,若不是预放开端口,则确定所述数据包满足所述丢包条件。The port detecting unit is configured to: after determining the number of data packets satisfying the packet loss condition, detecting whether the source port and/or the destination port of the data packet is a pre-release port, and if the port is pre-released, determining the data packet If the packet loss condition is not met, if the port is not pre-released, it is determined that the data packet satisfies the packet loss condition.
可选地,所述丢包控制模块包括:Optionally, the packet loss control module includes:
丢包数量确定单元,设置为根据所述当前丢包率和所述满足丢包条件的数 据包数量确定丢包数量;a packet loss determining unit, configured to set the number of packets according to the current packet loss rate and the packet loss condition Determine the number of lost packets based on the number of packages;
丢包控制单元,设置为在满足丢包条件的数据包中随机选择所述丢包数量的数据包进行丢包处理。The packet loss control unit is configured to randomly select the packet with the number of lost packets in a data packet satisfying the packet loss condition to perform packet loss processing.
本发明实施例提供了一种包含计算机可读存储介质,其中存储有计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行,以实现上述的网络拥塞处理方法。本发明实施例解决了现有技术中软中断导致网络拥塞时,无法选择性丢包处理或者选择性丢包处理增大CPU负载的问题,实现了可动态调整的选择性丢包,保证系统的正常运行。Embodiments of the present invention provide a storage medium including a computer readable storage medium having computer executable instructions stored thereon, the computer executable instructions being executed by a computer processor to implement the network congestion processing method described above. The embodiment of the present invention solves the problem that the selective packet loss processing or the selective packet loss processing increases the CPU load when the network is congested by the soft interrupt in the prior art, and the dynamically adjustable selective packet loss is implemented to ensure the normal operation of the system. run.
附图说明DRAWINGS
图1是一实施例提供的网络拥塞处理方法的流程图;FIG. 1 is a flowchart of a network congestion processing method according to an embodiment;
图2是一实施例提供的网络拥塞处理方法的流程图;2 is a flowchart of a network congestion processing method according to an embodiment;
图3是一实施例提供的网络拥塞处理方法的流程图;3 is a flowchart of a network congestion processing method according to an embodiment;
图4是另一实施例提供的网络拥塞处理方法的流程图;4 is a flowchart of a network congestion processing method according to another embodiment;
图5是一实施例提供的网络拥塞处理装置的结构示意图。FIG. 5 is a schematic structural diagram of a network congestion processing apparatus according to an embodiment.
具体实施方式detailed description
图1为一实施例提供的网络拥塞处理方法的流程图,本实施例可适设置为路由器中存在大量数据流,软终端占用大量CPU导致网络拥塞情况,该方法可以由本实施例提供的网络拥塞处理装置来执行,该装置可采用软件和/或硬件的方式实现,包括:FIG. 1 is a flowchart of a network congestion processing method according to an embodiment. This embodiment may be configured to have a large number of data flows in a router, and a soft terminal occupies a large number of CPUs to cause network congestion. The method may be configured by the network congestion provided by this embodiment. The processing device is implemented, and the device can be implemented in software and/or hardware, including:
在步骤110中,获取软中断的当前中央处理器CPU占用率,根据当前CPU占用率判断是否进行丢包处理。若进行丢包处理,则执行步骤120,若不进行丢包处理,则在预设时间后循环执行步骤110。In step 110, the CPU usage of the current CPU of the soft interrupt is obtained, and whether the packet loss processing is performed is determined according to the current CPU usage. If the packet loss processing is performed, step 120 is performed. If the packet loss processing is not performed, step 110 is executed after the preset time.
其中,中断指的是在程序运行过程中,系统出现一个必须由CPU立即处理的情况,CPU暂停终止正在执行的程序转而处理新情况的过程,中断包括软中断与硬中断。其中,硬中断由硬件产生,例如可以是磁盘、网卡或者时钟等,软中断是由当前正在运行的进程产生的。CPU占用率指的是正在运行的程序占 用的CPU资源,CPU占用率越高说明当前运行了很多程序。当CPU占用率达到100%时,影响智能终端的基础功能的正常运行。Among them, the interrupt refers to the situation that the system has to be processed by the CPU immediately during the running of the program. The CPU pauses the process of terminating the executing program and then processing the new situation. The interrupt includes soft interrupt and hard interrupt. The hard interrupt is generated by hardware, such as a disk, a network card, or a clock. The soft interrupt is generated by a currently running process. CPU usage refers to the number of running programs The CPU resources used, the higher the CPU usage, indicates that many programs are currently running. When the CPU usage reaches 100%, it affects the normal operation of the basic functions of the intelligent terminal.
本实施例中,当路由器中存在大量数据流时,频繁的网络软中断的CPU占用率可能达到100%,影响智能终端的基础功能的正常运行,采用选择性丢包的方式解决。In this embodiment, when a large number of data flows exist in the router, the CPU usage of the frequent network soft interrupt may reach 100%, which affects the normal operation of the basic functions of the intelligent terminal, and is solved by selective packet loss.
可选地,检测当前软中断的CPU占用率,若当前软中断的CPU占用率大于或者等于91%,则确定进行丢包处理,若当前软中断的CPU占用率小于91%,则确定不进行丢包处理。Optionally, the CPU usage of the current soft interrupt is detected. If the CPU usage of the current soft interrupt is greater than or equal to 91%, the packet loss processing is determined. If the CPU usage of the current soft interrupt is less than 91%, the determination is not performed. Packet loss processing.
在步骤120中,根据当前CPU占用率确定当前丢包率。In step 120, the current packet loss rate is determined according to the current CPU usage.
其中,丢包率指的是丢弃数据包的数量与发送数据包数量的比值。可选地,丢包率可以是10%,即在当前发送的每10个数据包中丢弃1个数据包。The packet loss rate refers to the ratio of the number of dropped packets to the number of transmitted packets. Optionally, the packet loss rate may be 10%, that is, one data packet is discarded in every 10 data packets currently sent.
本实施例中,根据当前CPU占用率确定当前丢包率,丢包率可动态调整,在网络拥塞时增大丢包率,提高CPU资源释放效率,在数据量不大时,减小丢包率,避免大量数据包丢失。In this embodiment, the current packet loss rate is determined according to the current CPU usage rate, and the packet loss rate can be dynamically adjusted. When the network is congested, the packet loss rate is increased, and the CPU resource release efficiency is improved. When the amount of data is small, the packet loss is reduced. Rate to avoid large packet loss.
在步骤130中,根据预设数据包选择标准确定满足丢包条件的数据包数量。In step 130, the number of data packets satisfying the packet loss condition is determined according to a preset data packet selection criterion.
其中,预设数据包选择标准指的是系统中预设的选择性丢包的数据包选择条件,为了保证智能终端的基本功能,可选地,丢弃的数据包不包括交互性的小数据包,上网常用的数据包,例如HTTPS、HTTP或者DNS等。The preset data packet selection criterion refers to a packet selection condition of a selective packet loss preset in the system. To ensure the basic functions of the intelligent terminal, optionally, the discarded data packet does not include an interactive small data packet. , commonly used data packets, such as HTTPS, HTTP or DNS.
可选地,满足丢包条件的数据包在以太网接收和发送数据包的缓存区中缓存数据包中进行选择。Optionally, the data packet satisfying the packet loss condition is selected in the buffer data packet in the buffer area of the Ethernet receiving and transmitting data packet.
在步骤140中,根据当前丢包率和满足丢包条件的数据包数量进行选择性丢包。In step 140, selective packet loss is performed according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
本实施例中,在满足丢包条件的数据包中根据当前丢包率和满足丢包条件的数据包数量确定可丢弃的数据包,并进行丢包处理。其中,在不减小以太网接收和发送数据包的缓存区大小的情况下,对缓存区内的数据包进行选择性丢包处理,实现在进行丢包处理,为引进新的CPU负载。In this embodiment, the data packet that meets the packet loss condition is determined according to the current packet loss rate and the number of data packets satisfying the packet loss condition, and the packet loss processing is performed. In the case that the buffer size of the Ethernet receiving and transmitting data packets is not reduced, the data packet in the buffer area is selectively packetized, and the packet loss processing is performed to introduce a new CPU load.
本实施例通过根据可动态调节的当前丢包率和满足丢包条件的数据包数量进行选择性丢包,解决了现有技术中软中断导致网络拥塞时,无法选择性丢包处理或者选择性丢包处理增大CPU负载的问题,实现了可动态调整的选择性丢 包,保证系统的正常运行。In this embodiment, the selective packet loss is performed according to the current packet loss rate that can be dynamically adjusted and the number of data packets that meet the packet loss condition, which solves the problem that the network packet is not properly lost when the soft interruption causes the network congestion in the prior art. Packet processing increases the CPU load and implements dynamically adjustable selective loss. Package to ensure the normal operation of the system.
在上述实施例的基础上,步骤140还可以是:Based on the above embodiment, step 140 may also be:
根据当前丢包率和满足丢包条件的数据包数量确定丢包数量;The number of lost packets is determined according to the current packet loss rate and the number of data packets satisfying the packet loss condition;
在满足丢包条件的数据包中随机选择丢包数量的数据包进行丢包处理。The data packet with the number of lost packets is randomly selected in the data packet satisfying the packet loss condition for packet loss processing.
可选地,当前丢包率可以是10%,满足丢包条件的数据包数量可以是50,可确定丢包数量为5,在满足丢包条件的50个数据包中系统随机的选择5个数据包进行丢包处理。Optionally, the current packet loss rate may be 10%, the number of data packets satisfying the packet loss condition may be 50, the number of lost packets may be determined to be 5, and the system randomly selects 5 of the 50 data packets satisfying the packet loss condition. The packet is packetized.
图2是一实施例提供的网络拥塞处理方法的流程图,在上述实施例的基础上,将根据当前CPU占用率确定当前丢包率优化为:根据当前CPU占用率确定当前丢包权值;根据当前丢包权值确定当前丢包率。包括:2 is a flowchart of a method for processing network congestion according to an embodiment. On the basis of the foregoing embodiment, the current packet loss rate is determined according to the current CPU usage ratio, and the current packet loss weight is determined according to the current CPU usage. The current packet loss rate is determined according to the current packet loss weight. include:
在步骤210中,获取软中断的当前中央处理器CPU占用率,根据当前CPU占用率判断是否进行丢包处理。若进行丢包处理,则执行步骤220,若不进行丢包处理,则在预设时间后循环执行步骤210。In step 210, the CPU usage of the current CPU of the soft interrupt is obtained, and whether the packet loss processing is performed is determined according to the current CPU usage. If the packet loss processing is performed, step 220 is performed. If the packet loss processing is not performed, step 210 is executed after the preset time.
在步骤220中,根据当前CPU占用率确定当前丢包权值。In step 220, the current packet loss weight is determined according to the current CPU usage.
其中,丢包权值指的是用于表示当前CPU占用率的标识,可选地,当前丢包权值可以是0、1或者2。The packet loss weight refers to an identifier used to indicate the current CPU usage. Optionally, the current packet loss weight may be 0, 1, or 2.
在步骤230中,根据当前丢包权值确定当前丢包率。In step 230, the current packet loss rate is determined according to the current packet loss weight.
本实施例中,当系统确定当前丢包权值时,生成预设丢包率的指令,并根据该指令进行选择性丢包处理,例如预设丢包率可以是10%。可选地,若当前丢包权值为1时,确定当前丢包率为10%,若当前丢包权值为2时,确定当前丢包率为20%。In this embodiment, when the system determines the current packet loss weight, an instruction for generating a preset packet loss rate is generated, and the selective packet loss processing is performed according to the instruction. For example, the preset packet loss rate may be 10%. Optionally, if the current packet loss weight is 1, determining that the current packet loss rate is 10%, and if the current packet loss weight is 2, determining that the current packet loss rate is 20%.
在步骤240中,根据预设数据包选择标准确定满足丢包条件的数据包数量。In step 240, the number of data packets satisfying the packet loss condition is determined according to a preset data packet selection criterion.
在步骤250中,根据当前丢包率和满足丢包条件的数据包数量进行选择性丢包。In step 250, selective packet loss is performed according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
本实施例通过根据可动态调节的当前丢包率和满足丢包条件的数据包数量进行选择性丢包,解决了现有技术中软中断导致网络拥塞时,无法选择性丢包处理或者选择性丢包处理增大CPU负载的问题,实现了可动态调整的选择性丢 包,保证系统的正常运行。In this embodiment, the selective packet loss is performed according to the current packet loss rate that can be dynamically adjusted and the number of data packets that meet the packet loss condition, which solves the problem that the network packet is not properly lost when the soft interruption causes the network congestion in the prior art. Packet processing increases the CPU load and implements dynamically adjustable selective loss. Package to ensure the normal operation of the system.
图3是一实施例提供的网络拥塞处理方法,在上述实施例的基础上,提供了根据当前CPU占用率确定当前丢包权值的方法,包括:FIG. 3 is a network congestion processing method according to an embodiment. On the basis of the foregoing embodiment, a method for determining a current packet loss weight according to a current CPU usage ratio, including:
在步骤310中,获取软中断的当前中央处理器CPU占用率,根据当前CPU占用率判断是否进行丢包处理。若进行丢包处理,则执行步骤320,若不进行丢包处理,则在预设时间后循环执行步骤310。In step 310, the CPU usage of the current CPU of the soft interrupt is obtained, and whether the packet loss processing is performed is determined according to the current CPU usage. If the packet loss processing is performed, step 320 is performed. If the packet loss processing is not performed, step 310 is executed after the preset time.
在步骤320中,判断当前CPU占用率是否大于第一阈值。若当前CPU占用率大于第一阈值,则确定当前丢包权值加1,并执行步骤350,若当前CPU占用率小于或等于第一阈值,则执行步骤330。In step 320, it is determined whether the current CPU usage is greater than a first threshold. If the current CPU usage is greater than the first threshold, it is determined that the current packet loss value is incremented by one, and step 350 is performed. If the current CPU usage is less than or equal to the first threshold, step 330 is performed.
其中,第一阈值可以是90%。Wherein, the first threshold may be 90%.
在步骤330中,判断CPU占用率是否小于第二阈值。若当前CPU占用率小于第二阈值,则执行步骤340,若当前CPU占用率大于或等于第二阈值,则在预设时间间隔后返回执行步骤310。In step 330, it is determined whether the CPU occupancy is less than a second threshold. If the current CPU usage is less than the second threshold, step 340 is performed. If the current CPU usage is greater than or equal to the second threshold, return to step 310 after the preset time interval.
可选地,第二阈值可以是68%,预设时间间隔可以是3分钟。Alternatively, the second threshold may be 68% and the preset time interval may be 3 minutes.
在步骤340中,判断当前丢包权值是否为零。若为零,则确定当前丢包权值不变,若不为零,则确定当前丢包权值减1,同时执行步骤350。In step 340, it is determined whether the current packet loss weight is zero. If it is zero, it is determined that the current packet loss weight is unchanged. If it is not zero, it is determined that the current packet loss weight is decremented by 1, and step 350 is performed.
可选地,获取当前CPU占用率,若当前CPU占用率大于第一阈值(例如可以是90%),例如当前CPU占用率可以是92%,确定当前丢包权值加1;若当前CPU占用率小于第二阈值(例如可以是68%),例如当前CPU占用率可以是50%,由于当前丢包权值为大于等于0的正整数,若当前丢包权值为零时,确定当前丢包权值保持不变,若当前丢包权值为大于零的正整数时,确定当前丢包权值减1;若当前CPU占用率小于等于第一阈值,同时大于等于第二阈值时,例如当前CPU占用率可以是78%,确定当前丢包权值保持不变。Optionally, the current CPU usage is obtained. If the current CPU usage is greater than the first threshold (for example, 90%), for example, the current CPU usage may be 92%, and the current packet loss weight is determined to be 1; The rate is less than the second threshold (for example, it may be 68%). For example, the current CPU usage may be 50%. Since the current packet loss weight is a positive integer greater than or equal to 0, if the current packet loss weight is zero, the current loss is determined. The weight of the packet is unchanged. If the current packet loss is greater than zero, the current packet loss is decremented by 1. If the current CPU usage is less than or equal to the first threshold and greater than or equal to the second threshold, for example. The current CPU usage can be 78%, and the current packet loss weight remains unchanged.
在步骤350中,根据当前丢包权值确定当前丢包率。In step 350, the current packet loss rate is determined according to the current packet loss weight.
可选地,若当前丢包权值增大,对应的当前丢包率增大,若当前丢包权值减小,对应的当前丢包率减小,实现了丢包率的动态调整,避免了固定大小的丢包率在网络严重拥塞时不能快速降低软中断的CPU占用率,或者在CPU占用率不高时,丢弃大量数据包,导致系统进行数据包重传的情况。 Optionally, if the current packet loss weight increases, the current current packet loss rate increases. If the current packet loss weight decreases, the corresponding current packet loss rate decreases, and the dynamic adjustment of the packet loss rate is implemented to avoid A fixed-size packet loss rate cannot quickly reduce the CPU usage of a soft interrupt when the network is heavily congested, or discard a large number of data packets when the CPU usage is not high, causing the system to retransmit the data packet.
可选地,根据预设时间间隔获取不同时刻的CPU占用率,可确定不同时刻的丢包权值和丢包率,实现了丢包率的动态调整。Optionally, the CPU usage at different times is obtained according to the preset time interval, and the packet loss weight and the packet loss rate at different times are determined, and the dynamic adjustment of the packet loss rate is implemented.
在步骤360中,根据预设数据包选择标准确定满足丢包条件的数据包数量。In step 360, the number of data packets satisfying the packet loss condition is determined according to a preset data packet selection criterion.
在步骤370中,根据当前丢包率和满足丢包条件的数据包数量进行选择性丢包。In step 370, selective packet loss is performed according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
本实施例通过当前CPU占用率与预设阈值进行比较,根据比较结果确定当前丢包权值与丢包率,由于在预设时间间隔获取不同时刻的CPU占用率,实现了丢包率的动态调整。In this embodiment, the current CPU usage ratio is compared with a preset threshold, and the current packet loss weight and packet loss rate are determined according to the comparison result. The CPU usage rate at different times is obtained at a preset time interval, and the packet loss rate is dynamically implemented. Adjustment.
图4是另一实施例提供的网络拥塞处理方法的流程图,在上述实施例的基础上,提供了满足丢包条件的数据包数量的确定方法,包括:FIG. 4 is a flowchart of a network congestion processing method according to another embodiment. On the basis of the foregoing embodiment, a method for determining a number of data packets that meets a packet loss condition is provided, including:
在步骤410中,获取软中断的当前中央处理器CPU占用率,根据当前CPU占用率判断是否进行丢包处理。若进行丢包处理,则执行步骤420,若不进行丢包处理,则在预设时间后循环执行步骤410。In step 410, the CPU usage of the current CPU of the soft interrupt is obtained, and whether the packet loss processing is performed is determined according to the current CPU usage. If the packet loss processing is performed, step 420 is performed. If the packet loss processing is not performed, step 410 is executed after the preset time.
在步骤420中,根据当前CPU占用率确定当前丢包率。In step 420, the current packet loss rate is determined according to the current CPU usage.
在步骤430中,获取数据包信息,其中,数据包信息包括数据包的协议类型、数据包长度、源端口和目的端口。In step 430, the packet information is obtained, wherein the packet information includes a protocol type of the data packet, a packet length, a source port, and a destination port.
其中,数据包的协议类型指的是四层协议类型,包括应用程、传输层、网络互联层和主机到网络层;数据包长度指的是数据包中包含的字节数;源端口指的是本地终端数据包发送端口,目的端口指的是目的终端的数据包接收端口。The protocol type of the data packet refers to a four-layer protocol type, including an application process, a transport layer, a network interconnection layer, and a host to a network layer; a packet length refers to the number of bytes included in the data packet; the source port refers to It is the local terminal packet sending port, and the destination port refers to the packet receiving port of the destination terminal.
可选地,数据包信息可通过解包的方法获取。在解包过程中,首先获取数据包的二层包类型,根据二层包类型决定解包方式。可选地,若数据包为以太网上的点对点协议(Point-to-Point Protocol over Ethernet,PPPOE)类型的数据包,需要先剥去数据包的包头,
Figure PCTCN2017110063-appb-000001
相关指针向下移动8个字节,获取数据包的四层协议类型、目的端口和源端口等数据包信息,在获取信息后需对数据包及时还原。数据包为IP(Internet Protocol,网络之间互连的协议)类型的数据包,在剥去数据包的包头后,
Figure PCTCN2017110063-appb-000002
相关指针无需进行移位可直接获取数据包信息。
Alternatively, the packet information can be obtained by an unpacking method. In the unpacking process, the second-layer packet type of the data packet is first obtained, and the unpacking mode is determined according to the second-layer packet type. Optionally, if the data packet is a Point-to-Point Protocol over Ethernet (PPPOE) type packet on the Ethernet, the packet header of the data packet needs to be stripped first.
Figure PCTCN2017110063-appb-000001
The related pointer moves down 8 bytes to obtain packet information such as the protocol type, destination port, and source port of the data packet. After obtaining the information, the data packet needs to be restored in time. The data packet is an IP (Internet Protocol) protocol type packet, after stripping the packet header,
Figure PCTCN2017110063-appb-000002
The related pointer can directly acquire the packet information without shifting.
在步骤440中,检测数据包的协议类型是否是预设协议类型。若数据包的 协议类型不是预设协议类型,则确定数据包不满足丢包条件,若数据包的协议类型是预设协议类型,则执行步骤460。In step 440, it is detected whether the protocol type of the data packet is a preset protocol type. If the packet If the protocol type is not the default protocol type, it is determined that the data packet does not meet the packet loss condition. If the protocol type of the data packet is the preset protocol type, step 460 is performed.
本实施例中,预设协议类型可以是传输层的UDP(User Datagram Protocol,用户数据报协议)和TCP(Transmission Control Protocol,传输控制协议),若数据包的协议类型不属于UDP或者TCP,则确定该数据包不满足丢包条件,不属于丢包范围内的数据包。In this embodiment, the default protocol type may be a UDP (User Datagram Protocol) and a TCP (Transmission Control Protocol) of the transport layer. If the protocol type of the data packet does not belong to UDP or TCP, It is determined that the data packet does not satisfy the packet loss condition and is not a data packet within the packet loss scope.
本实施例中,丢包处理只丢弃预设协议类型(UDP和TCP)的数据包,保证了终端的基本业务不受影响。In this embodiment, the packet loss process only discards the data packets of the preset protocol type (UDP and TCP), and ensures that the basic services of the terminal are not affected.
在步骤450中,对数据包进行预设协议类型标记,并检测数据包的数据包长度是否大于预设长度。若数据包的数据包长度小于或等于预设长度,则确定数据包不满足丢包条件,若数据包的数据包长度大于预设长度,则执行步骤470。In step 450, the data packet is subjected to a preset protocol type flag, and it is detected whether the data packet length of the data packet is greater than a preset length. If the data packet length of the data packet is less than or equal to the preset length, it is determined that the data packet does not meet the packet loss condition. If the data packet length of the data packet is greater than the preset length, step 470 is performed.
其中,预设长度可以是256字节,数据包长度小于或等于256字节,则确定该数据包不满足丢包条件,不属于丢包范围内的数据包;若数据包长度大于256字节,则确定该数据包满足丢包条件,属于丢包范围内的数据包。可选地,满足丢包条件的数据包可以是BT(Bit Torrent,比特流)下载数据包。The preset length may be 256 bytes, and the data packet length is less than or equal to 256 bytes, determining that the data packet does not satisfy the packet loss condition, and is not in the packet loss range; if the data packet length is greater than 256 bytes Then, it is determined that the data packet satisfies the packet loss condition and belongs to the data packet within the packet loss range. Optionally, the data packet that meets the packet loss condition may be a BT (Bit Torrent) download data packet.
本实施例中,选择数据包长度大于预设长度的数据包进行丢弃,能够加快CPU占用率的调节效率。In this embodiment, the data packet whose packet length is longer than the preset length is selected for discarding, which can speed up the adjustment efficiency of the CPU usage.
在步骤460中,确定满足丢包条件的数据包数量加1。同时返回执行步骤430,获取下一个数据包信息。In step 460, it is determined that the number of packets satisfying the packet loss condition is increased by one. At the same time, returning to step 430, the next packet information is obtained.
本实施例中,当确定数据包满足丢包条件时,确定满足丢包条件的数据包数量加1,当确定数据包不满足丢包条件时,确定满足丢包条件的数据包数量不变。In this embodiment, when it is determined that the data packet satisfies the packet loss condition, it is determined that the number of data packets satisfying the packet loss condition is increased by one. When it is determined that the data packet does not satisfy the packet loss condition, the number of data packets satisfying the packet loss condition is determined to be unchanged.
在步骤470中,根据当前丢包率和满足丢包条件的数据包数量进行选择性丢包。In step 470, selective packet loss is performed according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
本实施例通过根据数据包的协议类型和数据包长度选择可丢弃的数据包,根据当前丢包率和满足丢包条件的数据包数量在可丢弃的数据包中选择数据包进行丢包处理,即在保证网络正常运行的情况下,进行丢包处理,实现了选择性丢包。In this embodiment, the packet is selected according to the protocol type and the packet length of the data packet, and the data packet is selected in the discardable data packet according to the current packet loss rate and the number of data packets satisfying the packet loss condition, and the packet loss processing is performed. That is, when the network is guaranteed to operate normally, packet loss processing is performed, and selective packet loss is implemented.
在上述实施例的基础上,在步骤440之前该方法还可以包括: Based on the above embodiment, before step 440, the method may further include:
检测数据包是否含有预设协议类型标记。若含有,则确定数据包不满足丢包条件,若不含有,则执行步骤450。Check if the packet contains a preset protocol type tag. If yes, it is determined that the data packet does not satisfy the packet loss condition. If not, step 450 is performed.
本实施例中,在检测到数据包的协议类型属于预设协议类型时,对数据包进行预设协议类型标记,表明该数据包被检测。由于根据丢包率随机确定被丢弃的数据包,因此存在被标记但未被丢弃的数据包,又由于软件中断处理函数可能对同一数据包进行多次调用,为了避免同一数据包被反复检测,在对数据包进行预设数据包选择标准检测之前,检测据包是否含有预设协议类型标记,若存在,不在对该数据包进行检测,减少了检测次数,提高了处理效率。In this embodiment, when it is detected that the protocol type of the data packet belongs to the preset protocol type, the data packet is marked with a preset protocol type, indicating that the data packet is detected. Since the discarded data packet is randomly determined according to the packet loss rate, there is a data packet that is marked but not discarded, and the software interrupt processing function may make multiple calls to the same data packet. To avoid repeated detection of the same data packet, Before performing the preset packet selection standard detection on the data packet, it is detected whether the data packet contains the preset protocol type flag. If it exists, the data packet is not detected, the detection times are reduced, and the processing efficiency is improved.
在上述实施例的基础上,在步骤460之后该方法还可以包括:Based on the foregoing embodiment, after the step 460, the method may further include:
检测数据包的源端口和/或目的端口是否是预放开端口。若是预放开端口,则确定数据包不满足丢包条件,若不是预放开端口,则确定数据包满足丢包条件。Check if the source port and/or destination port of the packet is a pre-release port. If the port is pre-released, it is determined that the data packet does not meet the packet loss condition. If the port is not pre-released, it is determined that the data packet satisfies the packet loss condition.
本实施例中,预放开端口例如可以是80端口、443端口、53端口或者22端口等,根据上述预放开端口建立哈希表,若数据包的源端口或目的端口任意端口属于哈希表中的一个预放开端口,则确定数据包不满足丢包条件,若数据包的源端口和目的端口均不属于哈希表中的预放开端口,则确定数据包满足丢包条件。In this embodiment, the pre-release port may be, for example, 80 ports, 443 ports, 53 ports, or 22 ports, etc., and the hash table is established according to the pre-release port, if the source port or the destination port of the data packet belongs to a hash. A pre-release port in the table determines that the data packet does not meet the packet loss condition. If the source port and the destination port of the data packet do not belong to the pre-release port in the hash table, it is determined that the data packet satisfies the packet loss condition.
本实施例中,将源端口和/或目的端口属于预放开端口的数据包确定为不满足丢包条件的数据包,减少了数据包的丢失。In this embodiment, the data packet that the source port and/or the destination port belongs to the pre-release port is determined as a data packet that does not satisfy the packet loss condition, and the data packet loss is reduced.
图5是另一实施例五提供的网络拥塞处理装置,该装置适设置为执行本发明实施例提供的网络拥塞处理方法,包括:FIG. 5 is a network congestion processing apparatus according to another embodiment 5, where the apparatus is configured to perform the network congestion processing method provided by the embodiment of the present invention, including:
丢包处理判断模块510,设置为获取软中断的当前中央处理器CPU占用率,根据当前CPU占用率判断是否进行丢包处理;The packet loss processing judging module 510 is configured to obtain the CPU usage of the current CPU of the soft interrupt, and determine whether to perform packet loss processing according to the current CPU usage rate;
丢包率确定模块520,设置为当确定进行丢包处理时,根据当前CPU占用率确定当前丢包率;The packet loss rate determining module 520 is configured to determine a current packet loss rate according to the current CPU usage rate when determining that the packet loss processing is performed;
数据包数量确定模块530,设置为根据预设数据包选择标准确定满足丢包条件的数据包数量;The packet quantity determining module 530 is configured to determine, according to the preset data packet selection criterion, the number of data packets that meet the packet loss condition;
丢包控制模块540,设置为根据当前丢包率和满足丢包条件的数据包数量进 行选择性丢包。The packet loss control module 540 is configured to enter according to the current packet loss rate and the number of data packets satisfying the packet loss condition. Row selective packet loss.
可选地,丢包率确定模块520包括:Optionally, the packet loss rate determining module 520 includes:
丢包权值确定单元521,设置为根据当前CPU占用率确定当前丢包权值;The packet loss weight determining unit 521 is configured to determine a current packet loss weight according to the current CPU usage rate;
丢包率确定单元522,设置为根据当前丢包权值确定当前丢包率。The packet loss rate determining unit 522 is configured to determine a current packet loss rate according to the current packet loss weight.
可选地,丢包权值确定单元521包括:Optionally, the packet loss weight determining unit 521 includes:
第一阈值判断子单元5211,设置为判断当前CPU占用率是否大于第一阈值;The first threshold determining subunit 5211 is configured to determine whether the current CPU usage ratio is greater than a first threshold;
第一丢包权值确定子单元5212,设置为若当前CPU占用率大于第一阈值,则确定当前丢包权值加1;;The first packet loss weight determining sub-unit 5212 is configured to determine that the current packet loss weight is increased by 1 if the current CPU usage is greater than the first threshold;
第二阈值判断子单元5213,设置为若当前CPU占用率小于或等于第一阈值,则判断CPU占用率是否小于第二阈值;The second threshold determining sub-unit 5213 is configured to determine whether the CPU usage ratio is less than a second threshold if the current CPU usage is less than or equal to the first threshold;
第二丢包权值确定子单元5214,设置为若当前CPU占用率小于第二阈值,则进一步判断当前丢包权值是否为零,若为零,则确定当前丢包权值不变,若不为零,则确定当前丢包权值减1;The second packet loss determining unit 5214 is configured to determine whether the current packet loss value is zero if the current CPU usage is less than the second threshold, and if the value is zero, determine that the current packet loss value does not change. If it is not zero, it determines that the current packet loss weight is reduced by 1;
CPU占用率循环获取子单元5215,设置为若当前CPU占用率大于或等于第二阈值,则在预设时间间隔后循环获取新的CPU占用率。The CPU usage cycle acquisition sub-unit 5215 is configured to cycle to acquire a new CPU usage rate after the preset time interval if the current CPU usage is greater than or equal to the second threshold.
可选地,数据包数量确定模块530包括:Optionally, the data packet quantity determining module 530 includes:
数据包信息获取单元531,设置为获取数据包信息,其中,数据包信息包括数据包的协议类型、数据包长度、源端口和目的端口;The packet information obtaining unit 531 is configured to acquire data packet information, where the data packet information includes a protocol type of the data packet, a data packet length, a source port, and a destination port;
协议类型判断单元532,设置为检测数据包的协议类型是否是预设协议类型,若不是预设协议类型,则确定数据包不满足丢包条件;The protocol type determining unit 532 is configured to detect whether the protocol type of the data packet is a preset protocol type, and if it is not the preset protocol type, determine that the data packet does not satisfy the packet loss condition;
数据包长度判断单元533,设置为若数据包的协议类型是预设协议类型,对数据包进行预设协议类型标记,并检测数据包的数据包长度是否大于预设长度;The packet length determining unit 533 is configured to: if the protocol type of the data packet is a preset protocol type, perform a preset protocol type marking on the data packet, and detect whether the data packet length of the data packet is greater than a preset length;
数据包数量确定单元534,设置为若数据包的数据包长度小于或等于预设长度,则确定数据包不满足丢包条件,若数据包的数据包长度大于预设长度,则确定满足丢包条件的数据包数量加1。The packet quantity determining unit 534 is configured to determine that the data packet does not satisfy the packet loss condition if the data packet length of the data packet is less than or equal to the preset length, and if the data packet length of the data packet is greater than the preset length, determine that the packet loss is satisfied. The number of packets for the condition is increased by one.
可选地,数据包数量确定模块530包括:Optionally, the data packet quantity determining module 530 includes:
标记检测单元535,在检测数据包的协议类型是否是预设协议类型之前,检 测数据包是否含有预设协议类型标记,若含有,则确定数据包不满足丢包条件,若不含有,则检测数据包的协议类型是否是预设协议类型。The flag detecting unit 535 checks before detecting whether the protocol type of the data packet is a preset protocol type. Whether the data packet contains a preset protocol type flag, if it is included, determines that the data packet does not satisfy the packet loss condition, and if not, detects whether the protocol type of the data packet is a preset protocol type.
可选地,数据包数量确定模块530还包括:Optionally, the data packet quantity determining module 530 further includes:
端口检测单元536,设置为在确定满足丢包条件的数据包数量之后,检测数据包的源端口和/或目的端口是否是预放开端口,若是预放开端口,则确定数据包不满足丢包条件,若不是预放开端口,则确定数据包满足丢包条件。The port detecting unit 536 is configured to detect whether the source port and/or the destination port of the data packet are pre-release ports after determining the number of data packets satisfying the packet loss condition, and if the port is pre-released, determine that the data packet is not satisfied. The packet condition, if it is not pre-released, determines that the packet satisfies the packet loss condition.
可选地,丢包控制模块540包括:Optionally, the packet loss control module 540 includes:
丢包数量确定单元541,设置为根据当前丢包率和满足丢包条件的数据包数量确定丢包数量;The packet loss determining unit 541 is configured to determine the number of lost packets according to the current packet loss rate and the number of data packets satisfying the packet loss condition;
丢包控制单元542,设置为在满足丢包条件的数据包中随机选择丢包数量的数据包进行丢包处理。The packet loss control unit 542 is configured to randomly select a packet of the number of lost packets in the data packet satisfying the packet loss condition to perform packet loss processing.
本发明实施例提供的网络拥塞处理装置可执行本发明任意实施例所提供的网络拥塞处理方法,具备执行方法相应的功能模块和有益效果。The network congestion processing apparatus provided by the embodiment of the present invention may perform the network congestion processing method provided by any embodiment of the present invention, and has a function module and a beneficial effect corresponding to the execution method.
一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行上述的网络拥塞处理方法。A computer readable storage medium storing computer executable instructions arranged to perform the network congestion processing method described above.
工业实用性Industrial applicability
本公开解决了现有技术中软中断导致网络拥塞时,无法选择性丢包处理或者选择性丢包处理增大CPU负载的问题,实现了可动态调整的选择性丢包,保证系统的正常运行。 The present disclosure solves the problem that the selective packet loss processing or the selective packet loss processing increases the CPU load when the network is congested due to the soft interruption in the prior art, and the dynamically adjustable selective packet loss is realized to ensure the normal operation of the system.

Claims (11)

  1. 一种网络拥塞处理方法,包括:A network congestion processing method includes:
    获取软中断的当前中央处理器CPU占用率,根据所述当前CPU占用率判断是否进行丢包处理;Obtaining the CPU usage of the current CPU of the soft interrupt, and determining whether to perform packet loss processing according to the current CPU usage;
    当确定进行丢包处理时,根据所述当前CPU占用率确定当前丢包率;When it is determined that the packet loss processing is performed, determining a current packet loss rate according to the current CPU usage rate;
    根据预设数据包选择标准确定满足丢包条件的数据包数量;Determining the number of data packets satisfying the packet loss condition according to a preset data packet selection criterion;
    根据所述当前丢包率和所述满足丢包条件的数据包数量进行选择性丢包。Selective packet loss according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
  2. 根据权利要求1所述的方法,其中,根据所述当前CPU占用率确定当前丢包率,包括:The method of claim 1, wherein determining the current packet loss rate according to the current CPU usage comprises:
    根据所述当前CPU占用率确定当前丢包权值;Determining a current packet loss weight according to the current CPU usage;
    根据所述当前丢包权值确定所述当前丢包率。Determining the current packet loss rate according to the current packet loss weight.
  3. 根据权利要求2所述的方法,其中,根据所述当前CPU占用率确定当前丢包权值,包括:The method of claim 2, wherein determining the current packet loss weight according to the current CPU usage comprises:
    判断所述当前CPU占用率是否大于第一阈值;Determining whether the current CPU usage is greater than a first threshold;
    若所述当前CPU占用率大于所述第一阈值,则确定所述当前丢包权值加1,若所述当前CPU占用率小于或等于所述第一阈值,则判断所述CPU占用率是否小于第二阈值;If the current CPU usage is greater than the first threshold, determining that the current packet loss value is increased by one, and if the current CPU usage is less than or equal to the first threshold, determining whether the CPU usage rate is Less than the second threshold;
    若所述当前CPU占用率小于所述第二阈值,则判断所述当前丢包权值是否为零,若为零,则确定所述当前丢包权值不变,若不为零,则确定所述当前丢包权值减1;If the current CPU usage is less than the second threshold, determining whether the current packet loss value is zero. If it is zero, determining that the current packet loss weight is unchanged. If not, determining The current packet loss weight is decreased by one;
    若所述当前CPU占用率大于或等于所述第二阈值,则在预设时间间隔后循环获取新的CPU占用率。If the current CPU usage is greater than or equal to the second threshold, the new CPU usage is cyclically acquired after the preset time interval.
  4. 根据权利要求1所述的方法,其中,根据预设数据包选择标准确定满足丢包条件的数据包数量,包括:The method according to claim 1, wherein the number of data packets satisfying the packet loss condition is determined according to a preset data packet selection criterion, including:
    获取数据包信息,其中,所述数据包信息包括数据包的协议类型、数据包长度、源端口和目的端口;Obtaining packet information, where the packet information includes a protocol type of the data packet, a data packet length, a source port, and a destination port;
    检测所述数据包的所述协议类型是否是预设协议类型,若不是预设协议类型,则确定所述数据包不满足丢包条件,若是预设协议类型,对数据包进行预设协议类型标记,并检测所述数据包的所述数据包长度是否大于预设长度;Determining whether the protocol type of the data packet is a preset protocol type, if it is not a preset protocol type, determining that the data packet does not satisfy a packet loss condition, and if it is a preset protocol type, performing a preset protocol type on the data packet Marking, and detecting whether the length of the data packet of the data packet is greater than a preset length;
    若所述数据包的数据包长度小于或等于所述预设长度,则确定所述数据包不满足丢包条件,若所述数据包的数据包长度大于所述预设长度,则确定满足 丢包条件的数据包数量加1。If the data packet length of the data packet is less than or equal to the preset length, determining that the data packet does not satisfy the packet loss condition, and if the data packet length of the data packet is greater than the preset length, determining to satisfy The number of packets with packet loss conditions is increased by one.
  5. 根据权利要求4所述的方法,其中,在检测所述数据包的协议类型是否是预设协议类型之前,所述方法还包括:The method of claim 4, wherein before detecting whether the protocol type of the data packet is a preset protocol type, the method further comprises:
    检测所述数据包是否含有预设协议类型标记,若含有,则确定所述数据包不满足丢包条件,若不含有,则检测所述数据包的所述协议类型是否是预设协议类型。Detecting whether the data packet includes a preset protocol type identifier, if yes, determining that the data packet does not satisfy the packet loss condition, and if not, detecting whether the protocol type of the data packet is a preset protocol type.
  6. 根据权利要求4所述的方法,其中,在确定满足丢包条件的数据包数量之后,所述方法还包括:The method according to claim 4, wherein after determining the number of data packets satisfying the packet loss condition, the method further comprises:
    检测所述数据包的源端口和/或目的端口是否是预放开端口,若是预放开端口,则确定所述数据包不满足丢包条件,若不是预放开端口,则确定所述数据包满足所述丢包条件。Detecting whether the source port and/or the destination port of the data packet is a pre-release port. If the port is pre-released, it is determined that the data packet does not meet the packet loss condition. If the port is not pre-released, the data is determined. The packet satisfies the packet loss condition.
  7. 根据权利要求1所述的方法,其中,根据所述当前丢包率和所述满足丢包条件的数据包数量进行选择性丢包,包括:The method according to claim 1, wherein the selective packet loss according to the current packet loss rate and the number of data packets satisfying the packet loss condition comprises:
    根据所述当前丢包率和所述满足丢包条件的数据包数量确定丢包数量;Determining the number of lost packets according to the current packet loss rate and the number of data packets satisfying the packet loss condition;
    在满足丢包条件的数据包中随机选择所述丢包数量的数据包进行丢包处理。The data packet with the number of lost packets is randomly selected in the data packet satisfying the packet loss condition for packet loss processing.
  8. 一种网络拥塞处理装置,包括:A network congestion processing device includes:
    丢包处理判断模块,设置为获取软中断的当前中央处理器CPU占用率,根据所述当前CPU占用率判断是否进行丢包处理;The packet loss processing judging module is configured to obtain the CPU usage of the current CPU of the soft interrupt, and determine whether to perform packet loss processing according to the current CPU usage rate;
    丢包率确定模块,设置为当确定进行丢包处理时,根据所述当前CPU占用率确定当前丢包率;The packet loss rate determining module is configured to determine a current packet loss rate according to the current CPU usage rate when determining that the packet loss processing is performed;
    数据包数量确定模块,设置为根据预设数据包选择标准确定满足丢包条件的数据包数量;a data packet quantity determining module, configured to determine, according to a preset data packet selection criterion, a number of data packets that meet the packet loss condition;
    丢包控制模块,设置为根据所述当前丢包率和所述满足丢包条件的数据包数量进行选择性丢包。The packet loss control module is configured to perform selective packet loss according to the current packet loss rate and the number of data packets satisfying the packet loss condition.
  9. 根据权利要求8所述的装置,其中,所述丢包率确定模块包括:The apparatus according to claim 8, wherein the packet loss rate determining module comprises:
    丢包权值确定单元,设置为根据所述当前CPU占用率确定当前丢包权值;The packet loss weight determining unit is configured to determine a current packet loss weight according to the current CPU usage ratio;
    丢包率确定单元,设置为根据所述当前丢包权值确定所述当前丢包率,其中,所述丢包率确定单元包括:The packet loss rate determining unit is configured to determine the current packet loss rate according to the current packet loss weight, where the packet loss rate determining unit includes:
    第一阈值判断子单元,设置为判断所述当前CPU占用率是否大于第一阈值;a first threshold determining subunit, configured to determine whether the current CPU usage ratio is greater than a first threshold;
    第一丢包权值确定子单元,设置为若所述当前CPU占用率大于所述第一阈 值,则确定所述当前丢包权值加1;a first packet loss weight determining subunit, configured to: if the current CPU usage is greater than the first threshold a value, determining that the current packet loss weight is increased by one;
    第二阈值判断子单元,设置为若所述当前CPU占用率小于或等于所述第一阈值,则判断所述CPU占用率是否小于第二阈值;a second threshold determining subunit, configured to determine whether the CPU usage is less than a second threshold if the current CPU usage is less than or equal to the first threshold;
    第二丢包权值确定子单元,设置为若所述当前CPU占用率小于所述第二阈值,则进一步判断所述当前丢包权值是否为零,若为零,则确定所述当前丢包权值不变,若不是,则确定所述当前丢包权值减1;The second packet loss determining unit is configured to determine whether the current packet loss value is zero if the current CPU usage is less than the second threshold, and if the current value is zero, determine the current lost The weight of the packet is unchanged, if not, it is determined that the current weight loss value is decreased by 1;
    CPU占用率循环获取子单元,设置为若所述当前CPU占用率大于或等于所述第二阈值,则在预设时间间隔后循环获取新的CPU占用率;The CPU usage cycle acquires the sub-unit, and if the current CPU usage is greater than or equal to the second threshold, the CPU usage is cyclically acquired after the preset time interval;
    所述丢包控制模块包括:The packet loss control module includes:
    丢包数量确定单元,设置为根据所述当前丢包率和所述满足丢包条件的数据包数量确定丢包数量;The packet loss determining unit is configured to determine the number of lost packets according to the current packet loss rate and the number of data packets satisfying the packet loss condition;
    丢包控制单元,设置为在满足丢包条件的数据包中随机选择所述丢包数量的数据包进行丢包处理。The packet loss control unit is configured to randomly select the packet with the number of lost packets in a data packet satisfying the packet loss condition to perform packet loss processing.
  10. 根据权利要求8所述的装置,其中,所述数据包数量确定模块包括:The apparatus of claim 8, wherein the data packet quantity determining module comprises:
    数据包信息获取单元,设置为获取数据包信息,其中,所述数据包信息包括数据包的协议类型、数据包长度、源端口和目的端口;a packet information obtaining unit, configured to acquire data packet information, where the data packet information includes a protocol type, a data packet length, a source port, and a destination port of the data packet;
    协议类型判断单元,设置为检测所述数据包的所述协议类型是否是预设协议类型,若不是预设协议类型,则确定所述数据包不满足丢包条件;a protocol type determining unit, configured to detect whether the protocol type of the data packet is a preset protocol type, and if it is not a preset protocol type, determining that the data packet does not satisfy a packet loss condition;
    数据包长度判断单元,设置为若所述数据包的协议类型是预设协议类型,对数据包进行预设协议类型标记,并检测所述数据包的所述数据包长度是否大于预设长度;a packet length determining unit, configured to: if the protocol type of the data packet is a preset protocol type, perform a preset protocol type marking on the data packet, and detect whether the data packet length of the data packet is greater than a preset length;
    数据包数量确定单元,设置为若所述数据包的数据包长度小于或等于所述预设长度,则确定所述数据包不满足丢包条件,若所述数据包的数据包长度大于所述预设长度,则确定满足丢包条件的数据包数量加1;a packet quantity determining unit, configured to determine that the data packet does not satisfy the packet loss condition if the data packet length of the data packet is less than or equal to the preset length, if the data packet length of the data packet is greater than the The preset length determines the number of packets that meet the packet loss condition plus one;
    标记检测单元,在检测所述数据包的协议类型是否是预设协议类型之前,检测所述数据包是否含有预设协议类型标记,若含有,则确定所述数据包不满足丢包条件,若不含有,则检测所述数据包的所述协议类型是否是预设协议类型;a flag detecting unit, before detecting whether the protocol type of the data packet is a preset protocol type, detecting whether the data packet includes a preset protocol type flag, and if yes, determining that the data packet does not satisfy a packet loss condition, if If not, detecting whether the protocol type of the data packet is a preset protocol type;
    端口检测单元,设置为在确定满足丢包条件的数据包数量之后,检测所述数据包的源端口和/或目的端口是否是预放开端口,若是,则确定所述数据包不 满足丢包条件,若否,则确定所述数据包满足所述丢包条件。The port detecting unit is configured to: after determining the number of data packets satisfying the packet loss condition, detecting whether the source port and/or the destination port of the data packet is a pre-release port, and if yes, determining that the data packet is not The packet loss condition is met, and if not, it is determined that the data packet satisfies the packet loss condition.
  11. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行权利要求1-7所述的方法。 A computer readable storage medium storing computer executable instructions arranged to perform the method of claims 1-7.
PCT/CN2017/110063 2016-12-19 2017-11-09 Method and device for network congestion processing WO2018113436A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611177669.3A CN106506392B (en) 2016-12-19 2016-12-19 A kind of network congestion processing method and device
CN201611177669.3 2016-12-19

Publications (1)

Publication Number Publication Date
WO2018113436A1 true WO2018113436A1 (en) 2018-06-28

Family

ID=58334946

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/110063 WO2018113436A1 (en) 2016-12-19 2017-11-09 Method and device for network congestion processing

Country Status (2)

Country Link
CN (1) CN106506392B (en)
WO (1) WO2018113436A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114584491A (en) * 2022-04-21 2022-06-03 腾讯科技(深圳)有限公司 Detection method, detection device, storage medium, equipment and program product

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506392B (en) * 2016-12-19 2019-11-26 深圳创维数字技术有限公司 A kind of network congestion processing method and device
CN107872401B (en) * 2017-12-22 2021-01-12 成都飞鱼星科技股份有限公司 Network key service guarantee method and device
CN108494761A (en) * 2018-03-15 2018-09-04 四川斐讯信息技术有限公司 A kind of router network address filter method and filtration system
CN110806924B (en) * 2018-08-06 2022-06-07 大唐移动通信设备有限公司 Network processing method and device based on CPU occupancy rate
CN109117271B (en) * 2018-08-10 2021-03-23 普联技术有限公司 Method for automatically adjusting CPU load, storage medium and terminal equipment
CN113259304B (en) * 2020-02-12 2022-06-03 上海云盾信息技术有限公司 Attack protection method and equipment based on dynamic adjustment
CN112000422B (en) * 2020-07-17 2022-08-05 苏州浪潮智能科技有限公司 Method and device for preventing POD memory overflow in container arrangement frame
CN112231107B (en) * 2020-10-28 2023-06-30 新华三信息安全技术有限公司 Message speed limiting system, method, equipment and medium of firewall

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101800699A (en) * 2010-02-09 2010-08-11 上海华为技术有限公司 Method and device for dropping packets
CN102299850A (en) * 2011-08-29 2011-12-28 中兴通讯股份有限公司 Method and device for protecting central processing unit (CPU)
CN103229466A (en) * 2012-12-27 2013-07-31 华为技术有限公司 Data packet transmission method and device
WO2013178076A1 (en) * 2012-05-30 2013-12-05 The University Of Hong Kong Enhancing aqm to combat wireless losses
CN106506392A (en) * 2016-12-19 2017-03-15 深圳创维数字技术有限公司 A kind of network congestion processing method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1677952A (en) * 2004-03-30 2005-10-05 武汉烽火网络有限责任公司 Method and apparatus for wire speed parallel forwarding of packets
CN100496022C (en) * 2006-05-09 2009-06-03 华为技术有限公司 Flow control method and apparatus
CN101383694A (en) * 2007-09-03 2009-03-11 电子科技大学 Defense method and system rejecting service attack based on data mining technology
CN102185740B (en) * 2011-05-13 2013-09-18 北京星网锐捷网络技术有限公司 Heartbeat detection method and network equipment
CN102436400A (en) * 2011-12-06 2012-05-02 曙光信息产业股份有限公司 Method and device for implementing zero copy drive
US9065780B2 (en) * 2012-09-18 2015-06-23 Cisco Technology, Inc. Low latency networking device using header prediction

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101800699A (en) * 2010-02-09 2010-08-11 上海华为技术有限公司 Method and device for dropping packets
CN102299850A (en) * 2011-08-29 2011-12-28 中兴通讯股份有限公司 Method and device for protecting central processing unit (CPU)
WO2013178076A1 (en) * 2012-05-30 2013-12-05 The University Of Hong Kong Enhancing aqm to combat wireless losses
CN103229466A (en) * 2012-12-27 2013-07-31 华为技术有限公司 Data packet transmission method and device
CN106506392A (en) * 2016-12-19 2017-03-15 深圳创维数字技术有限公司 A kind of network congestion processing method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114584491A (en) * 2022-04-21 2022-06-03 腾讯科技(深圳)有限公司 Detection method, detection device, storage medium, equipment and program product
CN114584491B (en) * 2022-04-21 2023-09-08 腾讯科技(深圳)有限公司 Detection method, detection device, storage medium and detection equipment

Also Published As

Publication number Publication date
CN106506392B (en) 2019-11-26
CN106506392A (en) 2017-03-15

Similar Documents

Publication Publication Date Title
WO2018113436A1 (en) Method and device for network congestion processing
US11316795B2 (en) Network flow control method and network device
CN107204931B (en) Communication device and method for communication
CN109120544B (en) Transmission control method based on host end flow scheduling in data center network
US10218620B2 (en) Methods and nodes for congestion control
WO2018210117A1 (en) Congestion control method, network device, and network interface controller thereof
CN106062726B (en) Flow aware buffer management for data center switches
EP2959645B1 (en) Dynamic optimization of tcp connections
WO2020042624A1 (en) Transmission rate control method and apparatus, sending device and receiving device
WO2017101503A1 (en) Data transfer method, sending node, receiving node and data transfer system
JP5659125B2 (en) Relay device and relay method
KR100716184B1 (en) Apparatus and method for a queue management of network processor
US20150172198A1 (en) Methods and network device for oversubscription handling
WO2018113426A1 (en) Flow control method and switching device
WO2012065477A1 (en) Method and system for avoiding message congestion
KR101329263B1 (en) Network-based data traffic detection and control
US20050213507A1 (en) Dynamically provisioning computer system resources
WO2015172668A1 (en) Method and device for determining congestion window in network
WO2020063339A1 (en) Method, device and system for realizing data transmission
WO2018108093A1 (en) Congestion control method and apparatus, and computer storage medium
CN110784415B (en) ECN quick response method and device
WO2017161967A1 (en) Method of monitoring data traffic in packets per second, device, and computer storage medium
CN112995048B (en) Blocking control and scheduling fusion method of data center network and terminal equipment
WO2017097201A1 (en) Data transmission method, transmission device and receiving device
US20230059755A1 (en) System and method for congestion control using a flow level transmit mechanism

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17884474

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17884474

Country of ref document: EP

Kind code of ref document: A1