Data processing method and storage medium, electronic device, program product

By dynamically allocating processor cores and co-processing mechanisms, the problem of resource waste in the smart network card resource allocation mechanism is solved, and the efficiency of data task offloading and system performance are improved.

CN120602416BActive Publication Date: 2025-10-14INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511067347.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-31
Publication Date
2025-10-14
Estimated Expiration
2045-07-31

AI Technical Summary

Technical Problem

The existing smart network card resource allocation mechanism lacks an evaluation of the overall benefits of task offloading, resulting in resource waste when complex control and computing are offloaded. This makes it difficult to adapt to the complex offloading tasks of data centers and limits the offloading benefits of smart network cards.

Method used

By obtaining the inbound and outbound throughput of the target network card, the processor cores are dynamically allocated according to the processing capacity of the task processing unit, and the unprocessed data packets are sent to the host-side central processing unit for processing to optimize resource utilization.

Benefits of technology

It improves the efficiency of data task offloading, reduces data accumulation and processing delays, and optimizes the overall performance and response speed of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120602416B_ABST
    Figure CN120602416B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and a storage medium, an electronic device and a program product, and is applied to a target network card. The method comprises the following steps: obtaining the inbound throughput and the outbound throughput of the target network card; in the case that the inbound throughput is greater than the outbound throughput, allocating the processor core required by the task processing unit based on the processing capacity of the task processing unit on the target network card; after the processor core is allocated, if the inbound throughput is greater than the outbound throughput, determining the target data packet based on the total data packet of the network task and the data packet processed by the target network card, and sending the target data packet to the central processor of the host end for processing. The method can dynamically allocate the processor core, effectively supports the task offloading of the target network card, and improves the efficiency of the data task offloading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method and storage medium, electronic equipment, and program product. Background Art

[0002] With the widespread adoption of high-performance network infrastructure boasting 100Gbps (Gigabits per second) bandwidth and microsecond latency, end systems are demanding extremely high speeds to process network packets. Furthermore, processing capabilities may be frequently updated to handle various virtualization requirements. Emerging Smart NICs integrate computing units and onboard memory into the NIC to handle various network functions. Offloading appropriate tasks to Smart NICs reduces the server's CPU (Central Processing Unit) load and shortens the latency of user requests, leading to their widespread adoption in data centers.

[0003] There are three types of Smart NICs based on the computing units on the Smart NIC. These include Smart NICs based on specialized acceleration hardware, Smart NICs based on programmable gate arrays, and Smart NICs based on multi-core SoCs (System on Chips). SoC-based Smart NICs integrate general-purpose processors with customized accelerators. This design maintains high performance while maintaining flexibility, as it allows the use of general-purpose processors for different computing tasks. SoC-based Smart NICs are also relatively low-cost and suitable for most enterprise data centers and cloud computing scenarios. Therefore, they are widely used for offloading general network functions and specific applications.

[0004] Currently, related Smart NIC resource allocation mechanisms lack an assessment of the overall benefits of task offloading. This leads to significant resource waste when using Smart NICs for complex control and computation offloading, limiting the offloading benefits of Smart NICs. Currently, there are three main Smart NIC core allocation mechanisms: core sharing through thread switching, static allocation of a fixed number of cores, and dynamic allocation of cores to meet maximum demand. The core sharing approach can effectively utilize computing resources, but it incurs significant thread switching overhead in complex offloading scenarios. This overhead can reach microseconds, severely limiting overall execution speed in current high-speed networks. The static core allocation approach effectively ensures isolation of offloaded applications, but can lead to performance deficiencies and resource waste when loads fluctuate. The dynamic maximum allocation approach prioritizes maximum performance for certain applications, but in complex offloading scenarios, this approach can significantly waste computing resources on the Smart NIC. None of these three approaches can adapt to the complex offloading tasks in resource-decomposed data centers, making it difficult for existing Smart NICs to serve as the core of resource decomposition centers and handle various tasks. SUMMARY

[0005] The present application provides a data processing method and a storage medium, an electronic device and a program product to at least solve the problem of lack of evaluation of overall benefits of task offloading in the resource allocation mechanism in the related art, which leads to serious resource waste when using a network card for complex control and calculation offloading, and can dynamically allocate processor cores to effectively support task offloading of the target network card and improve the efficiency of data task offloading.

[0006] The present application provides a data processing method applied to a target network card, the method comprising:

[0007] obtaining an inbound throughput and an outbound throughput of the target network card;

[0008] in a case where the inbound throughput is greater than the outbound throughput, allocating processor cores required by a task processing unit on the target network card based on a processing capacity of the task processing unit;

[0009] after the processor cores are allocated, if the inbound throughput is greater than the outbound throughput, determining a target data packet based on a total data packet of a network task and a data packet processed by the target network card, and sending the target data packet to a central processing unit of a host end for processing.

[0010] The present application also provides a non-volatile computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the above-mentioned data processing method.

[0011] The present application also provides a computer program product comprising computer programs / instructions, which, when executed by a processor, implement the above-mentioned data processing method.

[0012] The present application also provides an electronic device comprising a memory, a processor and a program stored on the memory and executable on the processor, wherein the processor implements the above-mentioned data processing method when executing the program.

[0013] According to the present application, the inbound throughput and the outbound throughput of the target network card are obtained, in a case where the inbound throughput is greater than the outbound throughput, processor cores required by a task processing unit on the target network card are allocated based on a processing capacity of the task processing unit, and after the processor cores are allocated, if the inbound throughput is greater than the outbound throughput, a target data packet is determined based on a total data packet of a network task and a data packet processed by the target network card, and the target data packet is sent to a central processing unit of a host end for processing. Therefore, the method can dynamically allocate processor cores to effectively support task offloading of the target network card and improve the efficiency of data task offloading. BRIEF DESCRIPTION OF DRAWINGS

[0014] In order to more clearly illustrate the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. Obviously, the drawings described below are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort based on these drawings.

[0015] Figure 1 Flow chart of a data processing method according to an embodiment of the present application;

[0016] Figure 2 Schematic diagram of a data processing system according to an embodiment of the present application;

[0017] Figure 3 Flow chart of a data processing method according to a specific example of the present application;

[0018] Figure 4 Block schematic diagram of an electronic device according to an embodiment of the present application.

[0019] Reference signs: 200-electronic device, 210-memory, 220-processor. DETAILED DESCRIPTION

[0020] The embodiments of the present application will be described in detail below, examples of which are shown in the drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and are intended to explain the present application, and cannot be understood as a limitation of the present application.

[0021] The data processing method, non-volatile computer-readable storage medium, electronic device and computer program product proposed by the embodiments of the present application will be described below with reference to the drawings.

[0022] Figure 1 Flow chart of a data processing method according to an embodiment of the present application.

[0023] As shown in Figure 1 the data processing method of the embodiments of the present application can include the following steps:

[0024] S1, obtaining the inbound throughput and outbound throughput of a target network card.

[0025] S2, in the case that the inbound throughput is greater than the outbound throughput, allocating the processor cores required by the task processing units based on the processing capacity of the task processing units on the target network card.

[0026] S3, after allocating the processor cores, if the inbound throughput is greater than the outbound throughput, the target data packet is determined based on the total data packets of the network task and the data packets processed by the target network card, and the target data packet is sent to the central processing unit on the host side for processing.

[0027] Specifically, in one embodiment of the present application, the data processing method is applied to a target network card, which refers to a network card selected to perform specific tasks (such as data packet processing, task offloading, etc.) in a specific network environment. It can be any type of network card, as long as it has a certain level of computing power and programmability and is capable of processing network tasks. The main functions of the target network card are to receive, process, and send network data packets. In the present application, the target network card is used to process network tasks and, as needed, offload some tasks to the host-side central processing unit. It should be noted that the target network card can be a smart network card or other type of high-performance network card, as long as it can support task offloading and dynamic resource allocation.

[0028] First, obtain the target NIC's inbound and outbound throughput. For example, by monitoring the target NIC's network traffic, determine the speed at which it receives (inbound) and sends (outbound) packets. Inbound throughput represents the amount of data received by the target NIC per unit time, while outbound throughput represents the amount of data sent per unit time. By comparing inbound and outbound throughput, you can determine whether the target NIC's current processing capacity can meet the demand for received data. If the inbound throughput is greater than the outbound throughput, this indicates that the target NIC's current processing capacity is insufficient to process all received data, potentially leading to data accumulation or processing delays.

[0029] Therefore, after obtaining the inbound throughput and outbound throughput, the relationship between the inbound throughput and the outbound throughput can be judged. When the inbound throughput is greater than the outbound throughput, the processor cores required by the task processing unit can be allocated according to the processing capability of the task processing unit on the target network card. Among them, the task processing unit is a computing module on the target network card used to process specific tasks. These tasks may include network protocol processing, data packet parsing, data encryption / decryption, compression / decompression, etc. Each task processing unit is responsible for processing a specific type of network task, thereby improving the processing efficiency of the target network card. The processor core (such as the SoC core) is a computing resource on the target network card, which is used to execute the computing tasks in the task processing unit. Allocating more processor cores can improve the processing capability of the task processing unit.

[0030] If the target NIC receives more data than it sends, this indicates that its current processing capacity is insufficient to process all the received data, potentially leading to data accumulation or processing delays. By evaluating the processing capacity of each task processing unit, processor cores can be appropriately allocated to ensure efficient data processing. For example, processor cores can be dynamically allocated based on the processing capacity of each task processing unit. For example, units with greater processing power can receive more processor cores to improve processing efficiency, while units with less processing power can receive fewer cores. This rational allocation of processor cores fully utilizes the processing capacity of the target NIC, improves data processing efficiency, and reduces data accumulation.

[0031] Suppose the target network card has two task processing units: Task Processing Unit A, which has higher processing power and can quickly process data packets, and Task Processing Unit B, which has lower processing power and processes data packets more slowly. If the inbound throughput is greater than the outbound throughput, and the target network card has a total of 8 processor cores, based on the processing power of the task processing units: Task Processing Unit A is assigned 6 processor cores because it has higher processing power and requires more cores to process data. Task Processing Unit B is assigned 2 processor cores because it has lower processing power and can be assigned fewer cores. This ensures that each task processing unit can process data efficiently while avoiding resource waste.

[0032] After allocating processor cores, the relationship between inbound and outbound throughput is further assessed. If inbound throughput exceeds outbound throughput, this indicates that the target network card's processing capacity is still insufficient. Based on the total number of packets in the network task and the number of packets already processed by the target network card, the target packets that need to be sent to the host's CPU for processing are determined. These target packets are then forwarded to the host's CPU for further processing. By forwarding some packets to the host's CPU for processing, the processing burden on the target network card is further reduced, preventing data accumulation and processing delays. Furthermore, this collaborative processing mechanism fully utilizes the host's computing resources, improving overall system processing efficiency.

[0033] The total data packets of the network task are the total number of all data packets that need to be processed in the current network task, the data packets processed by the target network card are the number of data packets that have been successfully processed and sent by the target network card, and the target data packets are data packets that need to be sent from the target network card to the host central processor for further processing. Even if the dynamic allocation of processor cores is performed, if the amount of received data of the target network card is still greater than the amount of sent data, it indicates that the processing capacity of the target network card is still insufficient, and there may be problems of data accumulation or processing delay. For example, the target data packets can be determined by a preset relationship, such as a proportional relationship or a difference relationship. For example, the proportion of unprocessed data packets in the total data packets is calculated, and the target data packets are determined according to the proportion. If the proportion of unprocessed data packets exceeds a certain threshold (such as 30%), these unprocessed data packets are sent to the host central processor as target data packets. In this way, the number of target data packets can be dynamically adjusted to avoid accumulation of too many unprocessed data packets on the target network card.

[0034] In this way, by dynamically allocating processor cores and a cooperative processing mechanism, the processing capacity of the target network card and the host can be fully utilized, the data processing efficiency can be improved, and data accumulation and processing delay can be reduced. The dynamic allocation mechanism can be adjusted according to real-time processing requirements, avoid resource waste, improve the overall performance of the system, and transfer part of the tasks from the host CPU to the target network card for processing, thereby reducing the burden on the host CPU and improving the overall performance and response speed of the system.

[0035] According to an embodiment of the present application, the processor cores required by the task processing units are allocated based on the processing capacity of the task processing units on the target network card, including: determining the processing capacity and target allocation number of each task processing unit; in the case where the processing capacity is greater than a preset processing capacity, the processor cores required by the task processing units are allocated based on the current number of processor cores of the task processing units and the target allocation number. The preset processing capacity can be determined according to actual conditions.

[0036] Specifically, when allocating processor cores required by the task processing units according to the processing capacity of the task processing units on the target network card, first, the processing capacity of each task processing unit and the target allocation number are determined, wherein the processing capacity represents the ability of each task processing unit to process data packets, which is usually measured by the number of data packets processed per second or processing speed, and the target allocation number is the number of processor cores preset according to the processing capacity of the task processing unit, which is used to ensure that the task processing unit can run efficiently. For example, the processing capacity of each task processing unit can be evaluated through performance testing or historical data, for example, the performance of each task processing unit under different loads can be measured by running a benchmark test. According to the processing capacity of the task processing unit, a target allocation number can be set to ensure that each task processing unit can run efficiently, for example, if the processing capacity of task processing unit A is high, more processor cores can be allocated to it.

[0037] For each task processing unit, the size relationship between its processing capacity and the preset processing capacity can be compared, and in the case where the processing capacity is greater than the preset processing capacity, the processor cores required by the task processing unit can be allocated according to the current number of processor cores of the task processing unit and the target allocation number. The preset processing capacity is a threshold value used to determine whether the current number of processor cores of the task processing unit is allocated too much, i.e., the processing capacity is greater than the preset processing capacity, which means that the current task processing unit has strong processing capacity and may have been allocated too many processor cores (over allocation). This can lead to resource waste because the number of allocated cores exceeds the actual demand. Therefore, in order to optimize resource allocation, the allocation of processor cores needs to be adjusted according to the actual processing capacity of the task processing unit and the target allocation number to ensure efficient use of resources.

[0038] For example, the target allocation number of task processing unit A is 3 processor cores, and the current allocation number is 4 processor cores, so it can be determined that task processing unit A has been over allocated by 1 processor core, so the processor can be used to allocate processor cores to other task processing units, for example, at this time the target allocation number of task processing unit B is 3 processor cores, and the current allocation number is only 2 processor cores, so the excess processor cores of task processing unit A can be allocated to task processing unit B. In this way, by dynamically adjusting the allocation of processor cores, each task processing unit can obtain sufficient computing resources while avoiding resource waste.

[0039] According to one embodiment of the present application, processor cores required by a task processing unit are allocated based on the current number of processor cores of the task processing unit and the target allocation number, including: determining a task processing unit that does not meet the target allocation number among multiple task processing units as a first target task processing unit; and allocating processor cores to the first target task processing unit based on the difference between the number of processor cores and the target allocation number.

[0040] Specifically, when allocating the processor cores required by a task processing unit based on the current number of processor cores in the task processing unit and the target allocation number, a task processing unit that does not meet the target allocation number is first identified among the multiple task processing units as a first target task processing unit. For example, the current number of allocated cores can be obtained by querying a system resource manager or hardware monitoring tool. For each task processing unit, the current allocation number is compared with the target allocation number. If the current allocation number is less than the target allocation number, the task processing unit is marked as the first target task processing unit.

[0041] Assume that the target network card has four task processing units, and the current allocation and target allocation for each unit are as follows: Task processing unit A: Current allocation is 2 cores, target allocation is 3 cores. Task processing unit B: Current allocation is 2 cores, target allocation is 2 cores. Task processing unit C: Current allocation is 1 core, target allocation is 2 cores. Task processing unit D: Current allocation is 1 core, target allocation is 1 core. By comparison, the current allocations of task processing units A and C are less than their target allocations, so they are marked as the first target task processing unit.

[0042] After determining the first target processing task unit, processor cores can be allocated to the first target task processing unit based on the difference between the number of processor cores and the target allocation number. That is, the difference between the target allocation number and the current allocation number represents the number of processor cores to be allocated. In other words, the number of processor cores in the first target task processing unit is dynamically adjusted based on the difference. Thus, based on the above example, processor core allocation can be determined for task processing unit A and task processing unit C.

[0043] Therefore, by dynamically adjusting the allocation of processor cores, it is ensured that each task processing unit can obtain sufficient computing resources while avoiding resource waste, so that the target network card can process network tasks more efficiently and improve the overall performance and efficiency of the system.

[0044] According to one embodiment of the present application, determining the processing capacity of each task processing unit includes: obtaining the number of data packets processed by a single processor core corresponding to each task processing unit and the time taken by the single processor core to process the number of data packets last time; and determining the processing capacity of each task processing unit based on the ratio of the number of data packets to the time.

[0045] Specifically, when determining the processing capacity of each task processing unit, the number of data packets processed by a single processor core corresponding to each task processing unit and the time taken by the single processor core to process the data packets can be obtained. For example, the number of data packets processed last time can be obtained through the performance counter or log records of the task processing unit. For example, a hardware performance counter or software log can be used to record the number of data packets processed by each task processing unit. The time taken by a single processor core to process these data packets can be obtained through the performance counter or log records of the task processing unit. For example, a high-precision clock or hardware performance counter can be used to record the processing time.

[0046] After determining the number of packets and the processing time, the processing capacity of each task processing unit can be determined based on the ratio of the number of packets to the processing time. This is the task processing unit's ability to process packets per unit of time, typically measured in packets processed per second (packets / second). For example, for task processing unit A, if its single processor core processes 1000 packets and takes 10 seconds to process, the processing capacity can be determined to be 1000 / 10 = 100 packets / second.

[0047] The actual number of packets and processing time used to accurately assess the processing capacity of each task processing unit can be used to dynamically adjust resource allocation based on this processing capacity, ensuring that each task processing unit can operate efficiently. This accurate assessment of each task processing unit's processing capacity provides a basis for subsequent resource allocation.

[0048] According to one embodiment of the present application, determining the target allocation quantity for each task processing unit includes: determining the total number of processor cores based on the target network card; and determining the target allocation quantity based on the processing capacity of each task processing unit and the total number of processor cores.

[0049] Specifically, when determining the target allocation quantity for each task processing unit, the total number of processor cores can be determined based on the target network card. The number of processor cores available on the target network card can be detected through hardware configuration or system tools. When the system is initialized, the total number of processor cores of the target network card is recorded. After determining the total number of processor cores, the target allocation quantity can be determined based on the processing power of each task processing unit and the total number of processor cores. For example, the target allocation quantity can be determined through a pre-set correspondence, for example, the relationship between the processing power of each task processing unit and the total number of processor cores and the target allocation quantity is pre-determined. After the processing power of each task processing unit and the total number of processor cores are determined, the target allocation quantity can be obtained by directly calling the correspondence.

[0050] Therefore, through dynamic allocation based on processing power, it can be ensured that each task processing unit can obtain the number of processor cores that matches its processing power, thereby improving resource utilization.

[0051] According to one embodiment of the present application, the target allocation quantity is determined based on the processing capacity of each task processing unit and the total number of processor cores, including: determining the reciprocal of the processing capacity of each task processing unit and calculating the sum of the reciprocals of the processing capacity of all task processing units; determining the ratio of the total number of processor cores to the processing capacity of each task processing unit; and determining the target allocation quantity based on the result of multiplying the ratio by the sum of the reciprocals.

[0052] Specifically, when determining the target allocation quantity based on the processing capacity of each task processing unit and the total number of processor cores, the reciprocal of the processing capacity of each task processing unit can be determined, and the sum of the reciprocals of the processing capacities of all task processing units can be calculated. Furthermore, a ratio of the total number of processor cores to the processing capacity of each task processing unit can be determined, and the target allocation quantity can be determined based on the product of the ratio and the sum of the reciprocals.

[0053] For example, the target allocation quantity can be determined by the following formula.

[0054] (1)

[0055] in, represents the target number of allocated processing units for each task, Indicates the processing power of a single processor core in each task processing unit (i can be a value from 1 to n), Indicates the total number of processor cores.

[0056] This ensures that each task processing unit can obtain the number of processor cores that matches its processing capabilities, thereby improving resource utilization.

[0057] It should be noted that when determining the above formula (1), it can be determined in the following way. That is, by formula (2): , determine the throughput of each task processing unit, where, represents the target number of allocated processing units for each task, Indicates the processing power of a single processor core in each task processing unit. During task processing, the performance bottleneck is the slowest task processing unit, that is, the total throughput is equal to the lowest throughput of all task processing units. Based on this basic fact, the goal of the target network card is to make the throughput of each task processing unit Equal, we can determine formula (3): .

[0058] Combining formula (2) and formula (3), formula (4) can be obtained by summing all processor cores assigned to each task processing unit:

[0059]

[0060] (4),

[0061] Finally, the two sides of formula (4) are and By exchanging the positions, we can obtain the above formula (1).

[0062] According to one embodiment of the present application, in the process of allocating processor cores to the first target task processing unit, the data processing method also includes: determining a task processing unit that exceeds the target allocation number among multiple task processing units as a second target task processing unit; and controlling the data packets of the newly received network task to stop entering the second target task processing unit.

[0063] Specifically, during the process of allocating processor cores to the first target task processing unit, task processing units that exceed the target allocation number may be identified among the multiple task processing units and marked as second target task processing units. That is, each task processing unit has a target allocation number, which is a pre-set number of processor cores based on the complexity of the task and the expected load. During the dynamic resource allocation process, the number of processor cores actually allocated to each task processing unit may be adjusted based on the current load. The actual allocation number of each task processing unit is compared with the target allocation number. If the actual allocation number is greater than the target allocation number, the task processing unit is marked as the second target task processing unit.

[0064] Suppose the target network card has 8 processor cores, which need to be allocated to 4 task processing units. The target allocation quantity for each task processing unit is as follows: Task processing unit A: Target allocation quantity is 2 cores. Task processing unit B: Target allocation quantity is 2 cores. Task processing unit C: Target allocation quantity is 2 cores. Task processing unit D: Target allocation quantity is 2 cores. During dynamic resource allocation, the actual allocation quantities are as follows: Task processing unit A: 3 cores actually allocated, Task processing unit B: 2 cores actually allocated, Task processing unit C: 2 cores actually allocated, Task processing unit D: 1 core actually allocated. By comparison, Task processing unit A's actual allocation quantity (3 cores) is greater than its target allocation quantity (2 cores), so Task processing unit A is marked as the second target task processing unit.

[0065] Once the second target task processing unit is determined, it is necessary to control the newly received network task data packets to stop entering the unit. This can prevent the load of the unit from increasing further while freeing up resources for other task processing units. For example, a filtering mechanism can be set at the entrance of the target network card to check the target task processing unit of each newly received data packet. If the target task processing unit of the data packet is the second target task processing unit, the data packet is redirected to other task processing units or temporarily stored in a buffer. The load of the second target task processing unit is checked regularly. If its load is reduced to a reasonable range, the data packet can be allowed to enter again. If the load of other task processing units is too high, the data packet allocation strategy can be further adjusted.

[0066] For example, if the target task processing unit of a data packet is task processing unit A, the data packet is redirected to task processing unit B, C, or D, or temporarily stored in a buffer. The load of task processing unit A is checked regularly. If its load drops to a reasonable range (for example, the actual allocation quantity drops to the target allocation quantity), the data packet can be allowed to enter task processing unit A again. If the load of task processing unit B, C, or D is too high, the data packet allocation strategy can be further adjusted to ensure the overall load balance of the system. Therefore, by controlling newly received data packets to stop entering task processing units that exceed the target allocation quantity, further increase in the load of the unit can be avoided, ensuring the overall load balance of the system.

[0067] According to one embodiment of the present application, the data processing method also includes: determining the initial process information of the processor core before allocating the processor core to the first target task processing unit; and sending the initial process information to the allocated processor core after allocating the processor core to the first target task processing unit.

[0068] Specifically, before allocating processor cores to the first target task processing unit, the initial process information for these processor cores must be determined. Initial process information refers to configuration information, task parameters, and context environments that need to be loaded or initialized before a processor core begins executing a task. Specifically, the task parameters that each processor core needs to process, such as the type, size, and priority of the packet, must be determined. The initial context environment for the processor core, including memory allocation, register status, and task queues, must be set. Configuration files related to the task processing unit must be loaded. These files may contain specific rules and parameters for task processing. Assume that the target network card has eight processor cores, which need to be allocated to four task processing units, with two cores allocated to each task processing unit. Prior to allocation, the initial process information for each core must be determined: the type, size, and priority of the packet that each core needs to process, as well as each core's initial memory allocation, register status, and task queue. Finally, the configuration files related to each task processing unit must be loaded.

[0069] After assigning processor cores to the first target task processing unit, the determined initial process information is sent to the assigned processor cores. This step ensures that each processor core has been loaded with the correct configuration information and task parameters before it begins task execution. For example, the initial process information can be sent to the assigned processor cores through the target network card's internal communication mechanisms (such as register writes), ensuring that all processor cores begin task execution synchronously after receiving the initial process information. Assuming that the processor cores of the target network card have been assigned to task processing units, with each task processing unit assigned two cores, the initial process information needs to be sent to each core after assignment.

[0070] This ensures that each processor core has loaded the correct configuration information and task parameters before starting to execute a task, enhancing task processing capabilities, enabling the target network card to process network tasks more efficiently, and improving the overall performance and efficiency of the system.

[0071] According to one embodiment of the present application, a target data packet is determined based on the total data packets of a network task and the data packets processed by a target network card, including: determining a data packet difference between the total data packets of the network task and the data packets processed by the target network card, wherein the data packet difference represents the number of data packets that have not been processed by the target network card; and determining the target data packet based on the data packet difference.

[0072] Specifically, when determining the target data packet based on the total number of data packets in the network task and the number of data packets processed by the target network card, a packet difference is determined between the total number of data packets in the network task and the number of data packets processed by the target network card. The difference between the total number of data packets in the network task and the number of data packets processed by the target network card represents the number of data packets that have not yet been processed by the target network card. By monitoring the network task traffic, the total number of all data packets that need to be processed in the current task is recorded. For example, the total number of data packets can be obtained through network interface statistics or a task management module. The number of data packets successfully processed and sent by the target network card is recorded by monitoring the processing status of the target network card. For example, the number of processed data packets can be obtained through hardware counters or software logs of the target network card. Thus, the packet difference can be determined as: total number of data packets in the network task - number of data packets processed by the target network card. Assuming that the total number of data packets in the network task is 1000 and the target network card has processed 600 data packets, the packet difference is determined to be 400, indicating that the target network card still has 400 data packets to process.

[0073] Based on the packet difference, the data packets that need to be sent to the host's central processing unit for processing are selected. For example, the target data packets are transmitted to the host via direct memory access or other high-speed communication mechanisms. Furthermore, the number of packet differences can be determined. If the packet difference exceeds a certain threshold (e.g., 100 packets), some or all of the unprocessed packets are selected as target packets. For example, the first 100 packets in the packet difference can be selected as target packets. This allows the selection of packets for processing based on the packet difference, reducing the processing burden on the target network card and optimizing overall system performance. The target packet selection strategy can be flexibly adjusted to suit different task requirements and load conditions, improving the system's adaptability and flexibility.

[0074] According to one embodiment of the present application, the data processing method also includes: determining a target data packet allocation strategy based on at least one of the data packet type, data packet size and data packet priority in the total data packet; and allocating the total data packet to the target network card and the central processing unit of the host side for processing based on the target data packet allocation strategy.

[0075] Specifically, when determining which target network card and host-side central processing unit (CPU) should process a data packet, a target data packet allocation strategy can be determined based on at least one of the packet type, packet size, and packet priority within the total data packets. For example, the type of the packet can be used to determine whether to allocate the packet to the target network card or the host-side CPU for processing. The client and server jointly develop data packet classification rules, classifying the packets into different types and setting specific flags in the packet headers. The server-side network card then distributes the packets to different queues based on the flags, and provides different processing strategies for each queue.

[0076] Packet size can also be used to determine whether to assign packets to the target network card or the host's central processing unit (CPU) for processing. This involves setting one or more size thresholds to allocate packets to different queues based on their size. Packet priority can also be used to determine whether to assign packets to the target network card or the host's CPU for processing. A priority tag can be set in the packet header to identify the packet's priority. Packets are then assigned to different priority queues based on the tag, with packets in higher-priority queues being processed first.

[0077] Therefore, by allocating data packets based on their type, size, and priority, we can ensure that each data packet is allocated to the most suitable processing unit, thereby improving resource utilization. By allocating data packets according to their characteristics, we can improve the overall task processing capability of the system.

[0078] According to one embodiment of the present application, the host side and the target network card deploy the same task processing chain, and send the target data packet to the central processing unit of the host side for processing, including: sending the target data packet to the central processing unit based on the task processing chain, so that the central processing unit verifies and parses the target data packet.

[0079] Specifically, the host and target network cards deploy the same task processing chain (e.g., offload chain). This is a mechanism that sequentially connects multiple task processing units (e.g., offload engines) to efficiently process network tasks. Each task processing unit is responsible for processing a specific type of network packet or task and passing the processing results to the next task processing unit. Each task processing unit (e.g., offload engine) is responsible for handling a specific type of network task, such as packet parsing, protocol processing, and data encryption / decryption. Task processing units are connected through a chain structure to form a task processing chain. After processing data, each task processing unit passes the results to the next task processing unit. The task processing chain can dynamically adjust the allocation of task processing units based on the task load to optimize performance.

[0080] In SmartNICs, task processing chains are used to efficiently process network packets and reduce the burden on the host CPU. During system initialization, a task processing chain is constructed, sequentially connecting task processing units. When a target packet is identified for processing, it is sent to the host's central processing unit (CPU) via the task processing chain. Upon receipt, the CPU verifies and parses the packet to ensure its integrity and correctness.

[0081] Therefore, through the task processing chain, the target network card can efficiently handle network tasks and send the target data packets that need further processing to the host-side central processing unit for verification and analysis. This method can significantly improve the overall performance and efficiency of the system.

[0082] According to one embodiment of the present application, the data processing method further includes: determining the number of processor cores based on the target network card; and evenly distributing the processor cores to the task processing units based on the number of processor cores when the execution components of the task processing units are updated or redeployed.

[0083] Specifically, the number of processor cores available for task processing in a target NIC (such as a SmartNIC) is determined based on its hardware design and task processing requirements. This means that a target NIC typically integrates multiple processor cores. During system initialization, the number of available processor cores is determined through hardware configuration and software testing. During runtime, the number of processor cores allocated to each task processing unit is dynamically adjusted by monitoring the load of the task processing unit.

[0084] When the execution components of a task processing unit (such as the offload engine) are updated or redeployed, processor cores can be evenly distributed to the task processing units based on the number of processor cores. Specifically, when the execution components are updated or redeployed, the processor cores on the target NIC are evenly distributed to each task processing unit. For example, if the target NIC has 8 processor cores and 4 task processing units, each task processing unit is allocated 2 cores.

[0085] It should be noted that the execution component of a task processing unit, such as the offload engine, is a task processing unit on the target NIC (such as a SmartNIC) responsible for performing specific network tasks. It is typically a software module or hardware unit capable of independently processing specific types of network packets or tasks. For example, it can handle parsing and encapsulation of network protocols (such as TCP / IP), parsing and forwarding packets, performing operations such as packet filtering and classification, and performing specific network tasks such as data encryption / decryption, compression / decompression, etc. By offloading some network tasks from the host CPU to the offload engine on the SmartNIC, the burden on the host CPU is reduced, improving overall system performance and efficiency. Updating or redeploying the offload engine refers to modifying the offload engine's software or configuration to improve its functionality, performance, or compatibility. Updates may include updating the offload engine's firmware or software code to fix vulnerabilities, add new features, or optimize performance, or adjusting the offload engine's configuration parameters to adapt to new network environments or task requirements. Redeployment refers to deploying a new offload engine module or configuration to the target NIC, replacing the old one. Redeployment may include replacing an old offload engine module with a new one, initializing the new offload engine module, and ensuring its normal operation.

[0086] Therefore, when the task processing units are updated or redeployed, evenly distributing the processor cores can ensure that each task processing unit can run efficiently, thereby enhancing the task processing capability of the target network card.

[0087] Furthermore, in one embodiment of the present application, to avoid frequent reallocations caused by dynamic workloads, the system sets a minimum reallocation interval, for example, one second. This means that if the system immediately reallocates resources every time a load change is detected, system resources (such as CPU time and memory) will be consumed, and frequent reallocations will increase system overhead. To avoid these issues, the system sets a minimum interval to ensure a certain amount of time between resource reallocations. This reduces unnecessary reallocations and improves system stability and performance. During each resource reallocation, the current timestamp is recorded. The next time a load change is detected, the difference between the current time and the timestamp of the last resource reallocation is checked. If the difference is less than the minimum interval, the resource reallocation is skipped; otherwise, the resource reallocation is performed. This ensures that the task processing unit maintains stable resource allocation within a certain period of time, improves task processing efficiency, reduces the number of resource reallocations, and reduces system overhead, resulting in more efficient resource allocation and improved overall performance and stability.

[0088] In summary, the target network card is the smart network card, combined with Figure 2 Instructions for task scheduling and processor core allocation. The host-side offload chain is responsible for handling tasks offloaded from the SmartNIC to the host CPU. This can include complex data processing tasks that cannot be efficiently completed by the SmartNIC, as well as data tasks that the SmartNIC has not yet completed. The host-side offload engine is a software or hardware module on the host that is used to perform specific data processing tasks.

[0089] Inbound traffic is the point at which network packets enter the SmartNIC and can affect inbound throughput metrics. Outbound traffic refers to packets flowing from the SmartNIC to the external network, including responses to client requests, file transfers, and emails. The scheduler on the SmartNIC manages and schedules packet processing on the SmartNIC, determining which tasks are processed on the SmartNIC and which tasks are sent to the host. The offload chain on the SoC is a series of processing units on the SmartNIC that perform tasks such as packet preprocessing, protocol parsing, and data encryption / decryption. Offloading Engines (OEs) 1, 2, and 3 represent different offloading engines (task execution components on the task processing units), each responsible for different data processing tasks. Offloading Agents (OAs) 1, 2, and 3 represent offloading agents (task processing units) that connect different offloading engines and may be responsible for task queuing and scheduling. An SoC is a system-on-chip (SoC) containing multiple processor cores that execute various tasks on the SmartNIC. The core allocator is responsible for allocating processor cores on the SoC to different task processing units to optimize resource utilization and processing efficiency. The outbound engine is responsible for sending processed data packets to the network.

[0090] As a result, network packets enter the SmartNIC as inbound traffic. The scheduler evaluates the packets and determines how to handle them. This decision may be based on factors such as packet type, size, and priority. The packets are first sent to the first offload engine (OE1) in the offload chain on the SoC. Each offload engine (OE1, OE2, OE3) performs specific tasks, such as protocol processing and data encryption. The offload agents (OA1, OA2, OA3) manage the flow of tasks between offload engines. The core allocator dynamically allocates processor cores on the SoC based on the needs of the task processing units and the current load. Packets flow through the offload chain on the SoC and are processed by multiple offload engines.

[0091] When the task scheduler detects a backlog in the receive queue on the SoC, it suspends all OAs and starts the core allocator. The core allocator reallocates SoC cores to different OAs in the optimal ratio based on resource requirements. In this way, all performance can be balanced, maximizing core efficiency. If the SmartNIC still cannot meet the workload's resource requirements after reallocating SoC resources, that is, the SmartNIC's outbound throughput is still lower than its inbound throughput, the scheduler will forward some packets to the host CPU for co-processing to match the workload's requirements. The host-side offload chain receives the tasks offloaded from the SmartNIC and processes them using the host's resources.

[0092] This demonstrates how the SmartNIC efficiently handles network tasks through offload chains and core dispatchers, while collaborating with the host to handle more complex tasks. This design significantly improves data processing efficiency, reduces the burden on the host CPU, and optimizes overall system performance.

[0093] The following combination Figure 3 To describe the method of this application.

[0094] As a specific example, the data processing method of the present application may include the following steps:

[0095] S101, obtaining the inbound throughput and outbound throughput of the target network card.

[0096] S102: Determine the number of processor cores based on the target network card.

[0097] S103: Determine whether the execution component of the task processing unit has been updated or redeployed. If yes, execute step S104; if not, execute step S105.

[0098] S104 : Evenly distribute the processor cores to the task processing units based on the number of processor cores.

[0099] S105: Determine whether the inbound throughput is greater than the outbound throughput. If yes, execute step S106; if not, execute step S101.

[0100] S106: Determine the processing capacity and target allocation quantity of each task processing unit.

[0101] S107: Determine whether the processing capacity is greater than the preset processing capacity. If yes, execute step S108; if not, execute step S101.

[0102] S108 : Determine, among the plurality of task processing units, a task processing unit that does not meet the target allocation quantity as a first target task processing unit.

[0103] S109 , allocating processor cores to the first target task processing unit based on the difference between the number of processor cores and the target allocation number.

[0104] S110: The inbound throughput is still greater than the outbound throughput. If so, go to step S111; if not, go to step S108.

[0105] S111, determining the data packet difference between the total data packets of the network task and the data packets processed by the target network card end.

[0106] S112, determining a target data packet based on the data packet difference.

[0107] S113, sending the target data packet to the central processing unit of the host for processing.

[0108] In summary, according to the data processing method of the embodiment of the present application, the inbound throughput and outbound throughput of the target network card are obtained. When the inbound throughput is greater than the outbound throughput, the processor cores required by the task processing unit on the target network card are allocated based on the processing capacity of the task processing unit. After the processor cores are allocated, if the inbound throughput is greater than the outbound throughput, the target data packet is determined based on the total data packet of the network task and the data packet processed by the target network card, and the target data packet is sent to the host-side central processing unit for processing. As a result, this method can dynamically allocate processor cores, effectively support task offloading of the target network card, and improve the efficiency of data task offloading.

[0109] Corresponding to the above embodiment, the present application also proposes a non-volatile computer-readable storage medium.

[0110] The non-volatile computer-readable storage medium of the embodiment of the present application stores a program thereon, and when the program is executed by a processor, the above-mentioned data processing method is implemented.

[0111] According to the non-volatile computer-readable storage medium of the embodiment of the present application, by executing the above-mentioned data processing method, it is possible to dynamically allocate processor cores, effectively support task offloading of the target network card, and improve the efficiency of data task offloading.

[0112] Corresponding to the above embodiment, the present application also proposes an electronic device.

[0113] like Figure 4 As shown, the electronic device 200 of the embodiment of the present application may include: a memory 210, a processor 220, and a program stored in the memory 210 and executable on the processor 220. When the processor 220 executes the program, the above-mentioned data processing method is implemented.

[0114] According to the electronic device of the embodiment of the present application, by executing the above-mentioned data processing method, it is possible to dynamically allocate processor cores, effectively support task offloading of the target network card, and improve the efficiency of data task offloading.

[0115] Corresponding to the above embodiments, the present application also proposes a computer program product.

[0116] The computer program product of the embodiment of the present application includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the above-mentioned data processing method is implemented.

[0117] According to the computer program product of the embodiment of the present application, by executing the above-mentioned data processing method, it is possible to dynamically allocate processor cores, effectively support task offloading of the target network card, and improve the efficiency of data task offloading.

[0118] It should be noted that the logic and / or steps represented in flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in another suitable manner if necessary, and then storing it in a computer memory.

[0119] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc.

[0120] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

[0121] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. Throughout the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.

[0122] In this application, unless otherwise specified or limited, the terms "installed," "connected," "connect," "fixed," etc. should be understood in a broad sense. For example, they can refer to fixed connection, detachable connection, or integration; mechanical connection or electrical connection; direct connection or indirect connection through an intermediate medium; internal communication between two elements or interaction between two elements, unless otherwise specified. Those skilled in the art will understand the specific meanings of the above terms in this application based on specific circumstances.

[0123] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A data processing method, characterized in that: Applied to a target network card, the method includes: Obtaining the inbound throughput and outbound throughput of the target network card; When the inbound throughput is greater than the outbound throughput, allocating processor cores required by the task processing unit based on the processing capability of the task processing unit on the target network card; After allocating the processor cores, if the inbound throughput is greater than the outbound throughput, a target data packet is determined based on the total data packets of the network task and the data packets processed by the target network card, and the target data packet is sent to the central processing unit of the host for processing.

2. The data processing method according to claim 1, wherein: The allocating processor cores required by the task processing unit based on the processing capability of the task processing unit on the target network card includes: determining the processing capacity and target allocation quantity of each of the task processing units; In a case where the processing capacity is greater than the preset processing capacity, the processor cores required by the task processing unit are allocated based on the current number of the processor cores of the task processing unit and the target allocation number.

3. The data processing method according to claim 2, characterized in that: The allocating the processor cores required by the task processing unit based on the current number of processor cores of the task processing unit and the target allocation number includes: Determine, among the plurality of task processing units, a task processing unit that does not meet the target allocation quantity as a first target task processing unit; The processor cores are allocated to the first target task processing unit based on a difference between the number of processor cores and the target allocation number.

4. The data processing method according to claim 2, wherein: Determining the processing capability of each task processing unit includes: Obtaining the number of data packets processed by a single processor core corresponding to each task processing unit last time and the time taken by the single processor core to process the number of data packets; The processing capability of each task processing unit is determined based on a ratio of the number of data packets to the time.

5. The data processing method according to claim 2, wherein: Determining the target allocation quantity of each task processing unit includes: Determining the total number of processor cores based on the target network card; The target allocation quantity is determined based on the processing capability of each of the task processing units and the total number of the processor cores.

6. The data processing method according to claim 5, characterized in that: The determining the target allocation quantity based on the processing capability of each of the task processing units and the total number of the processor cores includes: determining the reciprocal of the processing capability of each of the task processing units, and calculating the sum of the reciprocals of the processing capabilities of all the task processing units; determining a ratio of the total number of processor cores to the processing capability of each of the task processing units; The target dispensing quantity is determined based on a result of multiplying the ratio by the sum of the reciprocals.

7. The data processing method according to claim 3, characterized in that: In the process of allocating the processor core to the first target task processing unit, the method further includes: determining, from the plurality of task processing units, the task processing units exceeding the target allocation quantity as second target task processing units; Control the data packets of the newly received network task to stop entering the second target task processing unit.

8. The data processing method according to claim 3, characterized in that: The method further comprises: Before allocating the processor core to the first target task processing unit, determining initial process information of the processor core; After allocating the processor core to the first target task processing unit, the initial process information is sent to the allocated processor core.

9. The data processing method according to claim 1, wherein: The determining of the target data packet based on the total data packets of the network task and the data packets processed by the target network card includes: Determine a data packet difference between the total data packets of the network task and the data packets processed by the target network card, wherein the data packet difference represents the number of data packets not processed by the target network card; The target data packet is determined based on the data packet difference.

10. The data processing method according to claim 9, characterized in that: The method further comprises: determining a target data packet allocation strategy based on at least one of a data packet type, a data packet size, and a data packet priority in the total data packets; The total data packet is distributed to the target network card and the central processing unit of the host for processing based on the target data packet distribution strategy.

11. The data processing method according to claim 1, wherein: The host side and the target network card deploy the same task processing chain, and the sending of the target data packet to the central processing unit of the host side for processing includes: The target data packet is sent to the central processor based on the task processing chain, so that the central processor verifies and parses the target data packet.

12. The data processing method according to claim 1, wherein: The method further comprises: Determining the number of the processor cores based on the target network card; When the execution components of the task processing units are updated or redeployed, the processor cores are evenly distributed to the task processing units based on the number of the processor cores.

13. A non-volatile computer-readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by a processor, the data processing method according to any one of claims 1 to 12 is implemented.

14. An electronic device, characterized in that: include: A memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the data processing method according to any one of claims 1 to 12 is implemented.

15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the data processing method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Network card performance tuning method and device, electronic equipment and nonvolatile storage medium

    CN118316802A

  • CPU core allocation methods and system, device, and storage medium

    WO2024017285A1