Network card speed limiting method and device, readable storage medium and computer program product

By adopting a separate computing and processing path design in the network card, the latency and resource consumption problems in the network card rate limiting process are solved, achieving low latency and high precision rate limiting processing, and improving the system stability and resource utilization efficiency.

CN119728576BActive Publication Date: 2025-11-04CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411857963.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-11-04
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

In existing technologies, network interface cards (NICs) suffer from significant data packet processing latency and high hardware resource consumption, especially in network speed limiting, where excessive caching and processing lead to delays and resource consumption.

Method used

The design separates the calculation path and the processing path. The first path calculates and caches the rate limiting result of the packet data stream, while the second path performs rate limiting processing based on the cached rate limiting result set. This avoids the delay impact of the calculation path on the processing path and performs accurate rate limiting statistics before the data packet exits.

Benefits of technology

It reduces network path latency from milliseconds to nanoseconds, while also reducing hardware resource consumption and improving rate limiting accuracy and system robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728576B_ABST
    Figure CN119728576B_ABST
Patent Text Reader

Abstract

The application provides a network card speed limiting method and device, a readable storage medium and a computer program product. The method comprises the following steps: obtaining a packet data stream to be subjected to speed limiting processing, and inputting the packet data stream into a first path and a second path respectively; in the first path, calculating a packet speed limiting result corresponding to the packet data stream, and caching the packet speed limiting result to form a speed limiting cache result set; the packet speed limiting result is a result of discarding packet data or a result of retaining packet data; in the second path, performing corresponding speed limiting processing according to a cache result corresponding to current packet data in the speed limiting cache result set. The scheme of the application is isolated in design between a calculation path and a processing path, the calculation path does not affect the delay of the processing path, and is extremely remarkable in reducing the network path delay.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communication technology, specifically to a network card speed limiting method, device, readable storage medium, and computer program product. Background Technology

[0002] In current cloud computing services, to ensure the quality of service for multi-tenants, it is typically necessary to limit the network bandwidth and forwarding rate of individual cloud hosts. Currently, smart network interface cards (NICs) such as Data Processing Units (DPUs) have offloaded the rate-limiting function to dedicated chips or field-programmable gate arrays (FPGAs) for hardware processing. Because many network applications are highly sensitive to latency, reducing the packet processing latency of NICs is also a crucial goal in network traffic management. To provide a better user experience, the accuracy of network traffic rate limiting must also be within a certain margin of error.

[0003] Current network rate limiting requirements mainly focus on rationally planning the transmission sequence based on the network rate limit value and the length of the data packets to be forwarded. This ensures that the bandwidth within each unit of transmission time is utilized to the maximum extent without exceeding the bandwidth specified by the network rate limit value, avoiding network jitter and smoothing network traffic transmission. Common rate limiting functions have large caching modules for traffic buffering while simultaneously achieving traffic shaping and balancing. However, this approach also has the following drawbacks: Drawback 1: Excessive caching and processing during the process can lead to significant network latency; Drawback 2: Excessive caching consumes system storage resources; Drawback 3: In many cases, network data packets require packet length-related processing, such as removing or adding the outer Virtual Extended Local Area Network (VXLAN) protocol. If data packets are not statistically rate-limited at the data egress point, this error will be ignored, leading to a decrease in rate limiting accuracy. Summary of the Invention

[0004] At least one embodiment of this application provides a network card rate limiting method, apparatus, readable storage medium, and computer program product to solve the problems in the prior art where excessive packet caching leads to increased hardware resource consumption, and excessive waiting also leads to increased latency.

[0005] To solve the above-mentioned technical problems, this application is implemented as follows:

[0006] In a first aspect, embodiments of this application provide a network card speed limiting method, including:

[0007] Obtain the packet data stream to be rate-limited, and input the packet data stream into the first path and the second path respectively;

[0008] In the first path, the rate limiting result corresponding to the packet data stream is calculated, and the rate limiting result is cached to form a rate limiting cache result set; the packet rate limiting result is either the result of discarding packet data or the result of retaining packet data;

[0009] In the second path, the corresponding rate limiting process is performed based on the cache result corresponding to the current group data in the rate limiting cache result set.

[0010] Optionally, in the first path, the rate limiting result corresponding to the packet data stream is calculated, and the packet rate limiting result is cached to form a rate limiting cache result set, including:

[0011] In the first path, group data statistics are performed on the group data in the group data stream to determine the statistical results;

[0012] Calculate the packet rate limiting result corresponding to each group of data packets in the statistical results;

[0013] The rate limiting results for each group are cached to form a rate limiting cache result set.

[0014] Optionally, after caching the grouped rate limiting results to form a rate limiting cache result set, the method further includes:

[0015] A timed clearing is set for all group rate limiting results or target group rate limiting results in the rate limiting cache result set; the timed clearing is used to set the current result as the result that retains the group data; the target group rate limiting result is one of the group results among all the group rate limiting results.

[0016] After the timed clearing, the corresponding grouped rate limiting result is updated in the rate limiting cache result set.

[0017] Optionally, perform grouped data statistics on the second group of data to determine the statistical results, including:

[0018] Based on the output rate, the packet data in the packet data stream is statistically analyzed according to packet data and packet length to determine the statistical results; the statistical results include real-time output results or preset duration output results.

[0019] The real-time output result is used to represent the statistical results containing the number of packets and the actual packet length; the preset duration output result is used to represent the statistical results of the grouped data within the preset duration, and does not contain actual data packets.

[0020] Optionally, the calculation of the packet rate limiting result corresponding to each group of data packets in the statistical results includes:

[0021] Calculate whether the rate and bandwidth of each group of data packets exceed the preset rate limit;

[0022] If the preset rate limit value is exceeded, the rate limit result for the current data packet is determined to be to discard the packet data;

[0023] If the preset rate limit value is not exceeded, the rate limit result of the current data packet is determined to be the result of retaining the packet data.

[0024] Optionally, the process involves acquiring the packet data stream to be rate-limited and inputting the packet data stream into the first path and the second path, respectively, including:

[0025] Obtain the packet data stream to be rate-limited;

[0026] Based on the network device number to which each group of data in the packet data stream to be rate-limited belongs, the mapping is performed to obtain the mapped packet information; the packet information includes the group number and the group data corresponding to the group number.

[0027] The grouping information is input into the first path and the second path respectively.

[0028] Optionally, in the second path, based on the cached result corresponding to the current group data in the rate-limiting cache result set, corresponding rate-limiting processing is performed, including:

[0029] In the second path, if the current group data is the first group data, then the first cached result corresponding to the current group data is determined to be the result of retaining the group data, and the operation of outputting the current group data is performed; or,

[0030] In the second path, if the current group data is not the first group data, the second cache result corresponding to the current group data is determined according to the rate-limited cache result set;

[0031] If the second cache result indicates that the group data should be discarded, then the operation of discarding the current group data corresponding to the second cache result is performed.

[0032] If the second cached result indicates that the group data is to be retained, then the operation of outputting the current group data corresponding to the first cached result is performed.

[0033] Secondly, embodiments of this application also provide a network card speed limiting device, comprising:

[0034] The first acquisition module is used to acquire the packet data stream to be rate-limited and input the packet data stream into the first path and the second path respectively.

[0035] The first processing module is configured to calculate the rate limiting result corresponding to the packet data stream in the first path, cache the rate limiting result to form a rate limiting cache result set; the packet rate limiting result is either the result of discarding packet data or the result of retaining packet data;

[0036] The second processing module is used to perform corresponding rate limiting processing in the second path based on the cache result corresponding to the current group data in the rate limiting cache result set.

[0037] Thirdly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the network card speed limiting method described above.

[0038] Fourthly, embodiments of this application also provide a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the network card speed limiting method described above.

[0039] Compared with the prior art, the network card rate limiting method, apparatus, readable storage medium, and computer program product provided in this application embodiment include: acquiring a packet data stream to be rate-limited; inputting the packet data stream into a first path and a second path respectively; calculating the packet rate limiting result corresponding to the packet data stream in the first path and caching the packet rate limiting result to form a rate limiting cache result set; and performing corresponding rate limiting processing according to the cache result corresponding to the current packet data in the rate limiting cache result set in the second path. This application isolates the calculation path and the processing path. The first path is the calculation path, and the second path is the processing path. Both paths are processed independently, and the calculation path does not affect the processing path latency, which is extremely significant for reducing network path latency. Attached Figure Description

[0040] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0041] Figure 1 A flowchart of the network card speed limiting method provided in the embodiments of this application;

[0042] Figure 2 A schematic diagram showing the location of the network card speed limiting function provided in this application embodiment in the smart network card;

[0043] Figure 3 This is a structural diagram of the network card speed limiting system provided in the embodiments of this application;

[0044] Figure 4 A flowchart illustrating the computation path provided in the embodiments of this application;

[0045] Figure 5 A flowchart illustrating the processing path provided in the embodiments of this application;

[0046] Figure 6 This is a structural diagram of the network card speed limiting device provided in the embodiments of this application. Detailed Implementation

[0047] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.

[0048] The terms “first,” “second,” etc., used in the specification and claims of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus. The terms “and / or” in the specification and claims indicate at least one of the connected objects.

[0049] This application provides a network card speed limiting method, apparatus, readable storage medium, and computer program product. The method and apparatus are based on the same concept, and since the principles by which they solve the problem are similar, their implementations can be referred to interchangeably; repeated details will not be repeated.

[0050] Please refer to Figure 1 This application provides a network card speed limiting method, including:

[0051] Step 11: Obtain the packet data stream to be rate-limited, and input the packet data stream into the first path and the second path respectively;

[0052] Step 12: In the first path, calculate the rate limiting result corresponding to the packet data stream, and cache the rate limiting result to form a rate limiting cache result set; the packet rate limiting result is either the result of discarding packet data or the result of retaining packet data;

[0053] Step 13: In the second path, perform the corresponding rate limiting process according to the cache result corresponding to the current group data in the rate limiting cache result set.

[0054] In this embodiment, the first path and the second path are two separate processing paths. The first path is used to calculate the rate-limiting result for the packet data stream to be rate-limited, and cache the rate-limiting result to form a rate-limiting cache result set, which stores multiple packet rate-limiting results. The second path is used to match the packet data stream with the cached result corresponding to the current packet data in the rate-limiting cache result set and execute the corresponding rate-limiting process. The second path only needs to match the corresponding cached result, eliminating the calculation process. This application isolates the calculation path from the processing path, reducing module dependency and coupling, improving system robustness, and ensuring that the calculation path does not affect the latency of the processing path.

[0055] It should be noted that hardware processing is quite sensitive to resource consumption, and excessive caching will also increase hardware costs. (Refer to...) Figure 2 As shown, the rate limiting function involved in this application is located at the data flow position of the smart network card, right at the network data traffic exit. The statistical data is the final data to be sent, which is also the application layer data packet closest to the one received by the peer device. Statistical data collection before the exit is more accurate than processing in the traditional scheduling module because the data packet processing module typically involves data packet operations. Network data packet processing often involves changes in packet length, such as adding and deleting VXLAN protocol headers. For a 64-byte packet, adding or deleting a 50-byte VXLAN header will introduce approximately 78% (50 / 64) of bandwidth error. Therefore, performing data packet statistical rate limiting after all packet processing actions are completed and before the data is about to be output to the network card is one way to improve rate limiting accuracy.

[0056] Common QoS (Quality of Service) functions combine rate limiting with packet processing scheduling modules. The main purpose is to shape network traffic, but the processed data is not the final result of the packet processing, so it contains a certain amount of error.

[0057] In an optional embodiment, step 13 described above includes:

[0058] In the second path, if the current group data is the first group data, then the first cached result corresponding to the current group data is determined to be the result of retaining the group data, and the operation of outputting the current group data is performed; or,

[0059] In the second path, if the current group data is not the first group data, the second cache result corresponding to the current group data is determined according to the rate-limited cache result set;

[0060] If the second cache result indicates that the group data should be discarded, then the operation of discarding the current group data corresponding to the second cache result is performed.

[0061] If the second cached result indicates that the group data is to be retained, then the operation of outputting the current group data corresponding to the first cached result is performed.

[0062] In this embodiment, since the packet data stream to be rate-limited is input into the second path, the cached results corresponding to the current packet data are all calculated and saved in the rate-limiting cache result set in the previous cycle. Therefore, in order to avoid the first group of data in the packet data stream to be rate-limited needing to wait for the calculation process, this application designs a method where if the current packet data is the first group of data, the first cached result corresponding to the current packet data is determined to be the result of retaining the packet data, and the operation of outputting the current packet data is performed, further reducing the waiting time.

[0063] In the second path, if the current group data is not the first group data, then query the rate-limited cache result set to determine the second cache result corresponding to the current group data; if the second cache result indicates that the group data is to be discarded, then perform the operation of discarding the current group data corresponding to the second cache result; if the second cache result indicates that the group data is to be retained, then perform the operation of outputting the current group data corresponding to the first cache result.

[0064] Optionally, drop can be used to indicate discarding, and keep can be used to indicate retention.

[0065] Optionally, step 12 above includes:

[0066] In the first path, group data statistics are performed on the group data in the group data stream to determine the statistical results;

[0067] Calculate the packet rate limiting result corresponding to each group of data packets in the statistical results;

[0068] The rate limiting results for each group are cached to form a rate limiting cache result set.

[0069] In this embodiment, packet data from the packet data stream is input into the packet configuration information input interface for packet data statistics to determine the statistical results. The output statistical results are the packet results corresponding to the data packets and the original input data packets. This logical processing has no actual delay time. The packet rate limiting result corresponding to each group of data packets in the statistical results is calculated, and then each group of packet rate limiting results is cached to form a rate limiting cache result set. This rate limiting cache result set can be used to directly match the corresponding rate limiting cache result when the next data packet is input. This application can achieve direct matching of the corresponding rate limiting cache result when the data is input again through the rate limiting cache result set, saving the calculation time of the current data packet.

[0070] Specifically, perform grouped data statistics on the second group of data and determine the statistical results, including:

[0071] Based on the output rate, the packet data in the packet data stream is statistically analyzed according to packet data and packet length to determine the statistical results; the statistical results include real-time output results or preset duration output results.

[0072] The real-time output result is used to represent the statistical results containing the number of packets and the actual packet length; the preset duration output result is used to represent the statistical results of the grouped data within the preset duration, and does not contain actual data packets.

[0073] In this embodiment, preliminary statistics are performed on the packet data in the input packet data stream. The statistical results include packet count and packet length statistics. The output rate is configurable, and can be set to real-time output or fixed-time output. Real-time output is the statistical result of the current packet data (in the example, the statistical result indicates that the packet count is 1 and the packet length is the actual packet length). Fixed-time output is the statistical result of the packet data within a configured time period. By performing preliminary statistics on the packet data and saving only the statistical results without saving the actual data packets, cache resources are saved, and the performance requirements for the subsequent rate-limiting calculation module are reduced. The delay in determining the statistical results in this application is determined by the configured time (the configuration time is generally in the millisecond range).

[0074] Optionally, after step 12 above, the method further includes:

[0075] A timed clearing is set for all group rate limiting results or target group rate limiting results in the rate limiting cache result set; the timed clearing is used to set the current result as the result that retains the group data; the target group rate limiting result is one of the group results among all the group rate limiting results.

[0076] After the timed clearing, the corresponding grouped rate limiting result is updated in the rate limiting cache result set.

[0077] In this embodiment, to avoid situations where a single data packet has no data packet input for an extended period, but the processing result of the last data packet is "discard," theoretically, this data packet should not be discarded. Therefore, a timed clearing function for packet rate limiting information is designed. This involves setting a timed clearing period for all packet rate limiting results or the target packet rate limiting result in the rate limiting cache result set. The packet rate limiting information clearing function can be configured to clear all packets uniformly or clear individual packets periodically. To save resources, this application uses a single timer for all packets to implement the timed clearing of the flag.

[0078] Optionally, the packet rate limiting result corresponding to each group of data packets in the statistical results is calculated, including:

[0079] Calculate whether the rate and bandwidth of each group of data packets exceed the preset rate limit;

[0080] If the preset rate limit value is exceeded, the rate limit result for the current data packet is determined to be to discard the packet data;

[0081] If the preset rate limit value is not exceeded, the rate limit result of the current data packet is determined to be the result of retaining the packet data.

[0082] In this application embodiment, rate limiting calculation can be implemented in various ways. The common algorithm is the token bucket implementation, and the latency of different algorithms is different. The processing time is generally tens of clocks ("clock" usually refers to the basic time unit of the processor or system, which controls the rhythm of operation, resulting in a delay of several microseconds (µs). This application calculates whether the rate and bandwidth of each group of data packets exceed the preset configured rate limit value. The result is whether the group of data packets exceeds the preset configured rate limit value. If it exceeds the preset configured rate limit value, the rate limiting result is dropped, otherwise it is kept.

[0083] This application provides a specific embodiment, with reference to... Figure 3 The disclosed network interface card (NIC) rate limiting system includes: a packet configuration mapping module 1, a data packet statistics module 2, a rate limiting calculation module 3, a rate limiting result caching module 4, and a rate limiting result processing module 5. The packet configuration mapping module 1 of this application is used to process step 11 described above; the data packet statistics module 2, the rate limiting calculation module 3, and the rate limiting result caching module 4 jointly implement step 12; and the rate limiting result caching module 4 and the rate limiting result processing module 5 jointly implement step 13.

[0084] Specifically, the group configuration mapping module 1 takes the input interface of the data packet to be rate-limited and the input interface of the group configuration information as input, and outputs the group result corresponding to the data packet and the original input data packet. This module uses combinational logic processing and has no actual latency. This module is responsible for storing the group information configured by the management layer. When a data packet passes through this module, the network device number in the user interface information carried by the data packet (in cloud computing, there are usually many users, and each user is usually set up as a group. A single user or a single group may have multiple network devices. The rate-limiting result is statistically processed for all network devices in a single group. Different rate-limiting information can be configured for different user groups) is mapped to the corresponding group result.

[0085] Packet Statistics Module 2: This module performs preliminary statistics on the input packet data, including packet count and packet length statistics. The output rate is configurable, allowing for real-time or fixed-time output. Real-time output displays the statistics for the current packet (in the example, the count is 1 packet and the packet length is the actual length). Fixed-time output displays the statistics for the packet data within a configured time period. By performing preliminary statistics on the packet data and saving only the results without storing the actual packets, cache resources are saved, reducing the performance requirements for subsequent rate-limiting calculation modules. The latency of this module is determined by the configured time (typically in the millisecond range).

[0086] Rate limit calculation module 3: There are multiple ways to implement rate limit calculation. The common algorithm is the token bucket implementation. Different algorithms have different delays (generally, the processing time is tens of clocks, resulting in a delay of several microseconds). The result is whether the packet exceeds the configured rate limit value. If it exceeds the rate limit value, the output rate limit result is drop and discard; otherwise, it is keep.

[0087] Rate limiting result caching module 4: The rate limiting result for the corresponding group output by rate limiting calculation module 3 is input to this module. This module caches the latest rate limiting results for all groups. When group configuration mapping module 1 outputs group information to this module, the processing result (discard or allow) of the original data packet is obtained by reading the latest rate limiting result for the corresponding group. The RAM read latency of this module is 2 clock cycles. To avoid a situation where a single group of data has no data packet input for a long time, but the processing result of the last data packet is discard, theoretically, the data packet should not be discarded. Therefore, this module is designed with a timed clearing function for group rate limiting information. The group rate limiting information clearing function can be configured to clear all groups uniformly or clear a single group at a timed interval. In this application, to save resources, all groups share a single timer to implement the timed clearing of the flag. The timed clearing function does not affect the latency of this module.

[0088] Rate limiting result processing module 5: Based on the rate limiting result output by rate limiting result caching module 4, it processes the current original data packet. If the rate limiting result is to discard, the data packet is discarded directly without being output. If the rate limiting result is to allow, the original data packet is output directly. The processing delay of this module is 1 clock (clock is the system processing clock. If the system clock is 200MHz, then a single clock is 5ns).

[0089] In summary, compared with the conventional processing in the prior art, this application innovatively processes the step with the greatest latency independently. The actual data packet processing flow can be realized through the group configuration mapping module 1, the rate limiting result caching module 4, and the rate limiting result processing module 5, reducing the millisecond-level latency of the traditional rate limiting function to the nanosecond level. At the same time, without any data packet caching design, resource consumption is significantly reduced.

[0090] This application defines the processing path of the group configuration mapping module 1, the data packet statistics module 2, the rate limiting calculation module 3, and the rate limiting result caching module 4 as the first path mentioned above, i.e., the calculation path; and defines the processing path of the group configuration mapping module 1, the rate limiting result caching module 4, and the rate limiting result processing module 5 as the second path mentioned above, i.e., the processing path. The calculation path and the processing path are processed independently and are not affected by each other's latency.

[0091] Optionally, step 11 above includes:

[0092] Obtain the packet data stream to be rate-limited;

[0093] Based on the network device number to which each group of data in the packet data stream to be rate-limited belongs, the mapping is performed to obtain the mapped packet information; the packet information includes the group number and the group data corresponding to the group number.

[0094] The grouping information is input into the first path and the second path respectively.

[0095] In this embodiment, after obtaining the packet data stream to be rate-limited, mapping is performed based on the network device number to which each group of data in the packet data stream belongs. For example, information such as queue number / NIC number / PF / VF is used for mapping the groups, and the mapped group information is obtained. The group information includes the group number and the group data corresponding to the group number. Further, the group information is input into the first path and the second path respectively, so as to enable subsequent independent calculation or processing in the two paths.

[0096] For specific details regarding the processing steps in the first path, please refer to... Figure 4 As shown, the specific process includes:

[0097] The data synchronization input includes a packet configuration mapping array module and a length statistics module, which perform synchronization processing. The packet configuration mapping array module maps the network device number (queue number / NIC number / PF / VF, etc.) to the packet's group information. The length statistics module performs length calculations on the packets. After processing by these modules, the statistical results for the corresponding packet data can be obtained immediately in real-time output mode. In fixed-time output mode, statistical results for a specified period can be output after a configured time, including packet counts and packet length statistics.

[0098] The statistical results are input into the rate limiting result calculation module. The rate limiting result calculation generally includes two calculations: PPS packet rate and bps bandwidth. The calculation method is implemented using a multi-level token bucket. After calculation, the statistical output is either keep or drop the result.

[0099] Packet information and its rate-limiting results are input into the rate-limiting result caching module for caching. The path to be processed uses this result to process data packets. At the same time, the rate-limiting result caching module includes a timed clearing module, which clears the rate-limiting results according to the set time. All packet rate-limiting results are cleared to keep, avoiding the discarding of the first packet data when the rate-limiting results have not been updated for a long time.

[0100] Furthermore, referring to Figure 5 As shown, the processing procedure in the second path of this application specifically includes:

[0101] The data stream of the packet to be rate-limited is input into the packet configuration mapping array to obtain the packet number output by the packet configuration mapping array. The packet number is then input into the second path. After the rate-limiting result is read from the cache, the cache result corresponding to the current packet data is read, and the corresponding keep or drop result is obtained. The rate-limiting result is input into the rate-limiting result data packet processing module to perform keep or drop operations. The processed data packet is then output to the rate-limiting result data packet processing module, completing the rate-limiting process.

[0102] In summary, this application isolates the computation path from the processing path, reducing module dependencies and coupling, thus improving system robustness. The computation path does not affect the processing path latency. The low-latency design method for the processing path significantly reduces network path latency, from the common millisecond level to the nanosecond level. The periodic clearing design of the computation path avoids abnormal data loss of the first packet. The statistics module has no cache design, and neither the computation path nor the processing path has a data packet cache design, resulting in lower resource consumption in hardware acceleration scenarios. The rate limiting processing module is located at the front end of the data exit, which can improve the accuracy of rate limiting.

[0103] Reference Figure 6As shown, this application also provides a network card speed limiting device, including:

[0104] The first acquisition module 61 is used to acquire the packet data stream to be speed-limited and input the packet data stream into the first path and the second path respectively.

[0105] The first processing module 62 is used to calculate the packet rate limiting result corresponding to the packet data stream in the first path, cache the packet rate limiting result, and form a rate limiting cache result set; the packet rate limiting result is either the result of discarding packet data or the result of retaining packet data;

[0106] The second processing module 63 is used to perform corresponding rate limiting processing in the second path based on the cache result corresponding to the current group data in the rate limiting cache result set.

[0107] Optionally, the first processing module 62 described above includes:

[0108] The first determining unit is used to perform group data statistics on the group data in the group data stream in the first path and determine the statistical results;

[0109] The first calculation unit is used to calculate the group rate limiting result corresponding to each group of data packets in the statistical results;

[0110] The first processing unit is used to cache each group of rate limiting results to form a rate limiting cache result set.

[0111] Optionally, the network card speed limiting device of this application further includes:

[0112] The third processing module is used to set a timed clearing for all grouped rate limiting results or target grouped rate limiting results in the rate limiting cache result set; the timed clearing is used to set the current result as the result that retains the grouped data; the target grouped rate limiting result is one of the grouped rate limiting results in all the grouped rate limiting results.

[0113] The fourth processing module is used to update the corresponding grouped rate limiting result in the rate limiting cache result set after the timed clearing.

[0114] Optionally, the first determining unit described above is specifically used for:

[0115] Based on the output rate, the packet data in the packet data stream is statistically analyzed according to packet data and packet length to determine the statistical results; the statistical results include real-time output results or preset duration output results.

[0116] The real-time output result is used to represent the statistical results containing the number of packets and the actual packet length; the preset duration output result is used to represent the statistical results of the grouped data within the preset duration, and does not contain actual data packets.

[0117] Optionally, the first calculation unit described above is specifically used for:

[0118] Calculate whether the rate and bandwidth of each group of data packets exceed the preset rate limit;

[0119] If the preset rate limit value is exceeded, the rate limit result for the current data packet is determined to be to discard the packet data;

[0120] If the preset rate limit value is not exceeded, the rate limit result of the current data packet is determined to be the result of retaining the packet data.

[0121] Optionally, the first acquisition module 61 described above includes:

[0122] The acquisition unit is used to acquire the packet data stream to be rate-limited.

[0123] The second processing unit is used to map the network device number to which each group of data in the packet data stream to be rate-limited belongs, and to obtain the mapped packet information; the packet information includes the group number and the group data corresponding to the group number.

[0124] The third processing unit is used to input the grouping information into the first path and the second path respectively.

[0125] Optionally, the second processing module 63 described above includes:

[0126] The fourth processing unit is configured to, in the second path, if the current group data is the first group data, determine that the first cached result corresponding to the current group data is the result of retaining the group data, and perform the operation of outputting the current group data; or,

[0127] The fifth processing unit is used to determine the second cache result corresponding to the current group data based on the rate-limited cache result set if the current group data is not the first group data in the second path.

[0128] The sixth processing unit is configured to, when the second cache result indicates that the packet data is to be discarded, perform the operation of discarding the current packet data corresponding to the second cache result;

[0129] The seventh processing unit is configured to, when the second cache result indicates that the packet data is to be retained, perform the operation of outputting the current packet data corresponding to the first cache result.

[0130] It should be noted that the device in this embodiment corresponds to the device applied to the network card speed limiting method described above. The implementation methods in the above embodiments are all applicable to the embodiments of this device and can achieve the same technical effect. The device provided in this application embodiment can implement all the method steps implemented in the above method embodiments and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiments and the beneficial effects will not be described in detail.

[0131] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the above-described network card speed limiting method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0132] This application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the above-described... Figure 1 The various processes of the method embodiments shown can achieve the same technical effect, and will not be described again here to avoid repetition.

[0133] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0134] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0135] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for limiting network card speed, characterized in that, include: Acquiring a packet data stream to be rate-limited and inputting the packet data stream into a first path and a second path respectively includes: acquiring the packet data stream to be rate-limited; mapping the network device number to which each group of data in the packet data stream to be rate-limited belongs, and acquiring the mapped packet information; the packet information includes a group number and the group data corresponding to the group number; and inputting the packet information into the first path and the second path respectively. In the first path, the rate limiting result corresponding to the packet data stream is calculated, and the rate limiting result is cached to form a rate limiting cache result set; the packet rate limiting result is either the result of discarding packet data or the result of retaining packet data; In the second path, based on the cache result corresponding to the current group data in the rate-limiting cache result set, corresponding rate-limiting processing is performed, including: in the second path, if the current group data is the first group data, then the first cache result corresponding to the current group data is determined to be the result of retaining the group data, and the operation of outputting the current group data is performed; in the second path, if the current group data is not the first group data, the second cache result corresponding to the current group data is determined based on the rate-limiting cache result set; if the second cache result indicates that the group data is to be discarded, the operation of discarding the current group data corresponding to the second cache result is performed; if the second cache result indicates that the group data is to be retained, the operation of outputting the current group data corresponding to the first cache result is performed.

2. The method according to claim 1, characterized in that, In the first path, the rate limiting result corresponding to the packet data stream is calculated, and the packet rate limiting result is cached to form a rate limiting cache result set, including: In the first path, group data statistics are performed on the group data in the group data stream to determine the statistical results; Calculate the packet rate limiting result corresponding to each group of data packets in the statistical results; The rate limiting results for each group are cached to form a rate limiting cache result set.

3. The method according to claim 1, characterized in that, After caching the grouped rate limiting results to form a rate limiting cache result set, the method further includes: A timed clearing is set for all group rate limiting results or target group rate limiting results in the rate limiting cache result set; the timed clearing is used to set the current result as the result that retains the group data; the target group rate limiting result is one of the group results among all the group rate limiting results. After the timed clearing, the corresponding grouped rate limiting result is updated in the rate limiting cache result set.

4. The method according to claim 2, characterized in that, In the first path, group data statistics are performed on the group data in the group data stream to determine the statistical results, including: A preliminary statistical analysis is performed on the packet data in the packet data stream to obtain statistical results including packet quantity statistics and packet length statistics. The output rate of the statistical results is set to real-time output or fixed-time output. The real-time output includes the number of packets and the actual packet length of the current data; the fixed-time output is the statistical result of the grouped data within the configured time period, which only saves the statistical result and not the actual data packets.

5. The method according to claim 2, characterized in that, The calculation of the packet rate limiting result corresponding to each group of data packets in the statistical results includes: Calculate whether the rate and bandwidth of each group of data packets exceed the preset rate limit; If the preset rate limit value is exceeded, the rate limit result for the current data packet is determined to be to discard the packet data; If the preset rate limit value is not exceeded, the rate limit result of the current data packet is determined to be the result of retaining the packet data.

6. A network card speed limiting device, characterized in that, include: The first acquisition module is used to acquire the packet data stream to be rate-limited and input the packet data stream into the first path and the second path respectively. The first acquisition module includes: an acquisition unit for acquiring a packet data stream to be rate-limited; a second processing unit for mapping the network device number to which each group of data in the packet data stream to be rate-limited belongs, and acquiring mapped packet information; the packet information includes a group number and the group data corresponding to the group number; and a third processing unit for inputting the packet information into a first path and a second path respectively. The first processing module is configured to calculate the packet rate limiting result corresponding to the packet data stream in the first path, and cache the packet rate limiting result to form a rate limiting cache result set; the packet rate limiting result is either the result of discarding packet data or the result of retaining packet data; The second processing module is used to perform corresponding rate limiting processing in the second path based on the cache result corresponding to the current group data in the rate limiting cache result set; The second processing module includes: a fourth processing unit, configured to, in the second path, if the current group data is the first group data, determine that the first cache result corresponding to the current group data is the result of retaining the group data, and perform the operation of outputting the current group data; a fifth processing unit, configured to, in the second path, if the current group data is not the first group data, determine the second cache result corresponding to the current group data according to the rate-limited cache result set; a sixth processing unit, configured to, if the second cache result indicates that the group data is to be discarded, perform the operation of discarding the current group data corresponding to the second cache result; and a seventh processing unit, configured to, if the second cache result indicates that the group data is to be retained, perform the operation of outputting the current group data corresponding to the first cache result.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the network card speed limiting method as described in any one of claims 1 to 5.

8. A computer program product, characterized in that, It includes computer instructions, which, when executed by a processor, implement the steps of the network card speed limiting method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Multi-path cross-protocol transmission data packet scheduling method and system

    CN110662256A

  • Encrypted message speed limiting method and device based on DPU

    CN117255061A