Descriptor filling method and device, electronic equipment, medium and program product
By monitoring the network card driver's descriptor consumption rate and system memory pressure in real time and dynamically adjusting the filling threshold, the problem of the network card driver's descriptor filling timing not adapting to changes in system state is solved, improving system performance stability and network throughput, and reducing packet loss rate and CPU overhead.
Patent Information
- Application Number
- CN202511870300.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-03-03
AI Technical Summary
In existing technologies, network card driver descriptor filling uses a fixed threshold control, which is difficult to adapt to dynamic changes in system operating status, resulting in unstable system performance, including problems such as resource waste, packet loss, increased latency, and CPU resource waste.
By monitoring the descriptor consumption rate of the network card driver and the system memory pressure in real time, the filling threshold is dynamically adjusted to ensure that the network card driver fills descriptors at the appropriate time. This includes dynamically adjusting the filling threshold based on multiple preset factors and adjustment rules to ensure that the system can run effectively under both high and low traffic conditions.
By monitoring and dynamically adjusting the filling threshold in real time, the system overcomes the instability of system performance caused by fixed thresholds, improves the system's adaptability, reduces packet loss rate and CPU overhead, and enhances network throughput and latency performance.
Smart Images

Figure CN121603476A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a descriptor filling method, apparatus, electronic device, medium, and program product. Background Technology
[0002] The network interface card (NIC) driver and the NIC communicate through a collinear data structure called the operation descriptor ring. During data transmission via the NIC's descriptors, the driver needs to reclaim used descriptors generated by the NIC and refill them with new descriptors available for the NIC's use. The timing of descriptor filling by the NIC driver is crucial, and it is typically controlled by setting a fixed threshold.
[0003] In implementing the concept of this disclosure, those skilled in the art have found that using a fixed threshold to control the descriptor filling of the network card driver is difficult to adapt to the dynamic changes in the system's operating state, leading to system performance instability. Summary of the Invention
[0004] In view of this, the present disclosure provides a descriptor filling method, apparatus, electronic device, medium, and program product.
[0005] One aspect of this disclosure provides a descriptor filling method, comprising: in response to a network interface card (NIC) transmitting data through descriptors of a NIC driver, determining the descriptor consumption rate of the currently polled NIC using descriptors; in response to a descriptor consumption rate not meeting a preset rate range, dynamically adjusting the filling threshold of the previously polled NIC driver to obtain a target filling threshold for the current polling, wherein the target filling threshold represents a baseline number of idle descriptors in the currently polled NIC driver; and in response to a number of idle descriptors in the currently polled NIC driver being greater than the target filling threshold for the current polling, performing a descriptor filling operation on the NIC driver.
[0006] According to embodiments of this disclosure, in response to a descriptor consumption rate not meeting a preset rate range, the filling threshold of the network card driver in the previous polling is dynamically adjusted to obtain the target filling threshold for the current polling, including: in response to a descriptor consumption rate not meeting a preset rate range, dynamically adjusting the filling threshold of the network card driver in the previous polling to obtain the basic filling threshold for the current polling; and in response to a system memory pressure not meeting a preset memory pressure range, dynamically adjusting the basic filling threshold for the current polling based on a first preset adjustment factor to obtain the target filling threshold for the current polling.
[0007] According to embodiments of this disclosure, in response to the system memory pressure not meeting a preset memory pressure range, the basic fill threshold for the current polling is dynamically adjusted based on a first preset adjustment factor to obtain a target fill threshold for the current polling. The method further includes: in response to the system memory pressure not meeting a preset memory pressure range, dynamically adjusting the basic fill threshold for the current polling based on a first preset adjustment factor to obtain a first intermediate fill threshold for the current polling; determining the fill success rate of the descriptor fill operation using the total number of successfully filled descriptors and the total number of descriptors attempted to be filled in historical pollings, as counted by a counter in the network card driver; and in response to the fill success rate not meeting a preset success rate range, dynamically adjusting the first intermediate fill threshold based on a second preset adjustment factor to obtain a target fill threshold for the current polling.
[0008] According to embodiments of this disclosure, in response to the fill success rate not meeting a preset success rate range, the first intermediate fill threshold is dynamically adjusted based on a second preset adjustment factor to obtain the target fill threshold for the current polling. The method further includes: in response to the fill success rate not meeting a preset success rate range, the first intermediate fill threshold is dynamically adjusted based on a second preset adjustment factor to obtain the second intermediate fill threshold for the current polling; and the base fill threshold, the first intermediate fill threshold, and the second intermediate fill threshold are smoothed to obtain the target fill threshold for the current polling.
[0009] According to embodiments of this disclosure, determining the descriptor consumption rate of the currently polled network interface card (NIC) using descriptors includes: determining the number of descriptors used by the NIC in the previous polling when transmitting data through the NIC driver's descriptors and the previous polling timestamp; determining the number of descriptors used by the currently polled NIC when transmitting data through the NIC driver's descriptors and the current polling timestamp; calculating the time difference based on the current polling timestamp and the migration polling timestamp; and determining the descriptor consumption rate of the currently polled NIC using descriptors based on the number of descriptors used in the previous polling, the number of descriptors used in the current polling, and the time difference.
[0010] According to embodiments of this disclosure, the method further includes: pausing descriptor filling operations for the network card driver in response to the current polling of the number of idle descriptors being less than or equal to the target filling threshold of the current polling.
[0011] According to embodiments of this disclosure, the method further includes: updating the descriptor filling success rate in response to the filling result when performing a descriptor filling operation on the network card driver.
[0012] Another aspect of this disclosure provides a descriptor filling apparatus, comprising: a consumption rate determination module, configured to determine the descriptor consumption rate of the currently polled network card using descriptors during data transmission via descriptors of the network card driver; a threshold acquisition module, configured to dynamically adjust the filling threshold of the previously polled network card driver in response to the descriptor consumption rate not meeting a preset rate range, to obtain a target filling threshold for the current polling, wherein the target filling threshold represents a baseline number of idle descriptors in the currently polled network card driver; and a descriptor filling module, configured to perform a descriptor filling operation on the network card driver in response to the number of idle descriptors in the currently polled network card driver being greater than the target filling threshold for the current polling.
[0013] Another aspect of this disclosure provides an electronic device comprising:
[0014] One or more processors;
[0015] Memory, used to store one or more programs.
[0016] Specifically, when one or more programs are executed by one or more processors, the one or more processors implement the above method.
[0017] Another aspect of this disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, are used to implement the methods described above.
[0018] Another aspect of this disclosure provides a computer program product including computer-executable instructions that, when executed, are used to implement the methods described above.
[0019] According to embodiments of this disclosure, by real-time monitoring of the descriptor consumption rate during data transmission via the network interface card (NIC) driver's descriptors, and determining that the descriptor consumption rate does not meet a preset rate range, the filling threshold of the previously polled NIC driver is dynamically adjusted to obtain the target filling threshold for the current polling. If the number of idle descriptors in the currently polled NIC driver exceeds the target filling threshold, a descriptor filling operation is performed on the NIC driver. Because the filling threshold of the NIC driver is dynamically adjusted based on the real-time monitoring of the descriptor consumption rate, this at least partially overcomes the technical problem in the prior art where setting a fixed threshold cannot adapt to changes in system state, leading to unstable system performance. This achieves the technical effect of adaptively adjusting the filling threshold as the system state changes, resulting in stable system performance. Attached Figure Description
[0020] The above and other objects, features and advantages of this disclosure will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0021] Figure 1 This illustration schematically shows an exemplary system architecture to which descriptor filling methods, apparatuses, electronic devices, media, and program products can be applied according to embodiments of this disclosure;
[0022] Figure 2 A flowchart illustrating a descriptor filling method according to an embodiment of the present disclosure is shown schematically;
[0023] Figure 3 The diagram illustrates a descriptor filling method according to an embodiment of the present disclosure.
[0024] Figure 4 A schematic diagram illustrating a descriptor filling method according to another embodiment of the present disclosure is shown.
[0025] Figure 5 A block diagram of a descriptor filling apparatus according to embodiments of the present disclosure is illustrated schematically; and
[0026] Figure 6 A block diagram of an electronic device suitable for implementing the methods described above, according to embodiments of the present disclosure, is illustrated schematically. Detailed Implementation
[0027] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0028] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0029] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0030] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0031] In the embodiments disclosed herein, the collection, updating, analysis, processing, use, transmission, provision, disclosure, and storage of data (e.g., including but not limited to user personal information) comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures have been taken to prevent unauthorized access to user personal information data and to safeguard user personal information security and network security.
[0032] In the embodiments disclosed herein, user authorization or consent is obtained before acquiring or collecting user personal information.
[0033] The network interface card (NIC) driver and the NIC communicate through a shared data structure called the descriptor ring. Their collaboration can be summarized as follows: the driver acts as both a "producer" and "consumer" of descriptors: it produces empty, usable descriptors and consumes used descriptors that have already been processed by the NIC. The NIC acts as both a "consumer" and "producer" of descriptors: it consumes usable descriptors provided by the NIC driver to transmit data and produces used descriptors that have been filled with data and processed. During data transmission, the NIC driver needs to reclaim the used descriptors produced by the NIC and refill them to generate new empty buffers available for use by the backend NIC.
[0034] In related technologies, a fixed threshold is typically set to control the descriptor filling of the network interface card (NIC) driver. This threshold represents the number of descriptors in the current system. This fixed threshold can be set to min(budget, vring_size) / 2, which is half the smaller of budget and vring_size. Here, budget is the maximum number of packets that can be polled in one round, typically 64; vring_size is the total number of descriptors in the system.
[0035] However, if the fixed threshold is set too high, it will cause the following problems: 1) Low descriptor utilization and resource waste: A large number of descriptors remain in the "used, waiting for driver reclamation" state for a long time. However, the driver does not reclaim and reset them because the filling threshold has not been reached. This is equivalent to expensive ring buffer resources (memory) being idle and unable to be used to receive new data packets, which is a serious waste of resources. 2) Inability to cope with traffic surges: When a sudden surge of data packets arrives, the network card will quickly consume all available descriptors. Because the driver fills the ring very late, it cannot quickly replenish new descriptors to the ring. This will result in the network card having no descriptors available, and subsequent data packets can only be dropped, causing packet loss and decreased throughput. 3) Increased transmission latency: After the network card processes the data packets and updates its state, it needs to wait for a long time before the driver reclaims them. This increased latency is fatal for low-latency applications (such as financial transactions and real-time communication).
[0036] If the fixed threshold is set too high, it will cause the following problems: 1) Waste of CPU resources and cache pollution: Frequent fill operations (calling try_fill_recv) by the driver will generate a large number of CPU interrupts and context switches. Frequent memory allocation (GFP_ATOMIC) and access will pollute the CPU cache, squeezing out more important data and causing a decline in overall system performance. The "reset descriptor state" operation itself has overhead, and frequent execution will amplify this overhead. 2) Increased memory allocation pressure: Allocation may fail to fill when memory is tight. The more frequent the fill operation, the higher the probability of failure. Once it fails, it will enter "scheduled delayed fill work", which will introduce uncontrollable latency, which is contrary to the original intention. 3) Low batch processing efficiency: Modern high-performance drivers rely on batch processing (processing multiple packets / descriptors at once) to spread the overhead of a single operation and improve efficiency. Frequent filling results in only processing a small number of descriptors each time, which cannot take advantage of batch processing and makes the average cost of each operation very high.
[0037] In view of this, the present disclosure provides a descriptor filling method, comprising: in response to the network card transmitting data through the descriptor of the network card driver, determining the descriptor consumption rate of the currently polled network card using descriptors; in response to the descriptor consumption rate not meeting a preset rate range, dynamically adjusting the filling threshold of the network card driver of the previous poll to obtain a target filling threshold for the current poll, wherein the target filling threshold represents the baseline number of idle descriptors of the currently polled network card driver; and in response to the number of idle descriptors of the currently polled network card driver being greater than the target filling threshold for the current poll, performing a descriptor filling operation on the network card driver.
[0038] Figure 1This illustration schematically depicts an exemplary system architecture to which descriptor filling methods, apparatus, electronic devices, media, and program products can be applied according to embodiments of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0039] like Figure 1 As shown, the system architecture 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0040] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social media platform software, etc. (for example only).
[0041] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0042] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0043] It should be noted that the descriptor filling method provided in this embodiment can generally be executed by server 105. Correspondingly, the descriptor filling device provided in this embodiment can generally be located in server 105. The descriptor filling method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the descriptor filling device provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Alternatively, the descriptor filling method provided in this embodiment can also be executed by the first terminal device 101, the second terminal device 102, or the third terminal device 103, or by other terminal devices different from the first terminal device 101, the second terminal device 102, or the third terminal device 103. Accordingly, the descriptor filling device provided in the embodiments of this disclosure may also be disposed in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or disposed in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.
[0044] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0045] Figure 2 A flowchart illustrating a descriptor filling method according to an embodiment of the present disclosure is shown schematically.
[0046] like Figure 2 As shown, the method includes operations S210~S230.
[0047] In operation S210, in response to the network card transmitting data through the network card driver's descriptor, the descriptor consumption rate of the currently polled network card using the descriptor is determined.
[0048] According to embodiments of this disclosure, a descriptor is a small data structure located in memory that describes key information of a network data packet, but does not contain the content of the data packet itself. The process of a network interface card (NIC) transmitting data through the NIC driver's descriptor can include two aspects: the data sending process and the data receiving process, as detailed below.
[0049] In one embodiment, when the system needs to send a data packet, it places the data to be sent in a buffer in memory. The network card driver finds a free descriptor and fills it with the key information of the data to be sent. This descriptor records the key information of the data to be sent, such as the memory address of the buffer storing the data, the length of the data to be sent, and the marking information of the descriptor, for example, marked as "available descriptor". The network card reads the descriptor marked "available" in the network card driver, retrieves the data from the buffer memory address according to the buffer memory address in the descriptor, and sends it out through the physical network. After successful transmission, the network card writes back the descriptor, changing the "available" status to "used", so that the network card driver can reclaim the used descriptor and refill it to generate a new free descriptor available for the network card to use.
[0050] In one embodiment, when the network interface card (NIC) needs to receive a data packet from the network, the NIC driver fills an idle descriptor. The filling information includes the address of the buffer storing the data packet and the marking information of the idle descriptor, for example, marked as "idle, data receivable". When the NIC receives the data packet, it finds the descriptor marked "idle, data receivable" in the NIC driver, and writes the received data packet directly into the corresponding memory buffer according to the buffer address in the descriptor. After writing, the NIC writes back the descriptor, updates the status to "data ready", and fills in the actual length of the received data. The NIC driver retrieves the data from the buffer address and passes it to the upper-layer network protocol stack, and refills a new idle descriptor.
[0051] According to embodiments of this disclosure, the current polling and the previous polling can occur at different times. The data transmission process in the current polling can be a data transmission process, a data reception process, or a process in which data is transmitted and received simultaneously.
[0052] According to embodiments of this disclosure, the descriptor consumption rate can characterize the speed at which the network interface card (NIC) uses descriptors provided by the NIC driver when transmitting data. The descriptor consumption rate of the NIC varies in each polling cycle. The descriptor consumption rate can reflect the current system load.
[0053] In operation S220, in response to the descriptor consumption rate not meeting the preset rate range, the filling threshold of the network card driver in the previous polling is dynamically adjusted to obtain the target filling threshold for the current polling, wherein the target filling threshold represents the baseline number of idle descriptors of the network card driver in the current polling.
[0054] According to embodiments of this disclosure, the descriptor consumption rate can be determined by the ratio of the number of descriptors consumed by the network interface card in the current polling to the current polling duration. A preset rate range can serve as a benchmark characterizing the current network traffic state of the system.
[0055] According to embodiments of this disclosure, if the descriptor consumption rate is less than or equal to the lower limit of the preset rate range, it indicates that the network traffic status of the system is low and the descriptor consumption rate is slow. The filling threshold of the network card driver in the previous poll is dynamically increased by a preset percentage to obtain the target filling threshold for the low traffic scenario in the current poll. The network card driver will not perform the filling operation too early, so as to reduce the frequency of the filling operation, thereby reducing the CPU overhead and allowing the CPU to have more resources to process other tasks.
[0056] According to embodiments of this disclosure, if the descriptor consumption rate is greater than or equal to the upper limit of the preset rate range, it indicates that the network traffic status of the system is high traffic and the descriptor consumption rate is very fast. If the descriptors are not refilled in time, the available descriptors will be quickly exhausted, resulting in packet loss. Therefore, the filling threshold of the network card driver in the previous poll is dynamically reduced by a preset percentage. The descriptor consumption rate is very fast, and the target filling threshold for the high traffic scenario in the current poll is obtained. This allows the network card driver to reclaim used descriptors and refill them earlier and more actively, generating new free descriptors. This ensures that the network card driver's descriptors are filled in time before they are exhausted, ensuring that the network card always has available descriptors and reducing data packet loss.
[0057] According to embodiments of this disclosure, if the descriptor consumption rate is within a preset rate range, it indicates that the network traffic of the system is in a normal state, and the filling threshold of the network card driver in the previous poll can be left unchanged and used as the target filling threshold for the current poll.
[0058] According to embodiments of this disclosure, the baseline number of free descriptors can be understood as the number of free descriptors that trigger the network interface card driver to fill the descriptors.
[0059] In operation S230, in response to the number of idle descriptors of the network card driver being polled in the current poll being greater than the target filling threshold of the current poll, a descriptor filling operation is performed on the network card driver.
[0060] According to embodiments of this disclosure, the number of free descriptors in the currently polled network interface card (NIC) driver can be understood as the actual number of free descriptors. When the actual number of free descriptors in the NIC driver is greater than the target filling threshold, it indicates that the NIC driver has reached the filling threshold and can perform a descriptor filling operation. In this case, the NIC driver can reclaim used descriptors and refill them to generate new empty descriptors for use when the NIC transmits data subsequently.
[0061] According to embodiments of this disclosure, by real-time monitoring of the descriptor consumption rate during data transmission via the network interface card (NIC) driver's descriptors, and determining that the descriptor consumption rate does not meet a preset rate range, the filling threshold of the previously polled NIC driver is dynamically adjusted to obtain the target filling threshold for the current polling. If the number of idle descriptors in the currently polled NIC driver exceeds the target filling threshold, a descriptor filling operation is performed on the NIC driver. Because the filling threshold of the NIC driver is dynamically adjusted based on the real-time monitoring of the descriptor consumption rate, this at least partially overcomes the technical problem in the prior art where setting a fixed threshold cannot adapt to changes in system state, leading to unstable system performance. This achieves the technical effect of adaptively adjusting the filling threshold as the system state changes, resulting in stable system performance.
[0062] According to embodiments of this disclosure, in response to a descriptor consumption rate not meeting a preset rate range, the filling threshold of the network card driver in the previous polling is dynamically adjusted to obtain the target filling threshold for the current polling, including: in response to a descriptor consumption rate not meeting a preset rate range, dynamically adjusting the filling threshold of the network card driver in the previous polling to obtain the basic filling threshold for the current polling; and in response to a system memory pressure not meeting a preset memory pressure range, dynamically adjusting the basic filling threshold for the current polling based on a first preset adjustment factor to obtain the target filling threshold for the current polling.
[0063] According to embodiments of this disclosure, system memory pressure can be obtained based on the system interface. Memory pressure is a key indicator reflecting the degree of strain on system memory resources. A base fill threshold can be obtained by dynamically adjusting the fill threshold from the previous polling based on the descriptor consumption rate of the network interface card (NIC).
[0064] According to embodiments of this disclosure, the preset memory pressure range can be a range representing the normal usage state of memory resources. The system memory pressure is monitored in real time to determine whether the preset memory pressure range is met. If the system memory pressure is within the preset memory pressure range, there is no need to dynamically adjust the basic fill threshold, and this basic fill threshold is used as the target fill threshold for the current polling.
[0065] According to embodiments of this disclosure, the first preset adjustment factor can be a parameter for dynamically adjusting the base fill threshold. If the base fill threshold is dynamically increased, the first preset adjustment factor can be set to a value greater than 1; if the base fill threshold is dynamically decreased, the first preset adjustment factor can be set to a value less than 1.
[0066] In one embodiment, if the system memory pressure is greater than the upper limit of the preset memory pressure range, it indicates that the memory pressure is high, meaning that the system memory resources are insufficient and the network card is frequently transmitting data. At this time, the product of the basic filling threshold and a first preset adjustment factor greater than 1 is calculated to dynamically increase the basic filling threshold. The increased threshold is then used as the target filling threshold for the current polling, so that the network card driver will not perform descriptor filling operations prematurely, reducing unnecessary memory resource consumption and lowering the overall system load.
[0067] In one embodiment, if the system memory pressure is less than the lower limit of the preset memory pressure range, it indicates that the memory pressure is low, which means that the system memory resources are relatively sufficient. The product of the basic filling threshold and a first preset adjustment factor less than 1 can be calculated to dynamically reduce the basic filling threshold. The reduced threshold is then used as the target filling threshold for the current polling, so that the network card driver performs descriptor filling operations, ensuring that the network card always has available descriptors, thereby preventing data packet loss.
[0068] According to embodiments of this disclosure, a basic filling threshold is obtained by real-time monitoring of the descriptor consumption rate of network card descriptors. Then, the basic filling threshold is dynamically adjusted based on the monitored system pressure to obtain the target filling threshold of the currently polled network card driver. This enables the system to improve network throughput and reduce latency, as well as reduce CPU consumption and packet loss rate when the system performance status changes dynamically, thus giving the system strong adaptive capabilities.
[0069] According to embodiments of this disclosure, in response to the system memory pressure not meeting a preset memory pressure range, the basic fill threshold for the current polling is dynamically adjusted based on a first preset adjustment factor to obtain a target fill threshold for the current polling. The method further includes: in response to the system memory pressure not meeting a preset memory pressure range, dynamically adjusting the basic fill threshold for the current polling based on a first preset adjustment factor to obtain a first intermediate fill threshold for the current polling; determining the fill success rate of the descriptor fill operation using the total number of successfully filled descriptors and the total number of descriptors attempted to be filled in historical pollings, as counted by a counter in the network card driver; and in response to the fill success rate not meeting a preset success rate range, dynamically adjusting the first intermediate fill threshold based on a second preset adjustment factor to obtain a target fill threshold for the current polling.
[0070] According to embodiments of this disclosure, historical polling can be based on polling prior to the current polling. The total number of descriptors attempted to be filled can be for each historical polling session. When the network interface card driver sends a descriptor filling request, a counter counts the number of descriptors attempted to be filled; when a descriptor filling attempt is successful, the counter counts the number of successfully filled descriptors.
[0071] According to embodiments of this disclosure, the fill success rate can be obtained based on the ratio of the total number of successfully filled descriptors to the total number of descriptors attempted to be filled.
[0072] According to embodiments of this disclosure, if the fill success rate is greater than or equal to the upper limit of a preset success rate range, it indicates a high fill success rate, meaning that memory allocation is easy. The first intermediate fill threshold can be dynamically reduced based on a second preset adjustment factor, thereby using the reduced first intermediate fill threshold as the target fill threshold for the current polling. The setting rules for the second preset adjustment factor are consistent with those for the first preset adjustment factor, and will not be repeated here.
[0073] According to the embodiments of this disclosure, if the success rate of filling is less than or equal to the lower limit of the preset success rate range, it indicates that the success rate is low, which means that it is difficult to allocate memory. The first intermediate filling threshold can be dynamically increased based on the second preset adjustment factor, so that the increased first intermediate filling threshold is used as the target filling threshold for the current polling.
[0074] According to the embodiments of this disclosure, if the filling success rate is within the preset success rate range, it indicates that the filling success rate is within the normal range, which means that the memory allocation is normal, and the first intermediate filling threshold can be used as the target filling threshold for the current polling.
[0075] According to embodiments of this disclosure, a target filling threshold is obtained by dynamically adjusting the basic filling threshold based on the descriptor consumption rate and the monitored system pressure, and then dynamically fine-tuning the first intermediate filling threshold again based on the historical polling filling success rate. This allows for dynamic adjustment of the filling threshold by monitoring the real-time status of the system from multiple dimensions, thereby dynamically adjusting the timing of filling the network card driver descriptors. This achieves an optimal balance between avoiding packet loss and reducing CPU overhead, resulting in a lower packet loss rate and reduced CPU overhead.
[0076] According to embodiments of this disclosure, in response to the fill success rate not meeting a preset success rate range, the first intermediate fill threshold is dynamically adjusted based on a second preset adjustment factor to obtain the target fill threshold for the current polling. The method further includes: in response to the fill success rate not meeting a preset success rate range, the first intermediate fill threshold is dynamically adjusted based on a second preset adjustment factor to obtain the second intermediate fill threshold for the current polling; and the base fill threshold, the first intermediate fill threshold, and the second intermediate fill threshold are smoothed to obtain the target fill threshold for the current polling.
[0077] According to an embodiment of this disclosure, the second intermediate filling threshold is obtained by dynamically adjusting the first intermediate filling threshold based on the filling success rate.
[0078] According to embodiments of this disclosure, the smoothing process can be based on assigning different weights to the base fill threshold, the first intermediate fill threshold, and the second intermediate fill threshold obtained in each adjustment, and then summing the results to obtain the final result, which is the target fill threshold for the current polling.
[0079] According to embodiments of this disclosure, the calculated target fill threshold must be within the safety range set by the system to ensure that the system can perform normally under any condition. For example, lower limit protection: ensure at least 8 descriptors or 5% of the ring capacity (whichever is greater); upper limit protection: the threshold does not exceed 50% of the ring capacity.
[0080] According to embodiments of this disclosure, based on the smoothing process of the filling thresholds obtained after each adjustment, namely the basic filling threshold, the first intermediate filling threshold, and the second intermediate filling threshold, the target filling threshold for the current polling is finally obtained, so as to avoid the filling threshold from jittering, improve the accuracy of the target filling threshold, and thus accurately control the timing of the network card driver to dynamically fill the descriptor, so as to improve the system performance stability.
[0081] According to embodiments of this disclosure, determining the descriptor consumption rate of the currently polled network interface card (NIC) using descriptors includes: determining the number of descriptors used by the NIC in the previous polling when transmitting data through the NIC driver's descriptors and the previous polling timestamp; determining the number of descriptors used by the currently polled NIC when transmitting data through the NIC driver's descriptors and the current polling timestamp; calculating the time difference based on the current polling timestamp and the migration polling timestamp; and determining the descriptor consumption rate of the currently polled NIC using descriptors based on the number of descriptors used in the previous polling, the number of descriptors used in the current polling, and the time difference.
[0082] According to embodiments of this disclosure, at the start of each polling cycle, a timestamp for that polling cycle and the number of descriptors used can be recorded. The timestamp represents the polling time; the number of descriptors used is the number of descriptors in the network card driver used by the network card to transmit data during that polling cycle.
[0083] According to embodiments of this disclosure, the previous polling state, i.e., the timestamp and the number of descriptors used in the previous polling, can be recorded first, and the current polling state, i.e., the timestamp and the number of descriptors used in the current polling, can be recorded secondly.
[0084] According to embodiments of this disclosure, the time difference between two polls can be calculated based on the timestamp of the current poll and the timestamp of the previous poll; the descriptor usage difference between two polls can be calculated based on the number of descriptors used in the current poll and the number of descriptors used in the previous poll.
[0085] According to embodiments of this disclosure, the descriptor consumption rate of the current polling can be calculated based on the ratio of the descriptor usage difference to the time difference.
[0086] According to embodiments of this disclosure, the consumption rate can be calculated once for each poll, enabling real-time understanding of the network card's descriptor consumption rate. Based on the calculated descriptor consumption rate, the descriptor filling threshold can be dynamically adjusted, thereby adaptively adjusting the network card driver to fill descriptors and controlling the descriptor filling timing.
[0087] According to embodiments of this disclosure, the method further includes: pausing the descriptor filling operation of the network card driver in response to the fact that the number of idle descriptors in the currently polled network card driver is less than or equal to the target filling threshold of the currently polled network card driver.
[0088] According to embodiments of this disclosure, the method further includes: updating the descriptor filling success rate in response to the filling result when performing a descriptor filling operation on the network card driver.
[0089] According to embodiments of this disclosure, when the number of idle descriptors in the network card driver responding to the current polling is greater than the target filling threshold of the current polling, a descriptor filling operation is performed on the network card driver. If the filling result indicates successful filling, the filling success rate is updated to increase the filling success rate; if the filling result indicates failed filling, the filling success rate is updated to decrease the filling success rate.
[0090] According to embodiments of this disclosure, if the number of descriptor filling failures exceeds a predetermined number, it indicates that the current filling threshold is too aggressive. Even if the network card driver is deemed capable of filling descriptors based on the descriptor consumption rate and memory pressure, it should be deferred and filling should not be performed for the time being.
[0091] According to embodiments of this disclosure, if the number of idle descriptors in the currently polled network card driver is less than or equal to the target filling threshold of the current polling, the descriptors are not filled temporarily, waiting for more descriptors to be used, while allowing the CPU to have more resources to process other tasks and reduce CPU overhead.
[0092] Based on the above method, after the current poll ends, the target fill threshold of the current poll is used as the current fill threshold of the next poll, and the current fill threshold of the next poll is dynamically adjusted based on the calculated descriptor consumption rate to obtain the target fill threshold of the next poll.
[0093] Figure 3 The diagram illustrates a descriptor filling method according to an embodiment of the present disclosure.
[0094] like Figure 3As shown in schematic diagram 300, in response to the network card transmitting data through the driver's descriptors, the following steps are taken: 1) Calculate the descriptor usage difference 301 between the number of descriptors used by the network card in the previous polling and the number of descriptors used by the network card in the current polling. 2) Calculate the time difference 302 between the timestamp of the previous polling and the timestamp of the current polling. 3) Determine the descriptor consumption rate 303 based on the descriptor usage difference 301 and the time difference 302. 4) In response to the descriptor consumption rate not meeting the preset rate range, dynamically adjust the filling threshold of the network card driver in the previous polling to obtain the basic filling threshold 304. 5) In response to the system memory pressure not meeting the preset memory pressure range, adjust the filling threshold based on the first preset adjustment factor. 305. Dynamically adjust the base fill threshold of the current polling to obtain the first intermediate fill threshold 306; In response to the fill success rate of the descriptor fill operation not meeting the preset success rate range, dynamically adjust the first intermediate fill threshold based on the second preset adjustment factor 307 to obtain the second intermediate fill threshold 308; Smooth the base fill threshold 304, the first intermediate fill threshold 306, and the second intermediate fill threshold 308 to obtain the target fill threshold 309; Determine whether the number of idle descriptors of the network card driver currently polled is greater than the target fill threshold 310; If it is greater, perform a descriptor fill operation on the network card driver to obtain the fill operation result 311, and update the fill success rate 312 based on the fill operation result; If it is less than or equal to, do not fill descriptors for the time being 313.
[0095] Figure 4 A schematic diagram of a descriptor filling method according to another embodiment of the present disclosure is shown.
[0096] like Figure 4As shown in diagram 400, the system can be monitored and metrics collected for the current polling process. For example, this includes collecting the system's memory pressure during network card data transmission, the timestamps of the previous and current polls, the number of descriptors used, and the fill success rate in historical polling processes. The current dynamic fill threshold is queried from the network card driver; for example, this current dynamic fill threshold could be the fill threshold from the previous poll. The descriptor consumption rate is calculated based on the collected timestamps and the number of descriptors used. An adaptive algorithm is then used to dynamically adjust the current dynamic fill threshold based on the descriptor consumption rate, system pressure, and the fill success rate in historical polling processes to obtain the target fill threshold, which is then returned to the network card driver. Based on the target fill threshold and the number of free descriptors in the network card driver, a decision is made on whether to fill the descriptors. If the number of free descriptors is greater than the dynamic fill threshold, an attempt to fill is made. This process is then performed in the network card driver. The network interface card (NIC) fills descriptors and marks their status as "AVAIL". During data transmission, the NIC processes data using descriptors marked as "AVAIL" and changes their status from "AVAIL" to "USED" after processing. Simultaneously, the NIC driver reclaims the used descriptor, checks its status, resets it, changes its status back to "AVAIL", and performs descriptor filling. It also reports the filling results (success / failure) of the current poll, updates the filling success rate, and updates the descriptor consumption rate to provide data for dynamically adjusting the filling threshold in the next poll. If the number of idle descriptors is less than or equal to the dynamic filling threshold, descriptor filling is temporarily suspended to reduce CPU overhead, waiting for more descriptors to be consumed. After the current poll ends, the next poll continues, and the filling threshold is continuously adjusted adaptively.
[0097] Figure 5 A block diagram of a descriptor filling apparatus according to an embodiment of the present disclosure is shown schematically.
[0098] like Figure 5 As shown, the descriptor filling device 500 includes a consumption rate determination module 510, a threshold acquisition module 520, and a descriptor filling module 530.
[0099] The consumption rate determination module 510 is used to determine the descriptor consumption rate of the currently polled network card using descriptors during the process of the network card transmitting data through the descriptors of the network card driver.
[0100] The threshold acquisition module 520 is used to dynamically adjust the filling threshold of the network card driver in the previous polling in response to the descriptor consumption rate not meeting the preset rate range, so as to obtain the target filling threshold of the current polling, wherein the target filling threshold represents the baseline number of idle descriptors of the network card driver in the current polling.
[0101] The descriptor filling module 530 is used to perform a descriptor filling operation on the network card driver in response to the current polling network card driver having more free descriptors than the current polling target filling threshold.
[0102] According to embodiments of this disclosure, the threshold acquisition module 520 includes a first threshold acquisition submodule and a second threshold acquisition submodule.
[0103] The first threshold acquisition submodule is used to dynamically adjust the filling threshold of the network card driver in the previous polling in response to the descriptor consumption rate not meeting the preset rate range, so as to obtain the basic filling threshold of the current polling.
[0104] The second threshold acquisition submodule is used to dynamically adjust the basic filling threshold of the current polling based on the first preset adjustment factor in response to the system memory pressure not meeting the preset memory pressure range, so as to obtain the target filling threshold of the current polling.
[0105] According to embodiments of this disclosure, the threshold second acquisition submodule includes: a threshold first acquisition unit, a success rate determination unit, and a threshold second acquisition unit.
[0106] The threshold first obtaining unit is used to dynamically adjust the basic filling threshold of the current polling based on the first preset adjustment factor in response to the system memory pressure not meeting the preset memory pressure range, so as to obtain the first intermediate filling threshold of the current polling.
[0107] The success rate determination unit is used to determine the success rate of the descriptor filling operation by using the counters of the network card driver to count the total number of successfully filled descriptors and the total number of descriptors attempted to be filled in the historical polling.
[0108] The second threshold acquisition unit is used to dynamically adjust the first intermediate filling threshold based on the second preset adjustment factor in response to the filling success rate not meeting the preset success rate range, so as to obtain the target filling threshold for the current polling.
[0109] According to embodiments of this disclosure, the second threshold acquisition unit includes a threshold acquisition subunit and a smoothing processing subunit.
[0110] The threshold acquisition subunit is used to dynamically adjust the first intermediate filling threshold based on the second preset adjustment factor in response to the filling success rate not meeting the preset success rate range, so as to obtain the second intermediate filling threshold for the current polling.
[0111] The smoothing subunit is used to smooth the base fill threshold, the first intermediate fill threshold, and the second intermediate fill threshold to obtain the target fill threshold for the current polling.
[0112] According to an embodiment of this disclosure, the consumption rate determination module 510 includes: a first quantity determination submodule, a second quantity determination submodule, a time difference calculation submodule, and a consumption rate determination submodule.
[0113] The first quantity determination submodule is used to determine the number of descriptors used by the network card in the previous poll when transmitting data through the network card driver descriptors and the timestamp of the previous poll.
[0114] The second quantity determination submodule is used to determine the number of descriptors used by the network card in the current polling process when transmitting data through the network card driver's descriptors and the current polling timestamp.
[0115] The time difference calculation submodule is used to calculate the time difference based on the current polling timestamp and the migration polling timestamp.
[0116] The consumption rate determination submodule is used to determine the descriptor consumption rate of the network interface card (NIC) usage descriptors in the current poll based on the number of usage descriptors in the previous poll, the number of usage descriptors in the current poll, and the time difference.
[0117] According to embodiments of this disclosure, the apparatus 500 further includes a descriptor pause filling module.
[0118] The descriptor pause filling module is used to pause the descriptor filling operation of the network card driver in response to the number of free descriptors in the current polling being less than or equal to the target filling threshold of the current polling.
[0119] According to embodiments of this disclosure, the above-described apparatus 500 further includes a success rate update module.
[0120] The success rate update module is used to update the descriptor filling success rate in response to the filling result when performing descriptor filling operation on the network card driver.
[0121] Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure, or at least part of the functions of any one or more of them, can be implemented in one module. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be implemented by dividing them into multiple modules. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as hardware circuitry, such as a Field-Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a System-on-Chip, a System-on-a-Substrate, a System-on-Package, an Application-Specific Integrated Circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as computer program modules, which, when run, can perform corresponding functions.
[0122] For example, any plurality of the consumption rate determination module 510, threshold acquisition module 520, and descriptor filling module 530 may be combined into one module / unit / subunit, or any one of these modules / units / subunits may be split into multiple modules / units / subunits. Alternatively, at least part of the functionality of one or more of these modules / units / subunits may be combined with at least part of the functionality of other modules / units / subunits and implemented in one module / unit / subunit. According to embodiments of the present disclosure, at least one of the consumption rate determination module 510, threshold acquisition module 520, and descriptor filling module 530 may be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the consumption rate determination module 510, the threshold acquisition module 520, and the descriptor filling module 530 may be implemented at least partially as a computer program module that can perform corresponding functions when the computer program module is run.
[0123] It should be noted that the descriptor filling device part in the embodiments of this disclosure corresponds to the descriptor filling method part in the embodiments of this disclosure. For a detailed description of the descriptor filling device part, please refer to the descriptor filling method part, which will not be repeated here.
[0124] Figure 6A block diagram of an electronic device suitable for implementing the methods described above, according to embodiments of the present disclosure, is illustrated schematically. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0125] like Figure 6 As shown, an electronic device 600 according to an embodiment of this disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.
[0126] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 602 and / or RAM 603. It should be noted that programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in one or more memories.
[0127] According to embodiments of this disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to a bus 604. The electronic device 600 may also include one or more of the following components connected to the input / output (I / O) interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the storage section 608 as needed.
[0128] According to embodiments of this disclosure, the method flow according to embodiments of this disclosure can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by processor 601, it performs the functions defined in the system of embodiments of this disclosure. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0129] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0130] According to embodiments of this disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0131] For example, according to embodiments of this disclosure, a computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than ROM 602 and RAM 603.
[0132] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods provided in the embodiments of this disclosure. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the descriptor filling method provided in the embodiments of this disclosure.
[0133] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0134] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0135] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0136] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features described in the various embodiments of the present disclosure can be combined and / or combined in various ways, even if such combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments of this disclosure may be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0137] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. A descriptor filling method, comprising: In response to the network interface card (NIC) transmitting data through the NIC driver's descriptor, determine the descriptor consumption rate of the currently polled NIC using the descriptor; In response to the fact that the descriptor consumption rate does not meet the preset rate range, the filling threshold of the network card driver in the previous poll is dynamically adjusted to obtain the target filling threshold for the current poll, wherein the target filling threshold represents the baseline number of idle descriptors of the network card driver in the current poll. In response to the fact that the number of free descriptors of the network card driver in the current polling is greater than the target filling threshold of the current polling, a descriptor filling operation is performed on the network card driver.
2. The method according to claim 1, wherein, In response to the descriptor consumption rate not meeting the preset rate range, the filling threshold of the network card driver in the previous poll is dynamically adjusted to obtain the target filling threshold for the current poll, including: In response to the fact that the descriptor consumption rate does not meet the preset rate range, the filling threshold of the network card driver in the previous poll is dynamically adjusted to obtain the basic filling threshold for the current poll. In response to the system memory pressure not meeting the preset memory pressure range, the basic filling threshold of the current polling is dynamically adjusted based on the first preset adjustment factor to obtain the target filling threshold of the current polling.
3. The method according to claim 2, wherein, In response to the system memory pressure not meeting the preset memory pressure range, the basic fill threshold of the current polling is dynamically adjusted based on a first preset adjustment factor to obtain the target fill threshold of the current polling, including: In response to the system memory pressure not meeting the preset memory pressure range, the basic filling threshold of the current polling is dynamically adjusted based on the first preset adjustment factor to obtain the first intermediate filling threshold of the current polling. The success rate of the descriptor filling operation is determined by using the counters of the network card driver to count the total number of successfully filled descriptors and the total number of descriptors attempted to be filled in the historical polling. In response to the fact that the fill success rate does not meet the preset success rate range, the first intermediate fill threshold is dynamically adjusted based on the second preset adjustment factor to obtain the target fill threshold for the current polling.
4. The method according to any one of claims 3, wherein, In response to the fact that the fill success rate does not meet the preset success rate range, the first intermediate fill threshold is dynamically adjusted based on a second preset adjustment factor to obtain the target fill threshold for the current polling, including: In response to the fact that the filling success rate does not meet the preset success rate range, the first intermediate filling threshold is dynamically adjusted based on the second preset adjustment factor to obtain the second intermediate filling threshold for the current polling. The base fill threshold, the first intermediate fill threshold, and the second intermediate fill threshold are smoothed to obtain the target fill threshold for the current polling.
5. The method according to claim 1, wherein, Determining the descriptor consumption rate of the network interface card currently being polled using the descriptor includes: Determine the number of descriptors used by the network card in the previous poll when it transmitted data through the network card driver descriptors and the timestamp of the previous poll; Determine the number of descriptors used by the network interface card (NIC) during the current polling and the current polling timestamp when transmitting data through the NIC driver's descriptors; Calculate the time difference based on the current polling timestamp and the migration polling timestamp; Based on the number of descriptors used in the previous poll, the number of descriptors used in the current poll, and the time difference, the descriptor consumption rate of the network card using the descriptors in the current poll is determined.
6. The method according to claim 1, further comprising: In response to the number of idle descriptors of the network card driver in the current poll being less than or equal to the target filling threshold of the current poll, the descriptor filling operation of the network card driver is paused.
7. The method according to claim 1, further comprising: In response to the filling result when performing a descriptor filling operation on the network card driver, update the descriptor filling success rate.
8. A descriptor filling device, comprising: The consumption rate determination module is used to determine the descriptor consumption rate of the network card using the descriptor during the process of the network card transmitting data through the descriptor of the network card driver. The threshold acquisition module is used to dynamically adjust the filling threshold of the network card driver in the previous polling in response to the descriptor consumption rate not meeting the preset rate range, so as to obtain the target filling threshold of the current polling, wherein the target filling threshold represents the baseline number of idle descriptors of the network card driver in the current polling. The descriptor filling module is used to perform a descriptor filling operation on the network card driver in response to the current polling's number of idle descriptors being greater than the current polling target filling threshold.
9. An electronic device, comprising: One or more processors; Memory, used to store one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1 to 7.
10. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 7.
11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 7.