Bandwidth speed limiting method, device, equipment and medium

By extracting triple information in the data packet, identifying the speed limiting strategy based on the type, and taking speed limiting measures, the problem that the bandwidth speed limiting scheme in the prior art cannot be applied to multiple application scenarios, achieving more refined traffic management and higher network access experience.

CN119854222APending Publication Date: 2025-04-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411697835.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The bandwidth and speed limiting solution of existing cloud platforms cannot be applicable to many different application scenarios, resulting in business operations and poor user experience.

Method used

By extracting triple information in the data packet (data transmission protocol, source port, destination port), determining the traffic type, and identifying the occupied bandwidth value and speed limiting strategy based on the traffic type, and taking corresponding speed limit measures to process the data packet.

Benefits of technology

It realizes more refined traffic management, is suitable for more application scenarios, improves network access experience, reduces the impact on network performance, avoids bandwidth waste, and improves the overall network performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854222A_ABST
    Figure CN119854222A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a bandwidth speed limiting method and device, equipment and a medium, and the method comprises the steps: extracting triple information from a data packet when the data packet to be transmitted is obtained for the first time in a current period; determining a traffic type corresponding to the data packet according to one or more elements in the triple information; according to the traffic type, identifying an occupied traffic bandwidth value corresponding to the traffic type and a traffic speed limiting strategy corresponding to the traffic type; when it is identified that the occupied traffic bandwidth value does not conform to the traffic speed limiting strategy, a speed limiting measure corresponding to the traffic type is taken; and processing the to-be-transmitted data packet according to the speed limiting measure. Even if the speed-limiting object is a single EIP, finer traffic management can be realized by distinguishing traffic types. The traffic speed limiting method is ensured to be suitable for more application scenes, high flexibility is provided, the traffic speed limiting method can adapt to continuously changing network environments and application requirements, and the network access experience of users can be greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud technology, and in particular to a bandwidth speed limiting method, device, equipment and medium. Background Art

[0002] Bandwidth is a limited and expensive resource on the cloud platform. Users cannot use bandwidth resources unlimitedly, otherwise there will be resource competition, reaching bandwidth peak, and causing network access interruption. All public cloud platforms in the industry provide users with shared bandwidth and exclusive bandwidth product services. Users can order different bandwidths. Different bandwidths have different prices; if the bandwidth value is exceeded, the traffic will be limited.

[0003] The speed limit solution currently adopted by major cloud platforms is to use a single speed limit factor (bandwidth value). All traffic accessed through (Elastic IP Address, EIP for short) will be subject to the same speed limit if it exceeds the speed limit bandwidth value.

[0004] This speed limit processing solution cannot be applied to a variety of different application scenarios, business operations are affected, and user experience is relatively poor. Summary of the invention

[0005] In view of this, the present invention provides a bandwidth speed limiting method, device, equipment and medium to solve the problem that traditional speed limiting processing solutions cannot be applied to a variety of different application scenarios, which affects business operations and poor user experience.

[0006] In a first aspect, the present invention provides a bandwidth speed limiting method, the method comprising:

[0007] When a data packet to be transmitted is obtained for the first time in the current cycle, triplet information is extracted from the data packet, wherein the triplet information includes: data transmission protocol, source port, and destination port;

[0008] Determine a traffic type corresponding to the data packet according to one or more elements in the triplet information;

[0009] According to the traffic type, identifying the occupied traffic bandwidth value corresponding to the traffic type and the traffic speed limit strategy corresponding to the traffic type, wherein the occupied traffic bandwidth value is the traffic bandwidth value that has been occupied before the current period;

[0010] When it is identified that the occupied traffic bandwidth value does not meet the traffic speed limit policy, a speed limit measure corresponding to the traffic type is taken;

[0011] Process the data packets to be transmitted according to the rate limiting measures.

[0012] The bandwidth speed limiting method provided by the present invention has the following advantages:

[0013] In the embodiment of the present application, even if the speed limit object is a single EIP, more sophisticated traffic management can be achieved because of the distinction of traffic types. Different speed limit strategies and corresponding speed limit measures can be implemented according to different traffic types to provide more sophisticated traffic speed limit control, which can ensure that the traffic speed limit method is applicable to more application scenarios, provides high flexibility, can adapt to the ever-changing network environment and application requirements, and can greatly improve the user's network access experience. Moreover, different traffic types have different effects on network performance. Through the speed limit strategy, the traffic that has a greater impact on network performance can be reduced, thereby improving the overall network performance. Through monitoring and speed limit, it can also ensure that network resources are more effectively utilized and bandwidth waste is avoided, especially during high traffic periods. The speed limit strategy can be automatically adjusted according to network conditions and traffic patterns, and can adapt to different network conditions. By limiting the packet rate of the traffic type, network congestion can be reduced and the reliability and speed of data packet transmission can be improved. By analyzing the bandwidth usage and speed limit effects of different traffic types, network administrators can be helped to perform fault diagnosis and performance analysis. In summary, the method not only improves the efficiency and flexibility of network management, but also enhances the quality of network services and the overall experience of users.

[0014] In an optional implementation, the traffic speed limit strategy includes a speed limit bandwidth value corresponding to the traffic type, or includes a speed limit bandwidth value and a speed limit ratio; identifying whether the occupied traffic bandwidth value complies with the traffic speed limit strategy includes:

[0015] Compare the occupied traffic bandwidth value with the speed limit bandwidth value;

[0016] When the traffic speed limit policy includes a speed limit bandwidth value and a speed limit ratio, and when the occupied traffic bandwidth value is greater than the speed limit bandwidth value, the difference between the occupied traffic bandwidth value and the speed limit bandwidth value is calculated;

[0017] Determine the excess ratio based on the difference and the speed limit bandwidth value;

[0018] When it is determined that the excess ratio is greater than the speed limit ratio, it is determined that the occupied traffic bandwidth value does not comply with the traffic speed limit policy;

[0019] or,

[0020] When the occupied traffic bandwidth value is less than or equal to the speed limit bandwidth value, it is determined that the occupied traffic bandwidth value complies with the traffic speed limit policy;

[0021] Alternatively, when the traffic speed limit policy includes a speed limit bandwidth value corresponding to the traffic type, and when the occupied traffic bandwidth value is greater than the speed limit bandwidth value, it is determined that the occupied traffic bandwidth value does not comply with the traffic speed limit policy.

[0022] Specifically, by comparing the occupied traffic bandwidth value with the speed limit bandwidth value, the bandwidth usage of each traffic type can be accurately controlled to avoid network congestion caused by excessive usage. The speed limit strategy that combines the speed limit bandwidth value and the speed limit ratio can flexibly adjust the bandwidth allocation according to the network traffic situation to adapt to different network requirements and traffic patterns. When the occupied traffic bandwidth value exceeds the speed limit bandwidth value, by calculating the excess ratio, the overload situation can be identified and handled in time to protect network resources from damage. Optimize the allocation of network resources to ensure that key businesses and services have sufficient bandwidth. An effective speed limit strategy helps reduce unnecessary network congestion, thereby improving the overall transmission efficiency of the network. Reasonable control of traffic bandwidth can improve user experience, especially in applications with high bandwidth requirements (such as video streaming, online games, etc.).

[0023] In an optional embodiment, the method further includes:

[0024] When it is determined that the excess ratio is less than or equal to the speed limit ratio, it is determined that the occupied traffic bandwidth value complies with the traffic speed limit policy.

[0025] In an optional implementation, when the traffic type is a preset target type and it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limit policy, a speed limit measure corresponding to the traffic type is taken, including:

[0026] Add the data packet to the message queue;

[0027] Determine the number of packets allowed per second based on the preconfigured target bandwidth corresponding to the traffic type and the number of bytes occupied by each packet;

[0028] Determine the maximum delay time of each data packet based on the number of data packets allowed per second and the unit time;

[0029] Determine a new sending time of the data packet based on the current time and the maximum delay time;

[0030] Extract and send the data packet from the message queue at the new send time.

[0031] Specifically, by adding data packets to the message queue and sending them in order, packet loss caused by network congestion or high traffic can be avoided. By determining the number of data packets allowed per second, the system can dynamically adjust bandwidth allocation according to actual bandwidth and traffic requirements to achieve optimal use of resources. Calculating the maximum delay time of each data packet and accurately controlling the sending time of the data packet can reduce network congestion and improve overall network efficiency. At the same time, it can ease the occupation of traffic bandwidth and avoid traffic bandwidth occupation exceeding the speed limit bandwidth value as much as possible.

[0032] In an optional implementation, when the traffic type is not a preset target type and it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limit policy, a speed limit measure corresponding to the traffic type is taken, including:

[0033] Directly mark the packet as discarded.

[0034] In an optional implementation, when the time difference between the new sending time and the current time is greater than the first time threshold, the method further includes:

[0035] Extract and discard the packet from the message queue.

[0036] In an optional embodiment, the method further includes:

[0037] When the time difference between the new sending time and the current time is greater than or equal to the second time threshold and less than the first time threshold, a network congestion notification message is sent to the sending layer of the data packet to control the rate at which the data packet is sent, wherein the network congestion notification message carries a field for displaying the congestion notification.

[0038] Specifically, by sending a network congestion notification message, the sending layer can be notified of the current possible congestion status of the network in real time, so that the sending layer can respond quickly. After receiving the congestion notification, the sending layer can adjust the data packet sending rate according to the notification, thereby avoiding aggravating network congestion due to excessive sending of data packets. By controlling the sending rate, network congestion can be reduced and the efficiency and success rate of data packet transmission can be improved. When the network is congested, by reducing the sending rate, the loss of data packets due to network congestion can be reduced. Reducing network congestion and data packet loss can improve the user's network experience, especially in applications with high real-time requirements. Timely identification and response to network congestion helps to enhance the stability of the network and prevent service interruptions caused by congestion. By limiting the speed and adjusting the sending rate, network resources can be allocated more reasonably to ensure that key services and data packets are given priority. Sending network congestion notifications can simplify the network management process, because network administrators do not need to directly intervene in the sending of each data packet, but optimize network performance through automatic adjustment of the system. By controlling the data packet sending rate, the impact of malicious traffic on the network can be reduced and network security can be improved. By monitoring and responding to network congestion, more predictable network performance can be provided, helping to ensure the quality of network services.

[0039] In a second aspect, the present invention provides a bandwidth speed limiting device, the device comprising:

[0040] An extraction module, used for extracting triplet information from a data packet when acquiring the data packet to be transmitted for the first time in a current cycle, wherein the triplet information includes: a data transmission protocol, a source port, and a destination port;

[0041] A determination module, used to determine the traffic type corresponding to the data packet according to one or more elements in the triplet information;

[0042] An identification module, used to identify, according to the traffic type, an occupied traffic bandwidth value corresponding to the traffic type and a traffic speed limit strategy corresponding to the traffic type, wherein the occupied traffic bandwidth value is a traffic bandwidth value that has been occupied before the current cycle;

[0043] The processing module is used to take speed limiting measures corresponding to the traffic type when it is identified that the occupied traffic bandwidth value does not meet the traffic speed limiting strategy; and process the data packets to be transmitted according to the speed limiting measures.

[0044] The bandwidth speed limiting device provided by the present invention has the following advantages:

[0045] Even if the speed limit object is a single EIP, more sophisticated traffic management can be achieved because of the distinction of traffic types. Different speed limit policies and corresponding speed limit measures can be implemented according to different traffic types to provide more sophisticated traffic speed limit control, which can ensure that the traffic speed limit method is applicable to more application scenarios, provide high flexibility, and can adapt to the ever-changing network environment and application requirements, and can greatly improve the user's network access experience. Moreover, different traffic types have different impacts on network performance. Through speed limit policies, the traffic that has a greater impact on network performance can be reduced, thereby improving the overall network performance. Through monitoring and speed limit, it can also ensure that network resources are used more effectively and bandwidth waste is avoided, especially during high traffic periods. The speed limit policy can be automatically adjusted according to network conditions and traffic patterns to adapt to different network conditions. By limiting the packet rate of traffic types, network congestion can be reduced and the reliability and speed of packet transmission can be improved. By analyzing the bandwidth usage and speed limit effects of different traffic types, it can help network administrators perform fault diagnosis and performance analysis. In summary, this method not only improves the efficiency and flexibility of network management, but also enhances the quality of network services and the overall user experience.

[0046] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the bandwidth speed limiting method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0047] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the bandwidth speed limiting method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0049] Figure 1 It is a flow chart of a bandwidth speed limiting method provided by an embodiment of the present invention;

[0050] Figure 2 It is a structural diagram of identification information corresponding to storage traffic types and corresponding speed limit strategies provided by an embodiment of the present invention;

[0051] Figure 3 It is a flowchart of another bandwidth speed limiting method provided by an embodiment of the present invention;

[0052] Figure 4 This is an overall flow chart of the bandwidth speed limiting method provided by an embodiment of the present invention;

[0053] Figure 5 is a structural block diagram of a bandwidth rate limiting device according to an embodiment of the present invention;

[0054] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0056] Bandwidth is a limited and expensive resource on the cloud platform. Users cannot use bandwidth resources unlimitedly, otherwise there will be resource competition, reaching bandwidth peak, and causing network access interruption. All public cloud platforms in the industry provide users with shared bandwidth and exclusive bandwidth product services. Users can order different bandwidths. Different bandwidths have different prices; if the bandwidth value is exceeded, the traffic will be limited.

[0057] The speed limit solution currently adopted by major cloud platforms is to use a single speed limit factor (bandwidth value). All traffic accessed through EIP will be subject to the same speed limit if it exceeds the speed limit bandwidth value.

[0058] For some traffic types, a large number of processes may be required. Once the speed is limited, the impact on the business will be serious. In addition, with the current bandwidth speed limit solutions of cloud vendors, users can only order a unique bandwidth value for an EIP; different bandwidths cannot be ordered for different traffic types of the same EIP. If the same speed limit solution is used for services in different application scenarios, the operation of some services may be greatly affected, and the services cannot run normally, resulting in a poor user experience.

[0059] To solve the above problems, an embodiment of the present invention provides a bandwidth speed limiting embodiment. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a cloud platform server including a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0060] In this embodiment, a bandwidth speed limiting method is provided, which can be used for the above-mentioned cloud platform server. Figure 1 This is a flow chart of a bandwidth speed limit method provided by an embodiment of the present invention. This method is a method for bandwidth speed limit by traffic type based on extended Berkeley Packet Filter (eBPF) in a cloud platform. This method provides more sophisticated traffic speed limit control to ensure that different traffic types have different network performance under the same bandwidth for the same EIP; different bandwidth speed limits are assigned to different traffic types for the same EIP.

[0061] During specific execution, the written eBPF program can be loaded into the network packet processing path of the cloud platform, and the eBPF program can be used to implement bandwidth speed limiting. Different traffic types are defined in the Ebpf program. For example: Web traffic (http), real-time video traffic (udp), file transfer traffic (ftp), etc. Each traffic type will have its own specific speed limit requirements. Use eBPFMap to save traffic types and corresponding speed limit bandwidths. In an optional example, each traffic type can also be limited to a corresponding priority, which is also saved using eBPF Map. Configure the speed limit policy, speed limit measures, and speed limit algorithm corresponding to each traffic type, and save them in the eBPF Map.

[0062] See Figure 1 As shown, the process includes the following steps:

[0063] Step S101, when a data packet to be transmitted is obtained for the first time in the current cycle, triplet information is extracted from the data packet.

[0064] The triplet information includes: data transmission protocol, source port, and destination port.

[0065] Step S102: determining the traffic type corresponding to the data packet according to one or more elements in the triplet information.

[0066] Specifically, the traffic type may be determined according to one or more elements in the triplet information, and the traffic type may include, for example, a Web traffic type, a real-time video traffic type, or a file transfer traffic type.

[0067] When determining the traffic type, for example, it can be determined based on the data transmission protocol, for example, HTTP traffic is classified as Web traffic, UDP traffic is classified as real-time video traffic, TCP traffic is classified as file transfer traffic, etc. Of course, it can also be determined based on the source port and the destination port, for example, the data transmission type is determined based on the source port and the destination port, and then the traffic type is determined based on the data transmission type, etc. The principle is similar to the principle of determining the traffic type based on the data transmission protocol, and will not be repeated here.

[0068] Step S103: According to the traffic type, the occupied traffic bandwidth value corresponding to the traffic type and the traffic speed limit strategy corresponding to the traffic type are identified.

[0069] Specifically, different traffic types correspond to different traffic speed limit strategies. The traffic speed limit strategy may include a speed limit bandwidth value, and in an optional example, may also include a speed limit ratio, which is the traffic excess ratio. For example, the traffic type corresponding to port 80 under the same EIP has a corresponding speed limit bandwidth of 5M; the speed limit bandwidth of the traffic type corresponding to the HTTP protocol is 10M, and the speed limit type of the traffic corresponding to the UDP protocol is, for example, 50M, etc.

[0070] If a speed limit ratio exists in the traffic speed limit policy corresponding to certain traffic types, then the excess traffic ratio may also be determined, for example, 10%.

[0071] When identifying the occupied traffic bandwidth value corresponding to the traffic type according to different traffic types, we can first determine whether the current cycle is the first cycle. If it is the first cycle, then before the cycle, it is equivalent to unoccupied traffic bandwidth, so the occupied traffic bandwidth value can be defaulted to 0.

[0072] If the current cycle is not the first cycle, the traffic bandwidth values ​​occupied in all cycles before the current cycle can be determined as the occupied traffic bandwidth value corresponding to the traffic type. When obtaining the occupied traffic bandwidth value, the time interval between two bandwidth usages can be determined based on the bandwidth usage rate in each cycle and the timestamp carried in the data packet when different traffic is used. Based on the time interval and bandwidth usage rate, the bandwidth used during this period can be determined.

[0073] Step S104: when it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limit policy, a speed limit measure corresponding to the traffic type is taken.

[0074] Specifically, determining that the occupied traffic bandwidth value does not meet the traffic speed limit conditions usually includes that the occupied traffic has exceeded the speed limit bandwidth value, or the proportion of excess traffic has also exceeded the speed limit proportion. At this time, necessary speed limit measures need to be taken. The specific speed limit measures are determined according to the traffic type, such as packet loss or delayed transmission of the data packet.

[0075] Step S105: Process the data packet to be transmitted according to the speed limit measure.

[0076] In an optional example, as described in the above embodiment, the traffic speed limit strategy includes a speed limit bandwidth value corresponding to the traffic type, or includes a speed limit bandwidth value and a speed limit ratio. Therefore, identifying whether the occupied traffic bandwidth value complies with the traffic speed limit strategy includes the following method steps:

[0077] Step a1, comparing the occupied traffic bandwidth value with the speed limit bandwidth value.

[0078] Specifically, for example, if the traffic bandwidth occupied by Web traffic under the same EIP is 50M and the speed limit bandwidth is 40M, then it is obvious that the speed limit has been exceeded.

[0079] In this case, it is necessary to determine the content included in the traffic policy of this type. For example, if the traffic speed limit policy includes the speed limit bandwidth value and the speed limit ratio, step a2 needs to be performed.

[0080] Step a2: Calculate the difference between the occupied traffic bandwidth value and the speed limit bandwidth value.

[0081] Step a3: determining the excess ratio according to the difference and the speed limit bandwidth value.

[0082] When it is determined that the excess ratio is greater than the speed limit ratio, it is determined that the occupied traffic bandwidth value does not comply with the traffic speed limit policy.

[0083] or,

[0084] When the occupied traffic bandwidth value is less than or equal to the speed limit bandwidth value, it is determined that the occupied traffic bandwidth value complies with the traffic speed limit policy.

[0085] Alternatively, in another case, if the traffic speed limit policy includes a speed limit bandwidth value corresponding to the traffic type, then when the occupied traffic bandwidth value is greater than the speed limit bandwidth value, it is determined that the occupied traffic bandwidth value does not comply with the traffic speed limit policy.

[0086] On the other side of any of the above situations, when the occupied traffic bandwidth value is less than or equal to the speed limit bandwidth value, it is determined that the occupied traffic bandwidth value complies with the traffic speed limit policy.

[0087] In an optional example, different speed limit policies corresponding to different traffic types can be stored through an eBPF mapping table (e.g., a hash mapping table traffic_map). Different traffic types have different traffic type identifiers, and the corresponding hash mapping table can be matched according to the identifier to obtain the corresponding speed limit policy.

[0088] Figure 2 It is shown in the figure that in the traffic_map table, identification information corresponding to the traffic type and the corresponding speed limit policy can be stored in the form of key-value.

[0089] A bandwidth speed limiting method provided by an embodiment of the present invention can achieve more sophisticated traffic management even if the speed limiting object is a single EIP because traffic types are distinguished. Different speed limiting strategies and corresponding speed limiting measures can be executed according to different traffic types to provide more sophisticated traffic speed limiting control, which can ensure that the traffic speed limiting method is applicable to more application scenarios, provides high flexibility, can adapt to the ever-changing network environment and application requirements, and can greatly improve the user's network access experience. Moreover, different traffic types have different impacts on network performance. Through the speed limiting strategy, the traffic that has a greater impact on network performance can be reduced, thereby improving the overall network performance. Through monitoring and speed limiting, it can also ensure that network resources are more effectively utilized and bandwidth waste is avoided, especially during high traffic periods. The speed limiting strategy can be automatically adjusted according to network conditions and traffic patterns, and can adapt to different network conditions. By limiting the packet rate of the traffic type, network congestion can be reduced and the reliability and speed of data packet transmission can be improved. By analyzing the bandwidth usage and speed limiting effects of different traffic types, network administrators can be helped to perform fault diagnosis and performance analysis. In summary, the method not only improves the efficiency and flexibility of network management, but also enhances the quality of network services and the overall experience of users.

[0090] In this embodiment, a bandwidth speed limiting method is provided, which can be used for the above-mentioned cloud server. Figure 3 is a flow chart of a bandwidth speed limiting method according to an embodiment of the present invention. Figure 3 As shown, when the traffic type is a preset target type and it is identified that the occupied traffic bandwidth value does not meet the traffic speed limit strategy, a speed limit measure corresponding to the traffic type is taken, including the following method steps:

[0091] Step S301, adding a data packet to a message queue.

[0092] Specifically, for some traffic types, excess traffic can be supported. Then, the data packet can be sent delayed. Therefore, when the traffic type is the preset target type and it is identified that the occupied traffic bandwidth value does not meet the traffic speed limit policy, the data packet is added to the message queue and waits for delayed sending.

[0093] Step S302, determining the number of data packets allowed per second according to the preconfigured target bandwidth corresponding to the traffic type and the number of bytes occupied by each data packet.

[0094] Step S303, determining the maximum delay time of each data packet according to the number of data packets allowed per second and the unit time.

[0095] Specifically, the target bandwidth limit is usually expressed in bits per second (bps). For example, if the target bandwidth is 1Gbps, it is equivalent to 1,000,000,000 bits per second.

[0096] Convert the target bandwidth to the number of packets allowed per second. This can be done by dividing the total number of bits per second by the number of bits in a packet. For example, a typical Ethernet packet size might be 1500 bytes (12000 bits), so the number of packets allowed per second is:

[0097] The number of packets allowed per second = total bits per second / number of bits per packet = 1,000,000,000bps / 12000bps / packet ≈ 83,333 packets / second.

[0098] Calculate the time interval between each packet, that is, the delay between the arrival of each packet. This can be calculated by dividing 1 second by the number of packets allowed per second:

[0099] Delay per packet = 1 second / number of packets allowed per second = 1 second / 83,333 packets ≈ 0.0119 seconds or 11.9 milliseconds.

[0100] Step S304: Determine a new sending time of the data packet according to the current time and the maximum delay time.

[0101] Step S305, extracting and sending a data packet from the message queue at a new sending time.

[0102] Specifically, the maximum delay time is added to the current time to obtain the new sending time of the data packet. When the new sending time is reached, the data packet is sent.

[0103] In an optional example, even if the traffic is balanced by delaying the sending of data packets, it may still be impossible to fundamentally solve the network congestion problem and bandwidth may still be excessive. In this case, the method may further include:

[0104] Extract and discard the packet from the message queue.

[0105] In an optional example, when the time difference between the new sending time and the current time is greater than or equal to the second time threshold and less than the first time threshold, the method further includes:

[0106] A network congestion notification message is sent to the sending layer of the data packet to control the rate at which the sending layer sends the data packet. The network congestion notification message carries a field for explicit congestion notification. The field value corresponding to the ECN_HORIZON_NS field of the explicit congestion notification (ECN) is the preset time threshold, for example, 5 milliseconds. When it exceeds 5ms, the eBPF program will set the ECN (Explicit Congestion Notification) bit in the header of the IP data packet to notify the upper layer protocol of the current congestion status.

[0107] In an optional example, when calculating the new sending time, in addition to adding the current time and the maximum delay time, the sending timestamp of the previous data packet can also be considered. Based on the sending timestamp of the previous data packet, the maximum delay time is added as the new sending time of the data packet.

[0108] That is, if last_tstamp (the timestamp of the last data packet sent) exists, it is added to delay_ns to obtain next_tstamp (the timestamp of the next data packet sent).

[0109] If it does not exist, for example, the currently received data packet is the first data packet, of course, the current time can also be used as the new sending time.

[0110] Then, if next_tstamp is less than the current timestamp tstamp, it means that there is no need for delay, and it is allowed to pass and update flow_map. flow_map is a hash map used to record the timestamp of the traffic to track the time when the last packet was sent. The key of the mapping table is the traffic identifier (here 0), and the value is the timestamp (uint64_t type)

[0111] If next_tstamp-now exceeds TIME_HORIZON_NS (2s), the packet is discarded.

[0112] If next_tstamp-now exceeds ECN_HORIZON_NS, the ECN bit is set to signal network congestion.

[0113] In an optional example, when executing traffic speed limiting, the method may further include configuring a priority. That is, for different traffic types, the execution of the speed limiting policy is set according to the priority. For example, in some special application scenarios, the speed limiting policy can be set to be executed or not according to the actual situation. The specific setting can be implemented by modifying the DSCP (Differentiated Services Code Point) field of the data packet through eBPF to identify different service qualities.

[0114] The above content can be reflected in the form of a written eBPF program, and the written eBPF program is loaded into the Linux kernel to perform traffic classification and bandwidth limiting during data packet processing.

[0115] Finally, statistics for traffic classification and bandwidth control can also be logged for monitoring and troubleshooting purposes.

[0116] Figure 4 The overall flow chart of the above method is shown in the figure, in which the traffic type includes the traffic type corresponding to the TCP protocol and the traffic type corresponding to the UDP protocol as an example for explanation. The specific implementation process has been introduced in detail in the previous article, so it will not be repeated here.

[0117] In this embodiment, a bandwidth speed limiting device is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0118] This embodiment provides a bandwidth speed limiting device, such as Figure 5 As shown, it includes: an extraction module 501, a determination module 502, an identification module 503 and a processing module 504.

[0119] The extraction module 501 is used to extract triplet information from the data packet when the data packet to be transmitted is obtained for the first time in the current cycle, wherein the triplet information includes: data transmission protocol, source port, and destination port;

[0120] A determination module 502, configured to determine a traffic type corresponding to a data packet according to one or more elements in the triplet information;

[0121] The identification module 503 is used to identify, according to the traffic type, an occupied traffic bandwidth value corresponding to the traffic type and a traffic speed limit strategy corresponding to the traffic type, wherein the occupied traffic bandwidth value is a traffic bandwidth value that has been occupied before the current cycle;

[0122] The processing module 504 is used to take a speed limiting measure corresponding to the traffic type when it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limiting strategy; and process the data packet to be transmitted according to the speed limiting measure.

[0123] In an optional implementation, the traffic speed limit strategy includes a speed limit bandwidth value corresponding to the traffic type, or includes a speed limit bandwidth value and a speed limit ratio. The identification module 503 is specifically used to:

[0124] Compare the occupied traffic bandwidth value with the speed limit bandwidth value;

[0125] When the traffic speed limit policy includes a speed limit bandwidth value and a speed limit ratio, and when the occupied traffic bandwidth value is greater than the speed limit bandwidth value, the difference between the occupied traffic bandwidth value and the speed limit bandwidth value is calculated;

[0126] Determine the excess ratio based on the difference and the speed limit bandwidth value;

[0127] When it is determined that the excess ratio is greater than the speed limit ratio, it is determined that the occupied traffic bandwidth value does not comply with the traffic speed limit policy;

[0128] or,

[0129] When the occupied traffic bandwidth value is less than or equal to the speed limit bandwidth value, it is determined that the occupied traffic bandwidth value complies with the traffic speed limit policy;

[0130] Alternatively, when the traffic speed limit policy includes a speed limit bandwidth value corresponding to the traffic type, and when the occupied traffic bandwidth value is greater than the speed limit bandwidth value, it is determined that the occupied traffic bandwidth value does not comply with the traffic speed limit policy;

[0131] In an optional implementation, the processing module 504 is further configured to, when it is determined that the excess ratio is less than or equal to the speed limit ratio, determine that the occupied traffic bandwidth value complies with the traffic speed limit policy.

[0132] In an optional implementation, the processing module 504 is specifically configured to add the data packet to the message queue when the traffic type is a preset target type and it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limit policy;

[0133] Determine the number of packets allowed per second based on the preconfigured target bandwidth corresponding to the traffic type and the number of bytes occupied by each packet;

[0134] Determine the maximum delay time of each data packet based on the number of data packets allowed per second and the unit time;

[0135] Determine a new sending time of the data packet based on the current time and the maximum delay time;

[0136] Extract and send the data packet from the message queue at the new send time.

[0137] In an optional implementation, the processing module 504 is specifically configured to directly mark the data packet as discarded when the traffic type is not a preset target type and it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limit policy.

[0138] In an optional implementation, the processing module 504 is further configured to extract and discard a data packet from the message queue when the time difference between the new sending time and the current time is greater than a first time threshold.

[0139] In an optional embodiment, the device also includes a sending module 505, which is used to send a network congestion notification message to the sending layer of the data packet when the time difference between the new sending time and the current time is greater than or equal to the second time threshold and less than the first time threshold, so that the sending layer controls the rate of sending data packets, wherein the network congestion notification message carries a field for displaying the congestion notification.

[0140] The bandwidth speed limiting device in this embodiment is presented in the form of a functional module, where the module refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0141] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0142] A bandwidth speed limiting device provided by an embodiment of the present invention can achieve more sophisticated traffic management even if the speed limiting object is a single EIP because the traffic type is distinguished. Different speed limiting strategies and corresponding speed limiting measures can be executed according to different traffic types to provide more sophisticated traffic speed limiting control, which can ensure that the traffic speed limiting method is applicable to more application scenarios, provides high flexibility, can adapt to the ever-changing network environment and application requirements, and can greatly improve the user's network access experience. Moreover, different traffic types have different effects on network performance. Through the speed limiting strategy, the traffic that has a greater impact on network performance can be reduced, thereby improving the overall network performance. Through monitoring and speed limiting, it can also ensure that network resources are more effectively utilized and bandwidth waste is avoided, especially during high traffic periods. The speed limiting strategy can be automatically adjusted according to network conditions and traffic patterns, and can adapt to different network conditions. By limiting the packet rate of the traffic type, network congestion can be reduced and the reliability and speed of data packet transmission can be improved. By analyzing the bandwidth usage and speed limiting effects of different traffic types, network administrators can be helped to perform fault diagnosis and performance analysis. In summary, the method not only improves the efficiency and flexibility of network management, but also enhances the quality of network services and the overall experience of users.

[0143] The embodiment of the present invention also provides a computer device having the above Figure 5 Bandwidth rate limiting device shown.

[0144] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.

[0145] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0146] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0147] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0148] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0149] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0150] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0151] The computer device further comprises a communication interface 50 for the computer device to communicate with other devices or a communication network.

[0152] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0153] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A bandwidth speed limiting method, characterized in that: The method comprises: When a data packet to be transmitted is obtained for the first time in the current cycle, triplet information is extracted from the data packet, wherein the triplet information includes: data transmission protocol, source port, and destination port; Determine a traffic type corresponding to the data packet according to one or more elements in the triplet information; According to the traffic type, identifying an occupied traffic bandwidth value corresponding to the traffic type and a traffic speed limit strategy corresponding to the traffic type, wherein the occupied traffic bandwidth value is a traffic bandwidth value that has been occupied before the current period; When it is identified that the occupied traffic bandwidth value does not conform to the traffic speed limit strategy, taking a speed limit measure corresponding to the traffic type; The data packet to be transmitted is processed according to the rate limiting measure.

2. The method according to claim 1, characterized in that The traffic speed limit strategy includes a speed limit bandwidth value corresponding to the traffic type, or includes the speed limit bandwidth value and a speed limit ratio; Identify whether the occupied traffic bandwidth value complies with the traffic speed limit policy, including: Comparing the occupied traffic bandwidth value with the speed limit bandwidth value; When the traffic speed limit strategy includes the speed limit bandwidth value and the speed limit ratio, and when the occupied traffic bandwidth value is greater than the speed limit bandwidth value, calculating the difference between the occupied traffic bandwidth value and the speed limit bandwidth value; Determine the excess ratio according to the difference and the speed limit bandwidth value; When it is determined that the excess ratio is greater than the speed limit ratio, it is determined that the occupied traffic bandwidth value does not comply with the traffic speed limit policy; or, When the occupied traffic bandwidth value is less than or equal to the speed limit bandwidth value, determining that the occupied traffic bandwidth value complies with the traffic speed limit policy; Alternatively, when the traffic speed limit policy includes a speed limit bandwidth value corresponding to the traffic type, and when the occupied traffic bandwidth value is greater than the speed limit bandwidth value, it is determined that the occupied traffic bandwidth value does not comply with the traffic speed limit policy.

3. The method according to claim 2, characterized in that The method further comprises: When it is determined that the excess ratio is less than or equal to the speed limit ratio, it is determined that the occupied traffic bandwidth value complies with the traffic speed limit policy.

4. The method according to any one of claims 1 to 3, characterized in that: When the traffic type is a preset target type and it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limit strategy, a speed limit measure corresponding to the traffic type is taken, including: Adding the data packet to a message queue; Determining the number of packets allowed per second based on a preconfigured target bandwidth corresponding to the traffic type and the number of bytes occupied by each packet; Determine the maximum delay time of each data packet based on the number of data packets allowed per second and the unit time; Determine a new sending time of the data packet according to the current time and the maximum delay time; The data packet is extracted from the message queue and sent at the new sending time.

5. The method according to any one of claims 1 to 3, characterized in that: When the traffic type is not the preset target type and it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limit strategy, a speed limit measure corresponding to the traffic type is taken, including: The data packet is directly marked as discarded.

6. The method according to claim 4, characterized in that When the time difference between the new sending time and the current time is greater than a first time threshold, the method further includes: The data packet is extracted from the message queue and discarded.

7. The method according to claim 6, characterized in that The method further comprises: When the time difference between the new sending time and the current time is greater than or equal to the second time threshold and less than the first time threshold, a network congestion notification message is sent to the sending layer of the data packet so that the sending layer controls the rate of sending the data packet, wherein the network congestion notification message carries a field for displaying the congestion notification.

8. A bandwidth speed limiting device, characterized in that: The device comprises: An extraction module, configured to extract triplet information from a data packet to be transmitted when the data packet to be transmitted is obtained for the first time in a current cycle, wherein the triplet information includes: a data transmission protocol, a source port, and a destination port; A determination module, configured to determine a traffic type corresponding to the data packet according to one or more elements in the triplet information; An identification module, configured to identify, according to the traffic type, an occupied traffic bandwidth value corresponding to the traffic type and a traffic speed limit strategy corresponding to the traffic type, wherein the occupied traffic bandwidth value is a traffic bandwidth value that has been occupied before the current period; The processing module is used to take a speed limiting measure corresponding to the traffic type when it is identified that the occupied traffic bandwidth value does not comply with the traffic speed limiting strategy; and process the data packet to be transmitted according to the speed limiting measure.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the bandwidth speed limiting method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the bandwidth speed limiting method according to any one of claims 1 to 7.