Data packet processing method and device applied to virtual machine, equipment and storage medium
By determining a reasonable TCP link packet cutting size between the virtual machine and the host and performing packet segmentation, the problem of low communication efficiency of virtual machine is solved, and more stable and efficient data transmission is achieved.
Patent Information
- Application Number
- CN202510400624.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-03-31
AI Technical Summary
The communication efficiency between virtual machines and other hosts is low. Especially when TCP segmented offloading TSO is enabled, there may be sharding and reorganization problems caused by excessive data packets, which affects transmission stability and efficiency.
By obtaining the target packet cutting size of the TCP link between the target virtual machine and the target host, a reasonable slicing size is determined based on the first packet length and the second packet length, and the data packet segmentation is performed by OVS to ensure that the slicing size is greater than or equal to the target packet cutting size, and data transmission is optimized.
It improves the stability and reliability of data transmission, reduces computing resource consumption and transmission delay, improves the system's network data transmission performance, and adapts to the needs of different network environments.
Smart Images

Figure CN120335933A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular, to the fields of virtual machines, cloud computing, and the like. Background Art
[0002] With the wide application of the network in various fields, a virtual machine is a computer system with complete hardware system functions simulated by software. It runs on a physical computer (host machine) and can install an operating system and application programs like a real computer, providing a flexible, secure, and efficient computing environment for users.
[0003] However, during the communication process between a virtual machine and other hosts, problems such as communication failures may occur. Therefore, how to improve the communication efficiency between a virtual machine and other hosts is a problem faced currently. Summary of the Invention
[0004] The present disclosure provides a data packet processing method, apparatus, device, and storage medium applied to a virtual machine to solve or alleviate one or more technical problems in the prior art.
[0005] In a first aspect, the present disclosure provides a data packet processing method applied to a virtual machine, including:
[0006] For a data packet to be transmitted between a target virtual machine and a target host, when the data packet to be transmitted needs to be transmitted through at least one TCP link between the target virtual machine and the target host and TCP Segmentation Offload (TSO) is enabled, obtaining a target packet splitting size corresponding to the at least one TCP link; the target packet splitting size is determined based on a first packet length and a second packet length allowed by the at least one TCP link; the first packet length is determined based on an Open vSwitch (OVS) between the target virtual machine and the target host; both the first packet length and the second packet length are greater than or equal to the target packet splitting size;
[0007] After splitting the data packet to be transmitted based on the target packet splitting size by the OVS, performing data transmission.
[0008] In a second aspect, the present disclosure provides a data packet processing apparatus applied to a virtual machine, including:
[0009] An obtaining module, configured to obtain a target packet splitting size corresponding to at least one TCP link between a target virtual machine and a target host for a data packet to be transmitted between the target virtual machine and the target host, when the data packet to be transmitted needs to be transmitted through at least one TCP link between the target virtual machine and the target host and TCP Segmentation Offload (TSO) is enabled; the target packet splitting size is determined based on a first packet length and a second packet length allowed by the at least one TCP link; the first packet length is determined based on an Open vSwitch (OVS) between the target virtual machine and the target host; both the first packet length and the second packet length are greater than or equal to the target packet splitting size.
[0010] A processing module, configured to perform data transmission after splitting the data packet to be transmitted based on the target packet splitting size through the OVS.
[0011] In a third aspect, an electronic device is provided, including:
[0012] At least one processor; and
[0013] A memory communicatively connected to the at least one processor; wherein,
[0014] The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute any method in the embodiments of the present disclosure.
[0015] In a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute any method in the embodiments of the present disclosure.
[0016] In a fifth aspect, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, it implements any method in the embodiments of the present disclosure.
[0017] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understandable through the following description. Description of the Drawings
[0018] In the drawings, unless otherwise specified, the same reference numerals throughout the drawings denote the same or similar components or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments provided according to the present disclosure and should not be regarded as limiting the scope of the present disclosure.
[0019] Figure 1It is a schematic diagram of the framework diagram of the data packet processing method applied to a virtual machine according to the first embodiment of the present disclosure;
[0020] Figure 2 It is a schematic flowchart of the data packet processing method applied to a virtual machine according to the second embodiment of the present disclosure;
[0021] Figure 3 It is a schematic diagram of the TCP link according to the third embodiment of the present disclosure;
[0022] Figure 4 It is another schematic flowchart of the data packet processing method applied to a virtual machine according to the fourth embodiment of the present disclosure;
[0023] Figure 5 It is a schematic structural diagram of the data packet processing device applied to a virtual machine according to the fifth embodiment of the present disclosure;
[0024] Figure 6 It is a block diagram of an electronic device for implementing the data packet processing method applied to a virtual machine according to the embodiments of the present disclosure. Detailed Embodiments
[0025] The present disclosure will be further described in detail below with reference to the accompanying drawings. The same reference numerals in the drawings denote elements having the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings do not have to be drawn to scale unless otherwise specified.
[0026] In addition, for a better illustration of the present disclosure, numerous specific details are given in the following detailed embodiments. Those skilled in the art should understand that the present disclosure can be implemented without some specific details. In some instances, methods, means, elements, and circuits well known to those skilled in the art are not described in detail so as to highlight the gist of the present disclosure.
[0027] Furthermore, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present disclosure, "a plurality" means two or more unless otherwise specifically defined.
[0028] In the embodiments of the present disclosure, a data packet processing method applied to a virtual machine is proposed. For ease of understanding, some terms related to the embodiments of the present disclosure are explained, including:
[0029] Virtual Machine (VM): A computing environment created through software simulation, enabling a physical computer to run multiple independent operating systems and applications. A virtual machine can provide isolated computing resources on a single hardware platform, simulating multiple independent computer systems, thereby improving the utilization and flexibility of hardware resources.
[0030] Host machine: The physical computer or server that runs virtualization software (i.e., the aforementioned virtual machine).
[0031] Host: The machine that communicates with the virtual machine via TCP (Transmission Control Protocol) network. It can be a virtual machine or any physical machine in the public network.
[0032] OVS (Open vSwitch, virtual switch): A high-quality multi-layer virtual switch. Widely used in virtualization platforms to connect the virtual network cards of virtual machines (VMs) or containers, enabling communication between virtual networks and the interaction between virtual networks and physical networks.
[0033] DPDK (Data Plane Development Kit): A set of development platforms and interfaces for fast packet processing.
[0034] OVS + DPDK: A network deployment solution for virtualized environments. The OVS program deployed on the host machine receives and sends packets from each port through DPDK at the underlying layer. OVS creates a virtual bridge to connect different network ports. This virtual bridge is the core component of the entire virtual network, responsible for traffic forwarding and switching. The virtual network card (such as virtio-net) of each virtual machine is connected to the virtual bridge of OVS through the vhost-user port. The vhost-user port is a special port type of OVS, which allows the network traffic of the virtual machine to directly bypass the kernel mode and be processed by the user-mode OVS-DPDK.
[0035] NIC (Network Interface Card): Connected to the virtual bridge of OVS through the DPDK driver. Based on this, the traffic of the virtual machine can be forwarded to the physical network card through the virtual bridge and then sent to the external network.
[0036] OVS-DPDK Port: Another port of the virtual bridge, connected to the physical network card. This port is the interface between the virtual network and the physical network, responsible for forwarding the traffic of the virtual machine to the physical network or forwarding external traffic to the virtual machine.
[0037] TSO (TCP Segmentation Offload) is a network optimization technology that allows a physical network interface card (NIC) to automatically split large TCP packets into appropriate packets instead of the operating system (CPU). TCP is the link used for transmission between virtual machines and hosts.
[0038] MTU (Maximum Transmission Unit): In TCP communication, MTU defines the maximum amount of data that a single packet can carry. If the packet sent by the sender exceeds the MTU of a device in the path, the packet will be fragmented.
[0039] MSS (Maximum Segment Size): It represents the length of the maximum data part that can be carried in a TCP segment.
[0040] Virtio: It is an I / O (Input / Output) para-virtualization solution and a set of programs for general I / O device virtualization. Virtio includes a front-end driver and a back-end driver. In the current virtualization environment, vhost-user is the most common implementation method of the Virtio network back-end. This protocol allows qemu (Quick EMUlator) to offload the network packet processing of Virtio devices to any DPDK application (such as OVS-DPDK), and use this efficient user-space back-end by creating a vhost-user port on OVS-DPDK.
[0041] In the embodiments of the present disclosure, the framework diagram of the packet processing method applied to virtual machines is as Figure 1 shown, including virtual machine 11, host 12, hypervisor 13, OVS-DPDK 14, and NIC 15. Among them, at least one virtual machine 11 runs on the hypervisor 13. For each virtual machine 11, it sends the packet to be transmitted through a virtual network interface card (vNIC, such as virtio-net). The packet to be transmitted enters the receive queue of OVS-DPDK 14 through the vhost-user port. OVS-DPDK 14 sends the packet to be transmitted to the host 12 through the NIC 15.
[0042] In the packet processing method applied to virtual machines proposed in the embodiments of the present disclosure, specifically as Figure 2 shown, it can be implemented as:
[0043] S201. For the data packets to be transmitted between the target virtual machine and the target host, when the data packets to be transmitted need to be transmitted through at least one TCP link between the target virtual machine and the target host and TSO is enabled, obtain the target packet splitting size corresponding to at least one TCP link; the target packet splitting size is determined based on the first packet length and the second packet length allowed by at least one TCP link; the first packet length is determined based on the OVS between the target virtual machine and the target host; both the first packet length and the second packet length are greater than or equal to the target packet splitting size.
[0044] During implementation, compare the first packet length and the second packet length. When it is determined that the first packet length is less than the second packet length, determine the first packet length as the target packet splitting size; when it is determined that the first packet length is greater than or equal to the second packet length, determine the second packet length as the target packet splitting size.
[0045] In another embodiment, when it is determined that the first packet length is less than the second packet length, the target packet splitting size can also be less than the first packet length; when it is determined that the first packet length is greater than or equal to the second packet length, the target packet splitting size can also be less than the second packet length.
[0046] S202. After splitting the data packets to be transmitted based on the target packet splitting size through the OVS, perform data transmission.
[0047] During implementation, after determining the target splitting size, compile by the OVS based on the target splitting size, and then split the data packets to be transmitted based on the compiled OVS.
[0048] During implementation, when the target virtual machine sends data packets to be transmitted to the target host, after the target virtual machine and the target host establish a TCP link through a three-way handshake, the data packets to be transmitted enter the receiving queue of OVS-DPDK through the vhost-user port. When the size of the data packets to be transmitted is too large, the OVS-DPDK splits the data packets to be transmitted based on the target packet splitting size. The OVS-DPDK sends the split data packets to be transmitted to the target host through the NIC.
[0049] During implementation, when the target host sends data packets to be transmitted to the target virtual machine, after the virtual machine and the target host establish a TCP link through a three-way handshake, the data packets to be transmitted are transmitted through the NIC and then enter the receiving queue of OVS-DPDK through the OVS-DPDKPort. When the size of the data packets to be transmitted is too large, the OVS-DPDK splits the data packets to be transmitted based on the target packet splitting size corresponding to the TCP link. The OVS-DPDK sends the split data packets to be transmitted to the target virtual machine.
[0050] In the embodiments of the present disclosure, the first packet length allowed by OVS and the second packet length allowed by the TCP link are comprehensively considered to determine the target packet splitting size required for final packet splitting. The target packet splitting size determined in this way is more reasonable. A reasonable packet splitting size avoids the problems of fragmented transmission and recombination caused by overly large data packets, enhances the stability and reliability of data transmission, and improves system compatibility. This method can flexibly adapt to the TCP link between the target virtual machine and the target host. Moreover, the OVS splits the data packets according to this size, effectively optimizing the splitting and transmission of data packets, further improving the transmission efficiency, ensuring that the TSO function can be used normally, and thus improving the network data transmission performance of the system.
[0051] In some embodiments, the first packet length is determined based on the MTU of the target port; the target port is used to connect the physical network card and the virtual bridge in the OVS.
[0052] Among them, the target port is the OVS DPDK Port. In the OVS-DPDK environment, the MTU of the DPDK port can usually be set to a preset number of bytes based on the actual situation.
[0053] In addition, the setting of the MTU should be adjusted according to the specific network environment and requirements to ensure network performance and compatibility.
[0054] When the target port is used to connect the physical network card and the virtual bridge in the OVS, the MTU of the target port refers to the maximum data packet size that the physical network card can transmit in network communication, with the unit of byte.
[0055] In the embodiments of the present disclosure, the first packet length determined based on the MTU of the target port ensures that the split data packets do not exceed the maximum data packet that DPDK can support for transmission. This reduces the operations of data packet fragmentation and recombination caused by MTU mismatch, reduces the consumption of computing resources and transmission latency, and can ensure that for any TCP connection with arbitrary data packet size requirements, it can adaptively adjust the size of the split packets to adapt to TCP connections with arbitrary data packet size requirements.
[0056] In some embodiments, the second packet length is determined based on the maximum packet size that the bottleneck node in the at least one TCP link can transmit.
[0057] During implementation, multiple TCP links can be created between the same target virtual machine and the target device for data transmission. The transmission nodes included in each TCP link may be different. For example, the transmission nodes such as routers and switches passed through may be different, and the maximum packet size allowed by each node may vary. Therefore, the MSS of each TCP link may also vary.
[0058] For each TCP link, through the three-way handshake of the TCP connection channel, compare the MSS of the target virtual machine, the MSS of the target device, and the MSS of the intermediate device, and determine the minimum MSS as the MSS that the bottleneck node in the TCP link can transmit. The MTU that the bottleneck node in the TCP link can transmit can be determined based on Equation (1), and its MTU is determined as the maximum packet size:
[0059] MTU = MSS + IP header length + TCP header length (1)
[0060] Among them, the MTU is the maximum packet size that the bottleneck node in the TCP link can transmit, the MSS is the maximum segment length that the bottleneck node in the TCP link can transmit, the IP (Internet Protocol) header length is the length of the IP packet header, and the TCP header length is the length of the TCP segment header.
[0061] Exemplarily, as Figure 3 shown, in the TCP link from the target virtual machine to the target host, it passes through Router 1 and Router 2. The MSS of the target virtual machine is A, the MSS of the target device is B, the MSS (MTU1 - IP header length - TCP header length) of Router 1 is C, and the MSS (MTU2 - IP header length - TCP header length) of Router 2 is D, where B > A > C > D. In this case, it is necessary to first perform a three-way handshake based on the TCP connection channel between the target virtual machine and the target device to determine the minimum MSS as D, and then combine the IP header length and the TCP header length to determine the maximum packet size that the bottleneck node in the TCP link can transmit.
[0062] In addition, based on the MTU of the target port, the MSS of the target port can be obtained, and the MSS of the target port is determined as the first packet length. In this case, the MSS that the bottleneck node in the TCP link can transmit can be determined as the second packet length, compare the first packet length and the second packet length, and determine the minimum of the two as the target packet splitting size.
[0063] In the embodiments of the present disclosure, the second packet length is determined based on the maximum packet size in the TCP link, realizing that the end-to-end path MTU adapts to the TCP link requirements, thereby realizing high-performance network transmission based on TSO.
[0064] In some embodiments, the at least one TCP link shares the same target packet splitting size; or, each TCP link in the at least one TCP link adopts its own corresponding target packet splitting size.
[0065] In some embodiments, multiple TCP links between the target virtual machine and the target host share the same target packet splitting size, which can be specifically implemented as follows: for each TCP link, based on the second packet length of the TCP link and the first packet length of the target port, determine the target packet splitting size corresponding to the TCP link; screen the minimum target packet splitting size from all TCP links between the target virtual machine and the target host as the target packet splitting size finally used by each TCP link.
[0066] Among them, for each TCP link, the MTU corresponding to the second packet length of each TCP link between the target virtual machine and the target host can be determined; based on the comparison of the MTUs corresponding to each TCP link and the MTU of the target port, determine the minimum value of the two as the target packet splitting size of the TCP link.
[0067] Exemplarily, there are TCP Link 1, TCP Link 2, and TCP Link 3 between the target virtual machine and the target host. The MTU of TCP Link 1 is A, the MTU of TCP Link 2 is B, the MTU of TCP Link 3 is C, and A < B < C, and all are smaller than the MTU of the target port. In this case, the target packet splitting size is A, that is, TCP Link 1, TCP Link 2, and TCP Link 3 share the same target packet splitting size.
[0068] In the embodiments of the present disclosure, multiple TCP links sharing the same target packet splitting size helps to stably transmit data packets in these multiple TCP links. The network device can schedule and forward data packets more efficiently, reducing the probability of transmission failure caused by overly large data packet transmission.
[0069] In another embodiment, in order to improve the flexibility of the target packet splitting size of the TCP link and improve network resource utilization, it can also be implemented as follows: when the at least one TCP link shares the same target packet splitting size, monitor the change of the TCP link between the target virtual machine and the target; follow the dynamic change of the TCP link and dynamically update the target packet splitting size.
[0070] During implementation, the number of TCP links can be monitored. When the number of TCP links between two hosts changes, a reasonable target packet splitting size can be re-determined based on the changed TCP links.
[0071] In the embodiments of the present disclosure, by dynamically monitoring the change of the TCP link between the target virtual machine and the target, and then dynamically adjusting the packet splitting size, it can ensure that data transmission always adapts to the current network condition, thereby maintaining a high transmission efficiency and performance.
[0072] In some embodiments, each TCP link in at least one TCP link adopts its corresponding target packet splitting size, which can be specifically implemented as follows: for each TCP link, based on the second packet length of the TCP link and the first packet length of the target port, select the smaller packet length of the two to determine that the target packet splitting size corresponding to the TCP link is not greater than the smaller packet length.
[0073] In the embodiments of the present disclosure, according to the specific conditions of the link, setting a suitable target packet splitting size for each link can specifically optimize the performance of the link and improve the transmission efficiency.
[0074] In some embodiments, in order to make the target packet splitting size adapt to the network environment as much as possible, when each TCP link adopts its corresponding target packet splitting size, for any one of the at least one TCP link, the target packet splitting size corresponding to the any one TCP link is determined based on the following method, as Figure 4 shown, including:
[0075] S401, establish any one TCP link through three-way TCP handshake negotiation between the target virtual machine and the target host, and obtain the MSS of any one TCP link.
[0076] Among them, obtaining the MSS of any one TCP link has been described above, and the embodiments of the present disclosure will not elaborate on this one by one.
[0077] S402, based on the MSS and the MTU adopted in DPDK in OVS, determine the data packet size applicable to any one TCP link as the target packet splitting size corresponding to any one TCP link.
[0078] Convert the MSS to MTU based on Equation (1), and then compare it with the MTU adopted in DPDK in OVS. When it is determined that the MTU in TCP is greater than the MTU adopted in DPDK in OVS, determine the MTU adopted in DPDK in OVS as the target packet splitting size corresponding to the TCP link. When it is determined that the MTU in TCP is not greater than the MTU adopted in DPDK in OVS, determine the MTU in TCP as the target packet splitting size corresponding to the TCP link.
[0079] In another embodiment, it can also be implemented as: convert the MSS corresponding to the TCP link to MTU; then compare it with the MTU adopted in DPDK in OVS, and determine the smaller of the two as the intermediate packet splitting size, and the target packet splitting size can be smaller than the intermediate packet splitting size.
[0080] In addition, the MTU adopted in DPDK in OVS can be converted into MSS, and then compared with the MSS in TCP. When it is determined that the MSS in TCP is greater than the MSS adopted in DPDK in OVS, the MSS adopted in DPDK in OVS is determined as the target packet splitting size corresponding to the TCP link. When it is determined that the MSS in TCP is not greater than the MSS adopted in DPDK in OVS, the MSS in TCP is determined as the target packet splitting size corresponding to the TCP link.
[0081] In another embodiment, it can also be implemented as: converting the MTU corresponding to the TCP link into MSS; then comparing it with the MSS adopted in DPDK in OVS, and determining the smaller of the two as the intermediate packet splitting size, and the target packet splitting size can be smaller than the intermediate packet splitting size.
[0082] S403, record the association relationship between any TCP link and the target packet splitting size.
[0083] Among them, the TCP link identifier and its corresponding target packet splitting size can be recorded in the association table in the form of key-value pairs to express the association relationship between the two.
[0084] During implementation, for each TCP link, when OVS receives a packet to be transmitted, the first packet length and the second packet length are obtained in real time, and the smaller one of the first packet length and the second packet length is selected as the target packet splitting size.
[0085] In addition, in another embodiment, since the association relationship between the TCP link and the target packet splitting size is stored as described above, it can be implemented as: when OVS receives a packet to be transmitted, based on the TCP link identifier carried by the packet to be transmitted, a match is made in the association table. When the target packet splitting size corresponding to the TCP link identifier is matched in the association table, OVS splits the packet to be transmitted into multiple slices for transmission based on the target packet splitting size.
[0086] In addition, the association table facilitates the management and maintenance of the network. At the same time, when network performance problems or transmission errors occur, by checking the association relationship between the link and the packet splitting size, the problem can be quickly located.
[0087] In the embodiments of the present disclosure, the network conditions of each TCP link may be different. By obtaining the MSS of each link during the three-way TCP handshake, the maximum packet length that the link can support can be accurately understood. Combining with the MTU in OVS-DPDK can further ensure that the determined packet size meets the requirements of TSO and the TCP link, and adapts to the transmission capacity of the underlying network interface, thereby avoiding packet fragmentation and reassembly and improving the efficiency of data transmission. At the same time, setting an appropriate target packet splitting size according to the actual network conditions of each link can make better use of the link bandwidth.
[0088] In the related art, in the case where the solution of the present disclosure is not adopted, when the target virtual machine and the target host enable the TSO feature, the TCP communication process includes: determining the MSS size through the three-way TCP handshake, entering the packet to be transmitted into the receiving queue of OVS-DPDK through the vhost-user port. When the size of the packet to be transmitted is too large, OVS calculates the MSS according to the MTU of the OVS DPDK Port, determines the MSS as the target packet splitting size, and splits the packet to be transmitted. OVS-DPDK sends the split packet to be transmitted to the target host through the NIC. The method in the related art may cause the packet to be too large to be transmitted in the TCP link.
[0089] As can be seen from the above transmission process, the root cause of the low network transmission bandwidth is the unreasonable packet splitting operation of OVS. Therefore, in the packet processing method for virtual machines proposed in the embodiments of the present disclosure, the MSS of the TCP link and the maximum transmission unit MTU adopted in the data plane development kit DPDK in the OVS are considered together to obtain a reasonable target packet splitting size, thereby improving the network transmission efficiency.
[0090] Based on the same technical concept, an apparatus 500 for processing packets applied to a virtual machine is also proposed in the embodiments of the present disclosure, as Figure 5 shown, including:
[0091] An obtaining module 501, configured to obtain a target packet splitting size corresponding to at least one TCP link between a target virtual machine and a target host when a packet to be transmitted between the target virtual machine and the target host needs to be transmitted through at least one TCP link between the target virtual machine and the target host and the TCP segmentation offload (TSO) is enabled; the target packet splitting size is determined based on a first packet length and a second packet length allowed by the at least one TCP link; the first packet length is determined based on an Open vSwitch (OVS) between the target virtual machine and the target host; both the first packet length and the second packet length are greater than or equal to the target packet splitting size;
[0092] A processing module 502, configured to perform data transmission after splitting the data packet to be transmitted based on the target packet splitting size by using the OVS.
[0093] In some embodiments, the first packet length is determined based on the maximum transmission unit (MTU) of the target port; the target port is used to connect a physical network card and a virtual bridge in the OVS.
[0094] In some embodiments, the second packet length is determined based on the maximum packet size that can be transmitted by a bottleneck node in the at least one TCP link.
[0095] In some embodiments, the at least one TCP link shares the same target packet splitting size; or,
[0096] Each TCP link in the at least one TCP link adopts its respective corresponding target packet splitting size.
[0097] In some embodiments, it further includes a size determination module, configured to:
[0098] In the case where each TCP link adopts its respective corresponding target packet splitting size, for any one of the at least one TCP link, determine the target packet splitting size corresponding to the any one TCP link based on the following method:
[0099] Establish the any one TCP link through a three-way TCP handshake negotiation between the target virtual machine and the target host, and obtain the maximum segment size (MSS) of the any one TCP link;
[0100] Based on the MSS and the maximum transmission unit (MTU) adopted in the data plane development kit (DPDK) in the OVS, determine the data packet size applicable to the any one TCP link as the target packet splitting size corresponding to the any one TCP link;
[0101] Record the association relationship between the any one TCP link and the target packet splitting size.
[0102] In some embodiments, it further includes an update module, configured to:
[0103] In the case where the at least one TCP link shares the same target packet splitting size, monitor the change of the TCP link between the target virtual machine and the target;
[0104] Follow the dynamic change of the TCP link and dynamically update the target packet splitting size.
[0105] For the specific functions and examples of the modules and sub-modules of the device according to the embodiments of the present disclosure, reference may be made to the relevant descriptions of the corresponding steps in the above method embodiments, which will not be elaborated herein.
[0106] In the technical solution of the present disclosure, the acquisition, storage, and application of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0107] Figure 6 FIG. is a structural block diagram of an electronic device according to an embodiment of the present disclosure. As Figure 6 shown, the electronic device includes: a memory 610 and a processor 620. A computer program that can run on the processor 620 is stored in the memory 610. The number of the memory 610 and the processor 620 can be one or more. The memory 610 can store one or more computer programs. When the one or more computer programs are executed by the electronic device, the electronic device executes the method provided in the above method embodiment. The electronic device may further include: a communication interface 630, configured to communicate with external devices and perform data interaction and transmission.
[0108] If the memory 610, the processor 620, and the communication interface 630 are implemented independently, the memory 610, the processor 620, and the communication interface 630 can be connected to each other through a bus and complete communication with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 6 only a thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
[0109] Optionally, in a specific implementation, if the memory 610, the processor 620, and the communication interface 630 are integrated on a chip, the memory 610, the processor 620, and the communication interface 630 can complete communication with each other through an internal interface.
[0110] It should be understood that the above-mentioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. It is worth noting that the processor can be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0111] Further, optionally, the above-mentioned memory can include a read-only memory and a random access memory, and can also include a non-volatile random access memory. The memory can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can include a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash memory. The volatile memory can include a Random Access Memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Date SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct RAMBUS RAM (DR RAM).
[0112] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present disclosure are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wirelessly (such as infrared, Bluetooth, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a Digital Versatile Disc (DVD)), or a semiconductor medium (such as a Solid State Disk (SSD)), etc. It should be noted that the computer-readable storage medium mentioned in the present disclosure can be a non-volatile storage medium, in other words, a non-transitory storage medium.
[0113] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the storage medium mentioned above can be a read-only memory, a magnetic disk, an optical disc, etc.
[0114] In the description of the embodiments of the present disclosure, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples", etc. means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present disclosure. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples.
[0115] In the description of the embodiments of the present disclosure, unless otherwise specified, " / " means "or". For example, A / B may mean A or B. "And / or" herein is merely a description of the relationship between associated objects, indicating that there can be three relationships. For example, A and / or B may mean: A exists alone, A and B exist simultaneously, and B exists alone.
[0116] In the description of the embodiments of the present disclosure, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present disclosure, unless otherwise specified, "a plurality of" means two or more.
[0117] The above are only exemplary embodiments of the present disclosure and are not intended to limit the present disclosure. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.
Claims
1. A data packet processing method applied to a virtual machine, comprising: For a data packet to be transmitted between a target virtual machine and a target host, when the data packet to be transmitted needs to be transmitted through at least one TCP link between the target virtual machine and the target host and TCP segmentation offload (TSO) is enabled, obtaining a target packet splitting size corresponding to the at least one TCP link; the target packet splitting size is determined based on a first packet length and a second packet length allowed by the at least one TCP link; the first packet length is determined based on an Open vSwitch (OVS) between the target virtual machine and the target host; both the first packet length and the second packet length are greater than or equal to the target packet splitting size; After splitting the data packet to be transmitted based on the target packet splitting size by the OVS, performing data transmission.
2. The method according to claim 1, wherein The first packet length is determined based on the maximum transmission unit (MTU) of a target port; the target port is used to connect a physical network card and a virtual bridge in the OVS.
3. The method according to claim 1 or 2, wherein The second packet length is determined based on the maximum packet size that a bottleneck node in the at least one TCP link can transmit.
4. The method according to claim 1, wherein The at least one TCP link shares the same target packet splitting size; or, Each TCP link in the at least one TCP link adopts its respective corresponding target packet splitting size.
5. The method according to claim 4, further comprising: When each TCP link adopts its respective corresponding target packet splitting size, for any one TCP link in the at least one TCP link, determining the target packet splitting size corresponding to the any one TCP link based on the following method: Negotiating and establishing the any one TCP link through a three-way TCP handshake between the target virtual machine and the target host, and obtaining the maximum segment size (MSS) of the any one TCP link; Based on the MSS and the maximum transmission unit (MTU) adopted in the data plane development kit (DPDK) in the OVS, determining a data packet size applicable to the any one TCP link as the target packet splitting size corresponding to the any one TCP link; Recording the association relationship between the any one TCP link and the target packet splitting size.
6. The method according to claim 4, further comprising: When the at least one TCP link shares the same target packet splitting size, monitoring the change of the TCP link between the target virtual machine and the target; Following the dynamic change of the TCP link, dynamically updating the target packet splitting size.
7. A data packet processing apparatus applied to a virtual machine, comprising: An acquisition module, configured to, for a data packet to be transmitted between a target virtual machine and a target host, when the data packet to be transmitted needs to be transmitted through at least one TCP link between the target virtual machine and the target host and TCP Segmentation Offload (TSO) is enabled, acquire a target packet splitting size corresponding to the at least one TCP link; the target packet splitting size is determined based on a first packet length and a second packet length allowed by the at least one TCP link; the first packet length is determined based on a virtual switch (OVS) between the target virtual machine and the target host; both the first packet length and the second packet length are greater than or equal to the target packet splitting size. A processing module, configured to split the data packet to be transmitted based on the target packet splitting size through the OVS and then perform data transmission.
8. The apparatus according to claim 7, wherein, The first packet length is determined based on the Maximum Transmission Unit (MTU) of a target port; the target port is used to connect a physical network card and a virtual bridge in the OVS.
9. The apparatus according to claim 7 or 8, wherein The second packet length is determined based on the maximum packet size that a bottleneck node in the at least one TCP link can transmit.
10. The device according to claim 7, wherein, The at least one TCP link shares the same target packet splitting size; or Each TCP link in the at least one TCP link adopts its respective corresponding target packet splitting size.
11. The apparatus according to claim 10, further comprising a size determination module, configured to: When each TCP link adopts its respective corresponding target packet splitting size, for any one TCP link in the at least one TCP link, determine the target packet splitting size corresponding to the any one TCP link based on the following method: Establish the any one TCP link through a three-way TCP handshake negotiation between the target virtual machine and the target host, and acquire the Maximum Segment Size (MSS) of the any one TCP link; Based on the MSS and the Maximum Transmission Unit (MTU) adopted in the Data Plane Development Kit (DPDK) in the OVS, determine a data packet size applicable to the any one TCP link as the target packet splitting size corresponding to the any one TCP link; Record the association relationship between the any one TCP link and the target packet splitting size.
12. The apparatus according to claim 10, further comprising an update module, configured to: When the at least one TCP link shares the same target packet splitting size, monitor the change of the TCP link between the target virtual machine and the target; Follow the dynamic change of the TCP link and dynamically update the target packet splitting size.
13. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the method according to any one of claims 1-6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.
15. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 - 6.
Citation Information
Patent Citations
Data communication method and related device
CN114599089A
Message segment transmission method and device, equipment and medium
CN117579725A
Virtual machine message sending method, device and system and electronic equipment
CN118175114A
Snooping forwarded packets by a virtual machine
US20150263968A1