WO2022160714A1 - 一种通信方法、装置以及系统 - Google Patents

一种通信方法、装置以及系统 Download PDF

Info

Publication number
WO2022160714A1
WO2022160714A1 PCT/CN2021/116145 CN2021116145W WO2022160714A1 WO 2022160714 A1 WO2022160714 A1 WO 2022160714A1 CN 2021116145 W CN2021116145 W CN 2021116145W WO 2022160714 A1 WO2022160714 A1 WO 2022160714A1
Authority
WO
WIPO (PCT)
Prior art keywords
host
virtual machine
virtual
container
storage address
Prior art date
Application number
PCT/CN2021/116145
Other languages
English (en)
French (fr)
Inventor
钟国城
蔡少芝
程宝传
翟健翔
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022160714A1 publication Critical patent/WO2022160714A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Definitions

  • the present application relates to the field of communication, and in particular, to a communication method, apparatus, and system.
  • a virtual machine refers to a complete computer system that is simulated by software, has complete hardware functions, and runs in a completely isolated environment.
  • virtual machine software one or more virtual computers can be simulated on a physical machine.
  • Docker is an open source application container engine that aims to provide an automated deployment solution for applications. It quickly creates a container on a Linux system.
  • a container is a series of processes isolated from other parts of the system.
  • the external data transmitted by the container needs to be forwarded through the container network and the virtual machine network in the virtual machine.
  • the present application provides a communication method, device and system, which transmit the address and length of a data message by sending a notification message, and use a shared storage space to reduce the delay caused by the transmission of data messages between containers.
  • a first aspect of the present application provides a communication method, which may be executed by a first virtual machine, or may be executed by a component of the first virtual machine (for example, a client for sending and receiving packets in the first virtual machine, etc.).
  • the method includes: acquiring a first virtual storage address of a data message and a length of the data message, where the data message is a message communicated between a first container on a first virtual machine and a second container on a second virtual machine , the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the first host or a second host different from the first host; a first notification report is generated according to the first virtual storage address and the length message; send a first notification message to the first host, where the first notification message is used to enable the first host to trigger the second container to acquire the data message.
  • the first virtual storage address where the data message is located and the length of the data message are determined, and a first announcement message is generated according to the first virtual storage address and the length; and a first announcement is sent to the first host message, the first notification message is used to make the first host trigger the second container to acquire the data message.
  • the data message is a message communicated between the first container on the first virtual machine and the second container on the second virtual machine.
  • the address and length of data packets are transmitted by sending advertisement packets instead of frequently copying data packets, which can reduce the delay caused by the transmission of data packets between containers.
  • the data packets in the above steps are stored in a first shared memory, the first virtual storage address points to the first shared memory, and the first virtual storage address points to the first shared memory.
  • the first shared memory, the first host and the second virtual machine share the first shared memory, and the second virtual machine is deployed on the first host; or the first virtual machine shares the first shared memory with the first host, and the second virtual machine is deployed on the second on the host.
  • the host and the virtual machine share the shared memory and the virtual storage address and length to reduce the delay caused by the transmission of data packets between containers.
  • the above steps further include: determining that a new data packet is added to the network card queue of the first container.
  • the network card queue of the first container is used to determine the data packets that need to be transmitted to the second container for the newly added first container.
  • the first notification message in the above steps further includes an identifier of the network card queue, and the identifier of the network card queue is used to identify that the virtual interface corresponding to the second container belongs to the first notification message.
  • the NIC queue of the second container is used to identify that the virtual interface corresponding to the second container belongs to the first notification message.
  • the identification of the network card queues is used for identification, thereby enabling the second container to obtain correct data packets from the first container.
  • determining that a new data packet is added to the network card queue of the first container in the above steps includes: determining that a target storage pointing to the first shared memory is newly added in the network card queue.
  • the first pointer of the space, the target storage space is used to store data packets.
  • the first pointer of the network card queue of the first container is specifically used to determine the data packets that need to be transmitted to the second container when the first container is added.
  • the above-mentioned first pointer becomes invalid after being read.
  • the first pointer becomes invalid after being read, thereby reducing the storage space of the memory.
  • a second aspect of the present application provides a communication method, which can be executed by a first host, or by a component of the first host (for example, a packet sending and receiving server, a processor, a chip, or a chip system in the first host, etc. )implement.
  • the method includes: receiving a first announcement message sent by a first virtual machine, where the first announcement message includes a first virtual storage address corresponding to the data message and the length of the data message, and the data message is a data message on the first virtual machine.
  • the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the first host or a second host different from the first host On; determine the first physical storage address corresponding to the first virtual storage address according to the address mapping table, the first physical storage address is the physical storage address corresponding to the first shared memory where the data message is located, and the address mapping table stores a physical storage address and The correspondence between one or more virtual storage addresses; obtain data packets according to the first physical storage address and length; if the second virtual machine is deployed on the first host, send a second notification packet to the second virtual machine, and the first The second notification message includes a second virtual storage address and a length, the second virtual storage address is converted from the first physical storage address, and the second notification message is used for the second container to obtain the data message.
  • the second virtual machine after receiving the first notification message sent by the first virtual machine, if the second virtual machine is deployed on the first host, the second virtual machine sends a second notification message to the second virtual machine by sending the notification message
  • the address and length of the data packet are transmitted to reduce the delay caused by the transmission of data packets between containers.
  • the above steps further include: if the second virtual machine is deployed on the second host, sending a data packet to the second host.
  • the first virtual machine, the first host, and the second virtual machine in the above steps share the first shared memory, and the second virtual machine is deployed on the first host. ; or the first virtual machine shares the first shared memory with the first host, and the second virtual machine is deployed on the second host.
  • the host and the virtual machine share the shared memory and the virtual storage address and length to reduce the delay caused by the transmission of data packets between containers.
  • a third aspect of the present application provides a communication method, which can be executed by a second host, or by a component of the second host (for example, a packet sending and receiving server, a processor, a chip, or a chip system in the second host, etc. )implement.
  • a component of the second host for example, a packet sending and receiving server, a processor, a chip, or a chip system in the second host, etc.
  • the method includes: receiving a data message from a first host, where the data message is a message communicated between a first container on the first virtual machine and a second container on the second virtual machine, and the first virtual machine is deployed in a On the first host, the second virtual machine is deployed on the second host, and the first host and the second host are different hosts; the third virtual storage address corresponding to the second physical storage address is determined according to the address mapping table, and the data message is stored The physical address is the second physical storage address, and the address mapping table stores the correspondence between a physical storage address and one or more virtual storage addresses; Generate the third notification message according to the third virtual storage address and the length of the data message; A third advertisement packet is sent to the second virtual machine, where the third advertisement packet is used for the second container to obtain the data packet.
  • a data packet from the first host is received, a third advertisement packet is generated according to the third virtual storage address and the length of the data packet, and the third advertisement packet is sent to the second virtual machine.
  • the address and length of data packets are transmitted by sending advertisement packets to reduce the delay caused by the transmission of data packets between containers.
  • the second virtual machine in the above steps shares a second shared memory with the second host, the second virtual machine is deployed on the second host, and the second physical The storage address and the third virtual storage address point to the second shared memory; the second shared memory is used for storing data packets.
  • the host and the virtual machine share the shared memory and the virtual storage address and length to reduce the delay caused by the transmission of data packets between containers.
  • a fourth aspect of the present application provides a communication method, which may be executed by a second virtual machine, or may be executed by a component of the second virtual machine (eg, a client for sending and receiving packets in the second virtual machine, etc.).
  • the method includes: receiving a notification message, the notification message includes a virtual storage address where the data message is located and the length of the data message, and the data message is a first container on a first virtual machine and a second virtual machine on the second virtual machine.
  • the first virtual machine is deployed on the first host
  • the second virtual machine is deployed on the first host or a second host different from the first host; data packets are obtained according to the virtual storage address and length .
  • the address and length of the data message are determined by receiving the notification message, and then the data message is obtained, thereby reducing the delay caused by the transmission of the data message between containers.
  • the advertisement message in the above steps is generated by the first host, the second virtual machine is deployed on the first host, the first virtual machine, the first host and the The second virtual machine shares the first shared memory, and the first shared memory is used for storing data packets.
  • the host and the virtual machine share the shared memory and the virtual storage address and length to reduce the delay caused by the transmission of data packets between containers.
  • the advertisement message in the above steps is generated by the second host, the second virtual machine is deployed on the second host, and the second virtual machine and the second host share the same.
  • the second shared memory is used for storing data packets.
  • the host and the virtual machine share the shared memory and the virtual storage address and length to reduce the delay caused by the transmission of data packets between containers.
  • the notification message in the above steps further includes an identifier of the network card queue, and the identifier of the network card queue is used to identify that the virtual interface corresponding to the second container belongs to the second container.
  • NIC queue is used to identify that the virtual interface corresponding to the second container belongs to the second container.
  • the identification of the network card queues is used for identification, thereby realizing that the second container obtains correct data packets from the first container.
  • the above steps further include: writing the second pointer into the network card queue of the second container, so that the second container obtains the data packet, and the second pointer points to the first A target storage space of the shared memory or the second shared memory, where the target storage space is used to store data packets.
  • the second pointer of the network card queue is added to the first container, so that the second container acquires the data packet according to the second pointer.
  • a fifth aspect of the present application provides a communication system, the communication system includes a first virtual machine, a first host, and a second virtual machine: the first virtual machine is used to obtain a first virtual storage address of a data packet and a data packet The length of the message, the data message is the message communicated between the first container on the first virtual machine and the second container on the second virtual machine, the first virtual machine is deployed on the first host, and the second virtual machine is deployed On the first host or a second host different from the first host; the first virtual machine is further configured to generate a first advertisement message according to the first virtual storage address and the length; the first virtual machine is further configured to use The first notification message is sent to the first host, where the first notification message is used to make the first host trigger the second container to obtain the data message.
  • the first host in the above communication system is configured to determine the first physical storage address corresponding to the first virtual storage address according to the address mapping table, and the first physical storage The address is the physical storage address corresponding to the storage space where the data message is located, and the address mapping table stores the correspondence between one physical storage address and one or more virtual storage addresses; Get data packets.
  • the first host in the above communication system is further configured to send the second virtual machine to the second virtual machine if the second virtual machine is deployed on the first host.
  • a notification message the second notification message includes a second virtual storage address and a length, the second virtual storage address is converted from the first physical storage address, and the second notification message is used for the second container to obtain the data message; the first host , and is further configured to send a data packet to the second host if the second virtual machine is deployed on the second host.
  • the above communication system further includes: a second host, configured to convert the second physical storage address into a third virtual storage address according to the address mapping table, and the data message
  • the physical address of the storage space is the second physical storage address, and the address mapping table stores the correspondence between one physical storage address and one or more virtual storage addresses;
  • the second host is also used for the third virtual storage address and the datagram
  • the length of the message is used to generate a third notification message;
  • the second host is further configured to send a third notification message to the second virtual machine, and the third notification message is used for the second container to obtain the data message.
  • the second virtual machine in the above communication system is configured to receive the second virtual machine sent by the first host if the second virtual machine is deployed on the first host.
  • the notification message; the second virtual machine is further configured to acquire the data message according to the second virtual storage address and the length.
  • the second virtual machine in the above communication system is deployed on the second host, and the second virtual machine is used to receive the third advertisement message sent by the second host. ; the second virtual machine is further configured to acquire the data message according to the third virtual storage address and the length.
  • a sixth aspect of the present application provides a communication apparatus, where the communication apparatus may be a first virtual machine. It may also be a component of the first virtual machine (for example, a client for sending and receiving packets in the first virtual machine, etc.), and the communication device includes: an obtaining unit for obtaining the first virtual storage address of the data message and the length of the data message , the data message is a message communicated between the first container on the first virtual machine and the second container on the second virtual machine, the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the first virtual machine a host or a second host different from the first host; a generating unit, configured to generate a first advertisement message according to the first virtual storage address and the length; a sending unit, configured to send the first advertisement to the first host message, the first notification message is used to make the first host trigger the second container to acquire the data message.
  • the communication apparatus may be a first virtual machine. It may also be a component of the first virtual machine (for example, a client for sending and receiving
  • the above data packets are stored in the first shared memory, the first virtual storage address points to the first shared memory, the first virtual machine, the first host and the second virtual machine shares the first shared memory, and the second virtual machine is deployed on the first host; or the first virtual machine shares the first shared memory with the first host, and the second virtual machine is deployed on the second host; the first The shared memory is used for storing data packets, and the first virtual storage address points to the first shared memory.
  • the above-mentioned communication apparatus further includes: a determining unit configured to determine that a new data packet is added to the network card queue of the first container.
  • the first notification message in the above further includes an identifier of the network card queue, and the identifier of the network card queue is used to identify that the virtual interface corresponding to the second container belongs to the second container.
  • the container's NIC queue is used to identify that the virtual interface corresponding to the second container belongs to the second container.
  • the determining unit in the above is specifically configured to determine the newly added first pointer to the target storage space of the first shared memory in the network card queue, and the target storage space is for storing data packets.
  • the above-mentioned first pointer becomes invalid after being read.
  • a seventh aspect of the present application provides a communication device, where the communication device may be a first host. It can also be a component of the first host (a packet sending and receiving server, a processor, a chip, or a chip system in the first host), and the communication device includes: a receiving unit, configured to receive the first notification sent by the first virtual machine.
  • the first notification message includes the first virtual storage address corresponding to the data message and the length of the data message, and the data message is the first container on the first virtual machine and the second container on the second virtual machine.
  • the message of inter-communication the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the first host or a second host different from the first host; the determining unit is configured to determine the first host according to the address mapping table.
  • the first physical storage address corresponding to the virtual storage address is the physical storage address corresponding to the first shared memory where the data packet is located, and the address mapping table stores the correspondence between one physical storage address and one or more virtual storage addresses relationship; an obtaining unit, configured to obtain a data message according to the first physical storage address and the length; a sending unit, configured to send a second notification message to the second virtual machine if the second virtual machine is deployed on the first host,
  • the second advertisement packet includes a second virtual storage address and a length, the second virtual storage address is converted from the first physical storage address, and the second advertisement packet is used for the second container to obtain the data packet.
  • the above sending unit is further configured to send a data packet to the second host if the second virtual machine is deployed on the second host.
  • the first virtual machine, the first host, and the second virtual machine in the above share a first shared memory, and the second virtual machine is deployed on the first host;
  • the first virtual machine shares the first shared memory with the first host, and the second virtual machine is deployed on the second host; the first shared memory is used to store data packets.
  • An eighth aspect of the present application provides a communication device, where the communication device may be a second host. It can also be a component of the second host (the sending and receiving packet server, processor, chip, or chip system, etc. in the second host), and the communication device includes: a receiving unit for receiving data packets from the first host, The data message is a message communicated between the first container on the first virtual machine and the second container on the second virtual machine, the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the second host On the above, the first host and the second host are different hosts; the determining unit is used to determine the virtual storage address corresponding to the physical storage address of the data message according to the address mapping table, and the address mapping table stores a physical storage address and one or more storage addresses.
  • the communication device may be a second host. It can also be a component of the second host (the sending and receiving packet server, processor, chip, or chip system, etc. in the second host), and the communication device includes: a receiving unit for receiving data packets from the
  • the container obtains data packets.
  • the above-mentioned second virtual machine and the second host share a shared memory, and the physical storage address and the virtual storage address point to the shared memory;
  • Shared memory is used to store data packets.
  • a ninth aspect of the present application provides a communication apparatus, where the communication apparatus may be a second virtual machine. It can also be a component of the second virtual machine (for example, a client for sending and receiving packets in the second virtual machine, etc.), and the communication device includes:
  • the receiving unit is configured to receive a notification message, where the notification message includes a virtual storage address where the data message is located and the length of the data message, and the data message is the first container on the first virtual machine and the first container on the second virtual machine.
  • the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the first host or a second host different from the first host;
  • the obtaining unit is used to obtain the data packet according to the virtual storage address and the length.
  • the advertisement message in the above is generated by the first host, the second virtual machine is deployed on the first host, the first virtual machine, the first host, and the first host.
  • the two virtual machines share a first shared memory, and the first shared memory is used for storing data packets.
  • the advertisement message in the above is generated by the second host, the second virtual machine is deployed on the second host, and the second virtual machine and the second host share one
  • the second shared memory is used for storing data packets.
  • the announcement message in the above also includes an identifier of the network card queue, and the identifier of the network card queue is used to identify the virtual interface corresponding to the second container belonging to the second container.
  • NIC queue is used to identify the virtual interface corresponding to the second container belonging to the second container.
  • the above communication device further includes: a processing unit, configured to write the second pointer into the network card queue of the second container, so that the second container obtains the data packet , the second pointer points to the target storage space of the first shared memory or the second shared memory, and the target storage space is used to store data packets.
  • a processing unit configured to write the second pointer into the network card queue of the second container, so that the second container obtains the data packet , the second pointer points to the target storage space of the first shared memory or the second shared memory, and the target storage space is used to store data packets.
  • a tenth aspect of the present application provides a communication device.
  • the communication device may be a first virtual machine or a component of the first virtual machine (for example, a client for sending and receiving packets in the first virtual machine, etc.).
  • the communication device executes The method of the foregoing first aspect or any possible implementation of the first aspect.
  • the communication device may be a first host or a component of the first host (for example, a packet sending and receiving server, a processor, a chip or a chip system in the first host) , the communication apparatus executes the method in the foregoing second aspect or any possible implementation manner of the second aspect.
  • a twelfth aspect of the present application provides a communication device.
  • the communication device may be a second host, or may be a component of the second host (for example, a packet sending and receiving server, a processor, a chip or a chip system in the second host) , the communication apparatus executes the method in the foregoing second aspect or any possible implementation manner of the second aspect.
  • a thirteenth aspect of the present application provides a communication device.
  • the communication device may be a second virtual machine or a component of the second virtual machine (for example, a client for sending and receiving packets in the second virtual machine, etc.).
  • the communication device The method of the aforementioned first aspect or any possible implementation of the first aspect is performed.
  • a fourteenth aspect of the present application provides a communication device, comprising: a processor, where the processor is coupled to a memory, and the memory is used to store programs or instructions, and when the programs or instructions are executed by the processor, the device enables the above-mentioned first aspect or the method in any possible implementation manner of the first aspect, or cause the apparatus to implement the above-mentioned second aspect or the method in any possible implementation manner of the second aspect, or enable the apparatus to implement the above-mentioned third aspect or the third aspect
  • the method in any possible implementation manner of the above-mentioned fourth aspect or the method in any possible implementation manner of the fourth aspect is made to be implemented by the apparatus.
  • a fifteenth aspect of the present application provides a communication system, including a first virtual machine (or a client for sending and receiving packets in the first virtual machine) in the method of the first aspect, and the first method of the method of the second aspect.
  • the host or the server for sending and receiving packets in the first host
  • the second host or the server for sending and receiving packets in the second host
  • the method of the third aspect and the second virtual machine in the method of the fourth aspect above (or at least one of the client for sending and receiving packets in the second virtual machine).
  • the communication system includes at least one of the communication device of the sixth aspect, the communication device of the seventh aspect, the communication device of the eighth aspect, and the communication device of the ninth aspect.
  • the communication system includes at least one of the communication device of the tenth aspect, the communication device of the eleventh aspect, the communication device of the twelfth aspect, and the communication device of the thirteenth aspect.
  • a sixteenth aspect of the present application provides a computer-readable medium on which a computer program or instruction is stored, and when the computer program or instruction is executed on a computer, causes the computer to execute the first aspect or any possible possibility of the first aspect.
  • a seventeenth aspect of the present application provides a computer program product, the program product comprising a program, when the program is executed, the method in the aforementioned first aspect or any possible implementation manner of the first aspect is executed, so that the aforementioned The method of the second aspect or any possible implementation of the second aspect is performed such that the method of the aforementioned third aspect or any possible implementation of the third aspect is performed such that the aforementioned fourth aspect or the method of the fourth aspect is performed The method in any possible implementation is executed.
  • the present application transmits the address and length of the data message by sending a notification message without frequently copying the data message, which can reduce the delay caused by the transmission of data messages between containers.
  • FIG. 1 is a schematic diagram of a virtualization structure in the prior art
  • FIG. 2 is a schematic diagram of a network framework in an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a communication process between containers in the prior art
  • FIG. 7 is a schematic flowchart of a service processing method in an embodiment of the present application.
  • FIG. 8 to FIG. 13 are schematic diagrams of several structures of a communication device in an embodiment of the present application.
  • Virtualization is an important foundation of cloud computing.
  • Traditional virtualization technology uses virtual machines (also called virtual machines) as management units. Each virtual machine has an independent operating system kernel and has good isolation.
  • Container technology can be regarded as a lightweight virtualization method, which packages the application and the necessary execution environment into a container image, so that the application can run relatively independently in the host directly.
  • Container technology is virtualized at the operating system layer and can run multiple virtualized environments on the host kernel. Compared with traditional application testing and deployment, the deployment of containers does not need to consider the compatibility of the application's operating environment in advance; compared with traditional virtual machines, containers can run in the host without an independent operating system kernel, achieving higher operational efficiency and resource utilization.
  • Container technology is a technology that packages applications into separate containers for encapsulation.
  • Container technology isolates each application and interrupts the dependencies and connections between programs, that is, a huge service system. With the support of container technology, it is possible to combine containers hosted by many different applications. Container technology effectively divides resources managed by a single operating system into isolated groups to better balance conflicting resource usage requirements among isolated groups. It belongs to operating system-level virtualization technology, due to its lightweight features are widely used.
  • Docker is one of the most representative container platforms at present. Docker container technology takes the container in the host as the management unit. Each container shares the host kernel resources, and realizes the isolation and limitation of resources through virtualization technology. The core of container technology is to create a "boundary" for a process by constraining and modifying the dynamic performance of it.
  • Namespaces and Cgroups are Linux kernel features. Namespaces are a kind of encapsulation and isolation of global system resources, so that processes in different namespaces have independent global system resources. Changing the system resources in a namespace will only affect the processes in the current namespace. Processes in other namespaces have no effect.
  • Linux Cgroup is a function of the Linux kernel to limit, control and separate the resources of a process group (such as central processing unit (CPU), memory, disk input and output, etc.). Therefore, a container is essentially a process with limited parameters.
  • a running Docker container is actually an application process with multiple Linux Namespaces enabled and limited by the resources configured by Cgroups.
  • Virtual machine container is a solution to the security problem of container isolation. By deploying multiple containers in traditional virtual machines, it combines the security advantages of virtual machines with the operating efficiency of containers and the advantages of resource utilization. Significantly improves container security in some performance cases.
  • Network virtualization is an important part of virtualization. This technology can virtualize multiple isolated virtual networks on the physical network, so that different users can use independent network resource slices, thereby improving network resource utilization and realizing elasticity. network of.
  • eventfd is a system call provided by Linux 2.6, which can be used to realize event notification.
  • eventfd contains a 64-bit unsigned integer counter maintained by the kernel.
  • a file descriptor is returned. The process can read/change the counter by reading/writing the file descriptor. value to implement inter-process communication.
  • Kubernetes is an open source container cluster management system. Based on Docker technology, it provides a series of complete functions such as deployment and operation, resource scheduling, service discovery and dynamic scaling for containerized applications, which improves the convenience of large-scale container cluster management.
  • Kubernetes is a complete distributed system support platform with complete cluster management capabilities, multi-level security protection and access mechanisms, multi-tenant application support capabilities, transparent service registration and discovery mechanisms, and built-in intelligent load balancers , Powerful fault discovery and self-healing capabilities, service rolling upgrade and online expansion capabilities, scalable automatic resource scheduling mechanism and multi-granularity resource quota management capabilities.
  • Kubernetes provides comprehensive management tools, covering all aspects including development, deployment testing, and operation and maintenance monitoring.
  • Pod is the smallest unit that kubernetes can deploy and manage. If you want to run a container, you must first create a Pod for the container. At the same time, a Pod can also contain multiple containers. The reason why multiple containers are included in a Pod is often due to tight business coupling. Multiple processes (running as containers) can run simultaneously in a Pod to work together. Containers in the same Pod are automatically assigned to the same node. Containers in the same Pod share resources, network environments, and dependencies, and they are always Schedule at the same time. Each Pod is assigned a unique Internet Protocol (IP) address. All containers in a Pod share network space, including IP addresses and ports.
  • IP Internet Protocol
  • Cloud computing architecture can be expressed by a three-tier SPI (SaaS, PaaS, IaaS) model:
  • SaaS layer Software as a Service (SaaS) layer: things that users see and use, web pages, mobile software (application, APP), reports, etc.
  • SaaS Software as a Service
  • APP mobile software
  • PaaS layer Platform as a Service layer
  • PaaS Platform as a Service layer
  • P layer It can be understood as the platform layer, the background in the popular sense.
  • IaaS layer can be understood as the infrastructure layer, various networks, servers or hosts, storage devices.
  • Virtualization can improve the efficient utilization of resources, make operations more flexible, and simplify change management.
  • a single physical server can have multiple virtual machines, providing separation and security, with each virtual machine running as if it were its own hardware.
  • IaaS which forms the foundational layer of cloud computing.
  • a physical host In a traditional network environment, a physical host includes one or more network interface cards (NICs). To communicate with other physical hosts, it needs to connect to external network facilities through its own NIC. To isolate applications, an application is often deployed on a physical device. In order to reduce the waste of physical resources, a physical resource can be abstracted with the help of virtualization technology (as shown in Figure 1), and a physical network card can be virtualized into multiple virtual network cards (virtual NIC, vNIC). Isolate different applications. Among them, the communication between the virtual machine and the virtual machine is completed by the virtual switch (vswitch, vsw). The link between the virtual network card and the virtual switch is also a virtual link. The entire host forms a virtual network. If the virtual The three-layer network packet forwarding between machines is completed by the virtual router.
  • NICs network interface cards
  • OVS Open vSwitch
  • SDN software-defined networking
  • FIG. 2 is a schematic diagram of enabling OVS communication across hosts.
  • the current container network and virtual machine network mostly use this scheme.
  • the virtualization management unit may be a container or a virtual machine.
  • the current communication method of virtual machine containers is described with reference to Figure 2 and Figure 3.
  • two sets of management systems coexist are used for management in network management.
  • the container network in the virtual machine and the I-layer virtual machine on the host are managed.
  • the machine network is managed separately, the virtual machine network is managed using the Open Computing Management Platform (openStack, OPS), and the container network is managed using k8s.
  • Inter-container communication can be divided into the following three situations:
  • the packets sent from container 1 in the same virtual machine to container 2 are first copied from container 1 through the virtual network card of container 1 to the OVS bridge in the virtual machine, and then copied from the OVS bridge to the virtual network card of container 2 , the whole process has a total of one forwarding and two copies.
  • the communication method between containers in a virtual machine is the same as that of traditional bare metal containers.
  • This situation involves the communication between the container to the virtual machine and the virtual machine to the host (host).
  • the communication between the container 2 and the container 3 in Figure 3 needs to be forwarded through the container network in the virtual machine and the I-layer network on the host.
  • the packets sent by container 2 to container 3 are first copied from container 2 through the virtual network card of container 2 to the OVS bridge in the virtual machine, and then The OVS bridge is copied to the virtual network card of the first virtual machine (which may be called vm1 ), and then copied from the virtual network card of vm1 to the OVS network bridge on the host.
  • the message arrives on the host.
  • This situation involves the communication between the container and the host, and the communication between the host and the outside world. Only the communication between the container and the host is discussed here.
  • the packet is copied from the virtual network card of container 1 to the OVS bridge in the virtual machine, then copied by the OVS bridge to the virtual network card of vm1, and finally from the virtual network card of vm1. It is copied to the OVS bridge on the host.
  • the message reaches the host and is forwarded by the host to the outside world.
  • There are two forwardings and three copies in this process In this case, the use of virtual machine containers has more secondary copies between the OVS in the virtual machine to the virtual machine NIC and the virtual machine NIC to the host OVS than the traditional bare metal container.
  • the embodiment of the present application provides a communication method, which transmits the address and length of the data message by sending a notification message, without frequently copying the data message, which can reduce the transmission bandwidth of the data message between containers. coming delay.
  • the data packet in this application may be any kind of data encapsulated in any manner and used for inter-container communication.
  • the data packet can be used to carry control signaling or service data. It can include protocol information, data payload, Layer 2 data, Layer 3 data, or other layers. The data.
  • FIG. 4 is a schematic diagram of a communication system to which the communication method provided by the embodiment of the present application is applied, and the communication system includes: a host and a virtual machine. A virtual machine can run on the host.
  • the host includes a user space (user space) part and a kernel space (kernel space) part
  • the user space includes an agent and a virtual switch
  • the virtual switch contains a sending and receiving packet server.
  • Kernel space includes Hypervisor.
  • the virtual machine includes a proxy, a client for sending and receiving packets, and one or more containers (container 1 and container 2 are shown in the figure).
  • Each container corresponds to a virtual interface (hereinafter collectively referred to as an interface).
  • container 1 corresponds to interface 1.
  • Container 2 corresponds to interface 2.
  • the agent component is deployed on the host, and the proxy component is deployed in the virtual machine.
  • the agent component and the proxy component are unifiedly managed by k8s.
  • the virtual machine network needs to be managed with openStack, and the container network needs to be managed with k8s.
  • Figure 4 uses an integrated network management solution to manage the container network and virtual machine network at the same time, which simplifies the complexity of network management of virtual machine containers.
  • the agent on the host listens to the event, and notifies the container creation event to the proxy in the virtual machine through the eventfd mechanism, and the proxy is responsible for the creation and management of the container network (for example: interface creation and binding).
  • the agent running on the host is a framework that supports plug-in expansion.
  • the plug-in responsible for virtual machine network management and the plug-in responsible for container network management run under the framework of the agent at the same time to jointly manage the network on the host.
  • the virtual machine network management plug-in can use virtual machine management solutions such as kubevirt and virtlet, which are not limited here.
  • Container network management refers to the management channel in Figure 4. The container in the virtual machine is no longer managed by the virtual machine itself, but is managed by the host.
  • the vsw is no longer deployed in the virtual machine.
  • the mapping relationship between all virtual addresses and physical addresses on the local machine will be obtained from the hypervisor (which can be called as Address mapping table), and the address mapping relationship will also be dynamically updated synchronously during operation.
  • the hypervisor in the kernel has the entire memory resource, and it maintains the mapping relationship between virtual addresses and machine addresses.
  • the control channel between the client and the hypervisor for sending and receiving packets is mainly used for sending and receiving packets.
  • the client obtains the mapping between virtual addresses and physical addresses from the hypervisor. .
  • the control channel between the sending and receiving packet server and the sending and receiving client is mainly used for the sending and receiving server (server) to monitor the messages of the sending and receiving client (client), and to maintain the correspondence between the sending and receiving client and the virtual machine, so as to Distinguish connections between different virtual machines.
  • the client for sending and receiving packets in the virtual machine also starts at the same time, establishes a connection with the server for sending and receiving packets on the host, and starts monitoring the network card queue of the container on the virtual machine. If a new packet is added to the network card queue, the eventfd mechanism is used between the packet sending and receiving client in the virtual machine and the server for sending and receiving packets in the host to send and receive packets.
  • the shared memory between the virtual machine and the host reduces or avoids communication between the virtual machine and the host. Copies of sent and received messages. Among them, evevtfd can also be understood as the underlying notification mechanism, without going through the protocol stack.
  • an interface on a virtual machine can also be connected to more containers.
  • one interface connects two containers.
  • container 1 and container 2 share interface 1
  • container 3 uses interface 2.
  • the number of hosts and virtual machines in the communication system may be multiple, which is not specifically limited here.
  • the communication system includes a server 1 and a server 2 .
  • the virtual machine 1 , the virtual machine 2 and the virtual switch 1 are deployed on the server 1
  • the virtual machine 3 and the virtual switch 2 are deployed on the server 2 .
  • the virtual machine 1 includes a container 1 and a container 2
  • the container 1 and the container 2 share the interface 1.
  • the virtual machine 2 includes a container 3, and the container 3 uses the interface 1 to communicate.
  • the virtual machine 3 includes a container 4 and a container 5 , and the container 4 and the container 5 share the interface 1 .
  • k8s manages the entire system.
  • Server 1 also known as host 1 or node 1
  • server 2 also known as host 2 or node 2
  • switches which can be leaf switches (leaf) and/or backbones Switch (spine).
  • Each server runs a distributed agent that manages both the virtual machine network and the container network on that server.
  • Each virtual machine on each server runs a distributed proxy, which is used to accept calls from agents and execute specific container network management events in the virtual machine.
  • the server for sending and receiving packets runs in the vsw on each server, and a client for sending and receiving packets runs in each virtual machine on the server.
  • the server for sending and receiving packets and the client for sending and receiving packets cooperate through the eventfd mechanism to complete the communication between containers.
  • the communication methods in the embodiments of the present application will be described below with reference to the communication systems shown in FIG. 4 to FIG. 6 .
  • the communication apparatus (may also be referred to as a server, a network device, etc.) in this embodiment of the present application may refer to a first virtual machine, a second virtual machine, a first host, or a second host, which is not specifically limited here.
  • an embodiment of the communication method provided by the embodiment of the present application includes steps 701 to 710b.
  • the communication method may be executed by the virtual machine and the host, or may be executed by the client for sending and receiving packets in the virtual machine and the server for sending and receiving packets in the host, which is not specifically limited here.
  • step 701 the first virtual machine obtains the first virtual storage address and length of the data packet.
  • the first virtual machine obtains the first virtual storage address and length of the data packet in various ways.
  • the first virtual machine may be obtained by determining a new data packet in the network card queue of the first container, and then obtaining the first virtual storage address. storage address and length. It may also be a manner in which other devices other than the first virtual machine send the first virtual storage address and length to the first virtual machine, etc., which is not specifically limited here.
  • the first host and the first virtual machine share a first shared memory
  • the first shared memory is used to store data packets
  • the first virtual storage address points to the first shared memory, or, when the first shared memory space is relatively small, When the value is large, the first virtual storage address points to a storage space in the first shared memory where the data packet is stored.
  • the above-mentioned determination of the newly added data message in the network card queue of the first container may specifically be: determining that the first pointer to the target storage space of the first shared memory is newly added in the network card queue of the first container, and the target storage space stores the first pointer. There are data packets.
  • the data packets in the embodiments of the present application are packets communicated between the first container on the first virtual machine and the second container on the second virtual machine, that is, the packets that need to be transmitted between the first container and the second container message.
  • step 702 the first virtual machine generates a first advertisement message according to the first virtual storage address and the length.
  • the first virtual machine After the first virtual machine acquires the first virtual storage address and the length of the data packet, it generates a first advertisement packet according to the first virtual storage address and the length.
  • the packet sending and receiving client in the first virtual machine generates the first advertisement message according to the first virtual storage address and the length.
  • the format of the first advertisement message may be as shown in Table 1:
  • the first advertisement message further includes an interface number, and the interface number can be used to identify the connection to which the second container is connected.
  • interface 1 corresponds to a network card queue ID (queue ID)
  • the format of the first advertisement message can be
  • the first advertisement message further includes an identifier of the network card queue, and the identifier of the network card queue can be used to identify the second
  • the network card queue belonging to the second container on the virtual interface corresponding to the container is a configurable period of time for the second container to the virtual interface corresponding to the container.
  • the NIC queue that belongs to a container is a container that belongs to a container.
  • the format of the first advertisement message may be as shown in Table 4:
  • Veth 1 interface number queue ID 2 NIC queue ID Address 0xb7a3001000000000 The virtual storage address where the data packet is located
  • step 703 the first virtual machine sends a first advertisement message to the first host.
  • the first virtual machine After generating the first advertisement packet, the first virtual machine sends the first advertisement packet to the first host.
  • the client for sending and receiving packets in the first virtual machine sends a first notification message to the server for sending and receiving packets in the first host.
  • the eventfd mechanism can be used to transmit the first notification message, which can be understood as the first virtual machine.
  • the client for sending and receiving packets and the server for sending and receiving packets in the first host perform inter-process communication through the eventfd mechanism to transmit the first notification message.
  • step 704 the first host determines the first physical storage address corresponding to the first virtual storage address according to the address mapping table.
  • the first host acquires the address mapping table, which may be acquired from a hypervisor in the kernel of the first host, or may be acquired in a manner of sending the address mapping table to the first host through another device, which is not specifically described here. limited.
  • the address mapping table stores the correspondence between one physical storage address and multiple virtual storage addresses.
  • the hypervisor in the kernel maintains the mapping relationship (ie, address mapping table) between virtual storage addresses and machine addresses (which can also be understood as physical storage addresses).
  • the first host After the first host obtains the address mapping table and the first advertisement message, it determines the first physical storage address corresponding to the first virtual storage address, and the first physical storage address is the storage space where the data message is located (it can be understood as the aforementioned The physical storage address corresponding to the first shared memory), or it may be understood that the first physical storage address points to the first shared memory.
  • the server for sending and receiving packets in the first host determines the first physical storage address corresponding to the first virtual storage address.
  • step 705 the first host acquires the data packet according to the first physical storage address and the length.
  • the first host After determining the first physical storage address of the data packet, the first host acquires the data packet from the first shared memory according to the first physical storage address and the length.
  • the packet sending and receiving server in the first host obtains the data packet from the first shared memory according to the first physical storage address and the length.
  • the first host determines the next hop address and outgoing interface of the data packet according to the destination address and the vsw forwarding rule in the data packet, and then determines the next hop address and/or outgoing interface of the data packet.
  • the second container on the second virtual machine is deployed on the first host or on the second host.
  • the vsw forwarding rule may be pre-configured.
  • the first host may determine whether the second virtual machine is deployed on the first host or the second host according to the data packet. If the second virtual machine is deployed on the first host, step 706a and step 707a are performed. If the second virtual machine is deployed on the second host, step 706b to step 710b are executed.
  • step 706a if the second virtual machine is deployed on the first host, the first host sends a second advertisement message to the second virtual machine.
  • the first host determines a second virtual storage address corresponding to the first physical storage address, and generates a second advertisement message according to the second virtual storage address and the length of the data message. and send a second advertisement message to the second virtual machine.
  • the first virtual storage address and the second virtual storage address may be the same or different, but the first virtual storage address and the second virtual storage address correspond to the first physical storage address, which can also be understood as the first virtual storage address and the first virtual storage address. Two virtual storage addresses point to the same physical storage space.
  • the format of the second announcement message in the embodiment of the present application is similar to the format of the foregoing first announcement message, and details are not repeated here.
  • the server for sending and receiving packets in the first host after the server for sending and receiving packets in the first host generates the second notification message, it sends the second notification message to the client for sending and receiving packets in the second virtual machine according to the correspondence table.
  • the correspondence table stores the correspondence between the virtual machine and the client for sending and receiving packets, and one virtual machine corresponds to one client for sending and receiving packets.
  • step 707a the second virtual machine acquires the data message according to the second advertisement message.
  • the second virtual machine After receiving the second advertisement message, the second virtual machine acquires the data message according to the second virtual storage address and the length. It can be understood that the second virtual machine reads the data packet from the first shared memory according to the length and the second virtual storage address. Because the second virtual machine is deployed on the first host, and the first virtual machine, the first host and the second virtual machine share the first shared memory. And because the second virtual storage address points to the first shared memory for storing the data packet. Therefore, the second virtual machine can find the first shared memory for storing the data packet according to the second virtual storage address, and retrieve the data packet from the first shared memory according to the length.
  • the packet sending and receiving client in the second virtual machine reads the data message according to the second virtual address and the length.
  • the data packet is placed on the network card queue of the second container, so that the second container obtains the data packet.
  • the first pointer becomes invalid after being read (read by the first virtual machine or the client for sending and receiving packets in the first virtual machine), or the second container feeds back a response message after acquiring the data message (used to indicate The second container has correctly received the data packet), the first virtual machine may delete the first pointer from the network card queue of the first container.
  • step 706b if the second virtual machine is deployed on the second host, the first host sends a data packet to the second host.
  • the packet sending and receiving server in the first host sends a data packet to the packet sending and receiving server in the second host.
  • the first host sends the data packet to the second host according to the destination address in the data packet and the vsw forwarding rule.
  • the first host may also send data packets to the second host through the third host, that is, the first host does not directly send data packets to the second host.
  • the second host receives data packets from the first host. data packets from the host.
  • step 707b the second host determines a third virtual storage address corresponding to the second physical storage address according to the address mapping table.
  • the second host receives the data packet sent by the first host, stores the data packet at the second physical storage address, and converts the second physical storage address storing the data packet into a third virtual storage address according to the address mapping table. For example, after receiving the data packet sent by the first host, the second host stores the data packet in the second shared memory, and the physical storage address of the second shared memory is the second physical storage address.
  • the packet sending and receiving server in the second host determines a third virtual storage address corresponding to the second physical storage address according to the address mapping table.
  • the second virtual machine and the second host share a second shared memory
  • the second shared memory stores data packets
  • the second physical storage address and the third virtual storage address point to the second shared memory.
  • step 708b the second host generates a third advertisement message according to the third virtual storage address and the length of the data message.
  • the second host After determining the third virtual storage address, the second host generates a third advertisement packet according to the third virtual storage address and the length of the data packet.
  • the packet sending and receiving server in the second host generates a third advertisement message according to the third virtual storage address and the length of the data message.
  • the format of the third announcement message in the embodiment of the present application is similar to the format of the foregoing first announcement message, and details are not repeated here.
  • step 709b the second host sends a third advertisement message to the second virtual machine.
  • the server for sending and receiving packets in the second host sends a third notification message to the client for sending and receiving packets in the second virtual machine.
  • step 710b the second virtual machine acquires the data message according to the third advertisement message.
  • the second virtual machine After the second virtual machine receives the third notification message, it obtains the data message according to the third virtual storage address and the length. It can be understood that the second virtual machine reads the data message from the second shared memory according to the length and the third virtual storage address. data message. Since the second virtual machine is deployed on the second host, the second virtual machine shares the second shared memory with the second host. And because the third virtual storage address points to the second shared memory for storing the data message. Therefore, the second virtual machine can find the second shared memory for storing the data packet according to the third virtual storage address, and retrieve the data packet from the second shared memory according to the length.
  • the packet sending and receiving client in the second virtual machine reads the data message according to the third virtual storage address and the length.
  • the data packet is placed on the network card queue of the second container, so that the second container obtains the data packet.
  • the communication method in this embodiment of the present application includes steps 701 to 703, that is, communication between a virtual machine and a host.
  • the communication method in this embodiment of the present application includes steps 701 to 707a, that is, communication between containers in different virtual machines on the same host.
  • the communication method in this embodiment of the present application includes steps 701 to 705, and steps 707a to 710b, that is, communication between containers on different hosts.
  • the communication method in the embodiment of the present application may be applied to Linux Container (LXC), libvirt-lxc, and may also be applied to scenarios such as Docker and Rocket, which is not specifically limited here.
  • LXC Linux Container
  • libvirt-lxc libvirt-lxc
  • the address and length of the data message are transmitted by sending the notification message and the shared memory between the virtual machine and the host, so as to reduce the delay caused by the transmission of the data message between the containers, without using Frequently copying data packets can reduce the copying or forwarding of data packets during transmission.
  • the agent component and the proxy component are managed uniformly by a set of k8s management system (that is, the virtual machine network and the container network are managed uniformly).
  • the embodiment of the present application uses an integrated network management solution to manage the container network and the virtual machine network at the same time, which simplifies the management of the virtual machine container. The complexity of network management.
  • the embodiments of the present application further provide corresponding apparatuses, including corresponding modules for executing the foregoing embodiments.
  • the modules may be software, hardware, or a combination of software and hardware.
  • the communication apparatus may be a first virtual machine, or may be a component of the first virtual machine (for example, a client for sending and receiving packets in the first virtual machine)
  • the communication device includes:
  • Obtaining unit 801 configured to obtain a first virtual storage address of a data packet and the length of the data packet, where the data packet is a first container on a first virtual machine and a second container on a second virtual machine messages communicated between, the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the first host or a second host different from the first host;
  • a generating unit 802 configured to generate a first advertisement message according to the first virtual storage address and the length;
  • the sending unit 803 is configured to send the first advertisement packet to the first host, where the first advertisement packet is used to enable the first host to trigger the second container to acquire the data packet.
  • the communication apparatus further includes: a determining unit 804, configured to determine that the data packet is newly added to the network card queue of the first container.
  • the first pointer is invalid after being read.
  • the first virtual machine, the first host, and the second virtual machine share a first shared memory, and the second virtual machine is deployed on the first host; or the first virtual machine and The first host shares the first shared memory, and the second virtual machine is deployed on the second host; the first shared memory is used to store the data packet, and the first virtual storage address Points to the first shared memory.
  • the first advertisement message further includes an identifier of a network card queue, where the identifier of the network card queue is used to identify the network card queue belonging to the second container on the virtual interface corresponding to the second container.
  • the determining unit 804 is specifically configured to determine a first pointer newly added in the network card queue to a target storage space of the first shared memory, where the target storage space is used to store the data message.
  • each unit in the communication device the operations performed by each unit in the communication device are similar to those described for the first virtual machine or the client for sending and receiving packets in the first virtual machine in the foregoing embodiments shown in FIG. 4 to FIG. 7 , and are not repeated here. Repeat.
  • the sending unit 803 transmits the address and length of the data message by sending the notification message, so as to reduce the time delay caused by the transmission of the data message between containers, that is, to reduce the copying or the length of the data message during transmission. Forward.
  • the communication device may be the first host, or may be a component of the first host (for example, a packet sending and receiving server, a processor, a chip, or chip system, etc.), the communication device includes:
  • the receiving unit 901 is configured to receive a first announcement message sent by a first virtual machine, where the first announcement message includes a first virtual storage address corresponding to the data message and the length of the data message, the datagram
  • the message is a message communicated between the first container on the first virtual machine and the second container on the second virtual machine, the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the first host or a second host different from the first host;
  • a determining unit 902 configured to determine a first physical storage address corresponding to the first virtual storage address according to an address mapping table, where the first physical storage address is a physical storage address corresponding to the first shared memory where the data message is located,
  • the address mapping table stores a correspondence between a physical storage address and one or more virtual storage addresses;
  • an obtaining unit 903 configured to obtain the data message according to the first physical storage address and the length;
  • a sending unit 904 configured to send a second advertisement packet to the second virtual machine if the second virtual machine is deployed on the first host, where the second advertisement packet includes a second virtual storage address and the length, the second virtual storage address is converted from the first physical storage address, and the second advertisement message is used for the second container to obtain the data message.
  • the sending unit 904 is further configured to send the data packet to the second host if the second virtual machine is deployed on the second host.
  • the first virtual machine, the first host, and the second virtual machine share a first shared memory, and the second virtual machine is deployed on the first host; or the first virtual machine and The first host shares the first shared memory, and the second virtual machine is deployed on the second host; the first shared memory is used to store the data message.
  • each unit in the communication device the operations performed by each unit in the communication device are similar to those described for the first host or the packet sending and receiving server in the first host in the foregoing embodiments shown in FIG. 4 to FIG. 7 , and details are not repeated here.
  • the sending unit 904 sends the second notification message to the second virtual machine,
  • the sending unit 904 transmits the address and length of the data message by sending the notification message, so as to reduce the delay caused by the transmission of the data message between containers.
  • the communication device may be a second host, or may be a component of the second host (for example, a packet sending and receiving server, a processor, a chip, or chip system, etc.), the communication device includes:
  • a receiving unit 1001 configured to receive a data packet from a first host, where the data packet is a packet of communication between a first container on the first virtual machine and a second container on the second virtual machine document, the first virtual machine is deployed on the first host, the second virtual machine is deployed on a second host, and the first host and the second host are different hosts;
  • Determining unit 1002 for determining the virtual storage address corresponding to the physical storage address of the data message according to the address mapping table, and the address mapping table stores the correspondence between a physical storage address and one or more virtual storage addresses;
  • a generating unit 1003, configured to generate a notification message according to the virtual storage address and the length of the data message
  • the sending unit 1004 is configured to send the announcement message to the second virtual machine, where the announcement message is used for the second container to acquire the data message.
  • the second virtual machine shares a shared memory with the second host, the second virtual machine is deployed on the second host, and the physical storage address and the virtual storage address point to the shared memory ;
  • the shared memory is used to store the data message.
  • each unit in the communication device the operations performed by each unit in the communication device are similar to those described for the second host or the packet sending and receiving server in the second host in the foregoing embodiments shown in FIG. 4 to FIG. 7 , and details are not repeated here.
  • the receiving unit 1001 receives the data packet from the first host, the generating unit 1003 generates a third advertisement packet according to the third virtual storage address and the length of the data packet, and the sending unit 1004 sends the data packet to the second virtual machine The third notification message.
  • the sending unit 1004 transmits the address and length of the data message by sending the notification message, so as to reduce the delay caused by the transmission of the data message between containers.
  • the communication apparatus may be a second virtual machine, or may be a component of the second virtual machine (for example, a client for sending and receiving packets in the second virtual machine)
  • the communication device includes:
  • the receiving unit 1101 is configured to receive a notification message, where the notification message includes the second virtual storage address where the data message is located and the length of the data message, and the data message is the first virtual machine on the first virtual machine.
  • the obtaining unit 1102 is configured to obtain the data packet according to the second virtual storage address and the length.
  • the communication apparatus further includes: a processing unit 1103, configured to write a second pointer into a network card queue of the second container, so that the second container obtains the data packet, and the second pointer points to The target storage space of the first shared memory or the second shared memory, where the target storage space is used to store the data message.
  • a processing unit 1103 configured to write a second pointer into a network card queue of the second container, so that the second container obtains the data packet, and the second pointer points to The target storage space of the first shared memory or the second shared memory, where the target storage space is used to store the data message.
  • the advertisement message is generated by the first host, the second virtual machine is deployed on the first host, the first virtual machine, the first host, and the second virtual machine
  • the computers share a first shared memory, and the first shared memory is used to store the data message.
  • the advertisement message is generated by the second host, the second virtual machine is deployed on the second host, the second virtual machine and the second host share a second shared memory, so The second shared memory is used for storing the data message.
  • the notification message further includes an identifier of a network card queue, where the identifier of the network card queue is used to identify the network card queue belonging to the second container on the virtual interface corresponding to the second container.
  • each unit in the communication device is similar to those described for the second virtual machine or the client for sending and receiving packets in the second virtual machine in the embodiments shown in FIG. 4 to FIG. 7 , which are not repeated here. Repeat.
  • the receiving unit 1101 receives the notification message and determines the address and length of the data message, and then the obtaining unit 1102 obtains the data message, thereby reducing the delay caused by the transmission of the data message between containers.
  • FIG. 12 is a possible schematic diagram of the communication device involved in the foregoing embodiment
  • the communication device may specifically be the first host in the foregoing embodiment (wherein the first virtual machine is deployed on the first host or The first virtual machine and the second virtual machine are deployed on the first host) or the second host (wherein the second virtual machine can be deployed on the second host), the communication device may include but not limited to the processor 1201, the communication port 1202, memory 1203, bus 1204.
  • the processor 1201 may be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in this disclosure.
  • the processor 1201 may also be a combination that implements computing functions, such as a combination comprising one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
  • the memory 1203 may include a first shared memory or a second shared memory for storing data packets.
  • the first virtual machine and the first host share a set of physical devices, or the first virtual machine, the second virtual machine and the first host share a set of physical devices, or the second virtual machine and the second host share a set of physical devices A set of physical equipment, which is not limited here.
  • the communication device shown in FIG. 12 can be specifically used to implement the functions of the steps performed by the communication device in the method embodiments corresponding to FIGS. 4 to 7 , and realize the technical effect corresponding to the communication device.
  • the communication device shown in FIG. 12 For the specific implementation manner, reference may be made to the descriptions in the respective method embodiments corresponding to FIG. 4 to FIG. 7 , which will not be repeated here.
  • the communication device may also be shown in FIG. 13 , and the communication device may include but not limited to a processor 1301 , a communication port 1302 , a memory 1303 , and a bus 1304 .
  • the functions and beneficial effects of each unit in FIG. 13 can refer to the description of each unit in the aforementioned FIG. 12 .
  • the processor 1301 in FIG. 13 includes a packet sending and receiving server and a packet sending and receiving client.
  • the client mainly monitors the message sending and receiving queue of the container in the virtual machine, and generates notification messages as shown in the embodiments shown in FIG. 4 to FIG. 7.
  • the client that sends and receives packets runs on the virtual machine.
  • the other part is the packet sending and receiving server, which is responsible for message processing and generating notification messages as shown in the embodiments shown in FIG. 4 to FIG. 7.
  • the sending and receiving packet server runs on the physical server.
  • Embodiments of the present application further provide a computer-readable storage medium for storing computer-executable instructions.
  • the processor executes the method described in the possible implementation manner of the communication device in the foregoing embodiments, wherein , the communication device may specifically be the communication device in the foregoing method embodiments corresponding to FIG. 4 to FIG. 7 .
  • Embodiments of the present application further provide a computer program product that stores one or more computers.
  • the processor executes the method for possible implementations of the above communication device, wherein the communication device may specifically be It is the communication device in the method embodiment corresponding to the foregoing FIG. 4 to FIG. 7 .
  • An embodiment of the present application further provides a chip system, where the chip system includes a processor, which is configured to support the communication apparatus to implement the functions involved in the possible implementation manners of the foregoing communication apparatus.
  • the chip system may further include a memory for storing necessary program instructions and data of the communication device.
  • the chip system may be composed of chips, or may include chips and other discrete devices, wherein the communication device may specifically be the communication device in the method embodiments corresponding to FIG. 4 to FIG. 7 .
  • the disclosed system, apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请公开了一种通信方法。本申请方法可以由虚拟机执行,也可以由虚拟机的部件(例如虚拟机中的收发包客户端等)执行。该方法包括:获取数据报文所在的第一虚拟存储地址以及数据报文的长度,根据第一虚拟存储地址以及长度生成第一通告报文;并向第一主机发送第一通告报文,第一通告报文用于使第一主机触发第二容器获取数据报文。数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文。通过发送通告报文的方式传输数据报文所在的地址和长度,而不用频繁拷贝数据报文,可以减少容器之间传输数据报文带来的时延。

Description

一种通信方法、装置以及系统
本申请要求于2021年1月28日提交、申请号为CN202110120171.8、发明名称为“一种通信方法、装置以及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信领域,尤其涉及一种通信方法、装置以及系统。
背景技术
随着信息技术的不断发展,虚拟机技术得到广泛应用。虚拟机(virtual machine)是指通过软件模拟的、具有完整硬件功能的,运行在一个完全隔离环境中的完整计算机系统。通过虚拟机软件,可以在一台物理机上模拟出一台或多台虚拟的计算机。集装箱(Docker)是一个开源的应用容器引擎,旨在提供一种应用的自动化部署解决方案,在Linux系统上迅速创建一个容器(container),容器是与系统其它部分隔离开的一系列进程。
目前,由于容器部署在虚拟机中,容器对外传输数据需要经过虚拟机中的容器网络和虚拟机网络进行转发。
因此,容器在对外传输数据时需要经过多次拷贝,导致数据传输效率低下。
发明内容
本申请提供了一种通信方法、装置以及系统,通过发送通告报文的方式传输数据报文所在的地址和长度,利用共享存储空间减少容器之间传输数据报文带来的时延。
本申请第一方面提供了一种通信方法,该方法可以由第一虚拟机执行,也可以由第一虚拟机的部件(例如第一虚拟机中的收发包客户端等)执行。该方法包括:获取数据报文的第一虚拟存储地址以及数据报文的长度,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第一主机或不同于第一主机的第二主机上;根据所述第一虚拟存储地址以及所述长度生成第一通告报文;向第一主机发送第一通告报文,第一通告报文用于使第一主机触发第二容器获取数据报文。
本申请中,确定数据报文所在的第一虚拟存储地址以及数据报文的长度,根据所述第一虚拟存储地址以及所述长度生成第一通告报文;并向第一主机发送第一通告报文,第一通告报文用于使第一主机触发第二容器获取数据报文。数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文。通过发送通告报文的方式传输数据报文所在的地址和长度,而不用频繁拷贝数据报文,可以减少容器之间传输数据报文带来的时延。
可选地,在第一方面的一种可能的实现方式中,上述步骤中的数据报文存储在第一共享内存中,所述第一虚拟存储地址指向所述第一共享内存,第一虚拟机、第一主机以及第二虚拟机共用第一共享内存,第二虚拟机部署在第一主机上;或者第一虚拟机与第一主机共用第一共享内存,第二虚拟机部署在第二主机上。
该种可能的实现方式中,通过主机与虚拟机共用共享内存以及虚拟存储地址以及长度的方式,减少容器之间传输数据报文带来的时延。
可选地,在第一方面的一种可能的实现方式中,上述步骤还包括:确定第一容器的网卡队列新增数据报文。
该种可能的实现方式中,通过第一容器的网卡队列,判别新增第一容器需要向第二容器传输的数据报文。
可选地,在第一方面的一种可能的实现方式中,上述步骤中的第一通告报文还包括网卡队列的标识,网卡队列的标识用于识别第二容器对应的虚拟接口上属于第二容器的网卡队列。
该种可能的实现方式中,对于虚拟接口上有多个网卡队列的情况,通过网卡队列的标识进行识别,进而实现第二容器获取正确的来自第一容器的数据报文。
可选地,在第一方面的一种可能的实现方式中,上述步骤中的确定第一容器的网卡队列新增数据报文,包括:确定网卡队列中新增指向第一共享内存的目标存储空间的第一指针,目标存储空间用于存储数据报文。
该种可能的实现方式中,具体通过第一容器上网卡队列的第一指针,判别新增第一容器需要向第二容器传输的数据报文。
可选地,在第一方面的一种可能的实现方式中,上述的第一指针被读取后失效。
该种可能的实现方式中,第一指针被读取后失效,减少存储器的存储空间。
本申请第二方面提供了一种通信方法,该方法可以由第一主机执行,也可以由第一主机的部件(例如第一主机中的收发包服务端、处理器、芯片、或芯片系统等)执行。该方法包括:接收第一虚拟机发送的第一通告报文,第一通告报文包括数据报文对应的第一虚拟存储地址以及数据报文的长度,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第一主机或不同于第一主机的第二主机上;根据地址映射表确定第一虚拟存储地址对应的第一物理存储地址,第一物理存储地址为数据报文所在第一共享内存对应的物理存储地址,地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;根据第一物理存储地址以及长度获取数据报文;若第二虚拟机部署在第一主机上,则向第二虚拟机发送第二通告报文,第二通告报文包括第二虚拟存储地址以及长度,第二虚拟存储地址由第一物理存储地址转化得到,第二通告报文用于第二容器获取数据报文。
本申请中,接收第一虚拟机发送的第一通告报文之后,若第二虚拟机部署在第一主机上,则向第二虚拟机发送第二通告报文,通过发送通告报文的方式传输数据报文所在的地址和长度,减少容器之间传输数据报文带来的时延。
可选地,在第二方面的一种可能的实现方式中,上述步骤还包括:若第二虚拟机部署在第二主机上,则向第二主机发送数据报文。
该种可能的实现方式中,接收第一虚拟机发送的第一通告报文之后,若第二虚拟机部署在第二主机上,则向第二主机发送数据报文,从而使得第二容器获取正确的数据报文。
可选地,在第二方面的一种可能的实现方式中,上述步骤中的第一虚拟机、第一主机以及第二虚拟机共用第一共享内存,第二虚拟机部署在第一主机上;或者第一虚拟机与第一主机共用第一共享内存,第二虚拟机部署在第二主机上。
该种可能的实现方式中,通过主机与虚拟机共用共享内存以及虚拟存储地址以及长度的方式,减少容器之间传输数据报文带来的时延。
本申请第三方面提供了一种通信方法,该方法可以由第二主机执行,也可以由第二主机的部件(例如第二主机中的收发包服务端、处理器、芯片、或芯片系统等)执行。该方法包括:接收来自第一主机的数据报文,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第二主机上,第一主机与第二主机为不同的主机;根据地址映射表确定第二物理存储地址对应的第三虚拟存储地址,数据报文存储的物理地址为第二物理存储地址,地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;根据第三虚拟存储地址以及数据报文的长度生成第三通告报文;向第二虚拟机发送第三通告报文,第三通告报文用于第二容器获取数据报文。
该种可能的实现方式中,接收来自第一主机的数据报文,根据第三虚拟存储地址以及数据报文的长度生成第三通告报文,向第二虚拟机发送第三通告报文。通过发送通告报文的方式传输数据报文所在的地址和长度,减少容器之间传输数据报文带来的时延。
可选地,在第三方面的一种可能的实现方式中,上述步骤中的第二虚拟机与第二主机共用一个第二共享内存,第二虚拟机部署在第二主机上,第二物理存储地址以及第三虚拟存储地址指向第二共享内存;第二共享内存用于存储数据报文。
该种可能的实现方式中,通过主机与虚拟机共用共享内存以及虚拟存储地址以及长度的方式,减少容器之间传输数据报文带来的时延。
本申请第四方面提供了一种通信方法,该方法可以由第二虚拟机执行,也可以由第二虚拟机的部件(例如第二虚拟机中的收发包客户端等)执行。该方法包括:接收通告报文,通告报文包括数据报文所在的虚拟存储地址以及数据报文的长度,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第一主机或不同于第一主机的第二主机上;根据虚拟存储地址以及长度获取数据报文。
该种可能的实现方式中,通过接收通告报文的方式确定数据报文所在的地址和长度,进而获取数据报文,减少容器之间传输数据报文带来的时延。
可选地,在第四方面的一种可能的实现方式中,上述步骤中的通告报文由第一主机生成,第二虚拟机部署在第一主机上,第一虚拟机、第一主机以及第二虚拟机共用第一共享内存,第一共享内存用于存储数据报文。
该种可能的实现方式中,通过主机与虚拟机共用共享内存以及虚拟存储地址以及长度的方式,减少容器之间传输数据报文带来的时延。
可选地,在第四方面的一种可能的实现方式中,上述步骤中的通告报文由第二主机生成,第二虚拟机部署在第二主机上,第二虚拟机以及第二主机共用第二共享内存,第二共享内存用于存储数据报文。
该种可能的实现方式中,通过主机与虚拟机共用共享内存以及虚拟存储地址以及长度的方式,减少容器之间传输数据报文带来的时延。
可选地,在第四方面的一种可能的实现方式中,上述步骤中的通告报文还包括网卡队列的标识,网卡队列的标识用于识别第二容器对应的虚拟接口上属于第二容器的网卡队列。
该种可能的实现方式中,对于虚拟接口上有多个网卡队列的情况,通过网卡队列的标识 进行识别,进而实现第二容器获取正确的来自第一容器的数据报文。
可选地,在第四方面的一种可能的实现方式中,上述步骤还包括:将第二指针写入第二容器的网卡队列,以使得第二容器获取数据报文,第二指针指向第一共享内存或第二共享内存的目标存储空间,目标存储空间用于存储数据报文。
该种可能的实现方式中,具体通过第一容器上增加网卡队列的第二指针,使得第二容器根据第二指针获取数据报文。
本申请第五方面提供了一种通信系统,该通信系统包括第一虚拟机、第一主机以及第二虚拟机:第一虚拟机,用于获取数据报文的第一虚拟存储地址以及数据报文的长度,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第一主机或不同于第一主机的第二主机上;第一虚拟机,还用于根据所述第一虚拟存储地址以及所述长度生成第一通告报文;第一虚拟机,还用于向第一主机发送第一通告报文,第一通告报文用于使第一主机触发第二容器获取数据报文。
可选地,在第五方面的一种可能的实现方式中,上述通信系统中的第一主机,用于根据地址映射表确定第一虚拟存储地址对应的第一物理存储地址,第一物理存储地址为数据报文所在存储空间对应的物理存储地址,地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;第一主机,还用于根据第一物理存储地址以及长度获取数据报文。
可选地,在第五方面的一种可能的实现方式中,上述通信系统中的第一主机,还用于若第二虚拟机部署在第一主机上,则向第二虚拟机发送第二通告报文,第二通告报文包括第二虚拟存储地址以及长度,第二虚拟存储地址由第一物理存储地址转化得到,第二通告报文用于第二容器获取数据报文;第一主机,还用于若第二虚拟机部署在第二主机上,则向第二主机发送数据报文。
可选地,在第五方面的一种可能的实现方式中,上述通信系统还包括:第二主机,用于根据地址映射表将第二物理存储地址转化为第三虚拟存储地址,数据报文的存储空间的物理地址为第二物理存储地址,地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;第二主机,还用于根据第三虚拟存储地址以及数据报文的长度生成第三通告报文;第二主机,还用于向第二虚拟机发送第三通告报文,第三通告报文用于第二容器获取数据报文。
可选地,在第五方面的一种可能的实现方式中,上述通信系统中的第二虚拟机,用于若第二虚拟机部署在第一主机上,则接收第一主机发送的第二通告报文;第二虚拟机,还用于根据第二虚拟存储地址以及长度获取数据报文。
可选地,在第五方面的一种可能的实现方式中,上述通信系统中的第二虚拟机部署在第二主机上,第二虚拟机用于接收第二主机发送的第三通告报文;第二虚拟机,还用于根据第三虚拟存储地址以及长度获取数据报文。
本申请第六方面提供一种通信装置,该通信装置可以是第一虚拟机。也可以是第一虚拟机的部件(例如第一虚拟机中的收发包客户端等),该通信装置包括:获取单元,用于获取数据报文的第一虚拟存储地址以及数据报文的长度,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第一主机或不同于第一主机的第二主机上;生成单元,用于根据所述第一虚拟存储地址以及 所述长度生成第一通告报文;发送单元,用于向第一主机发送第一通告报文,第一通告报文用于使第一主机触发第二容器获取数据报文。
可选地,在第六方面的一种可能的实现方式中,上述中的数据报文存储在第一共享内存中,第一虚拟存储地址指向第一共享内存,第一虚拟机、第一主机以及第二虚拟机共用第一共享内存,第二虚拟机部署在第一主机上;或者第一虚拟机与第一主机共用第一共享内存,第二虚拟机部署在第二主机上;第一共享内存用于存储数据报文,第一虚拟存储地址指向第一共享内存。
可选地,在第六方面的一种可能的实现方式中,上述通信装置还包括:确定单元,用于确定第一容器的网卡队列新增数据报文。
可选地,在第六方面的一种可能的实现方式中,上述中的第一通告报文还包括网卡队列的标识,网卡队列的标识用于识别第二容器对应的虚拟接口上属于第二容器的网卡队列。
可选地,在第六方面的一种可能的实现方式中,上述中的确定单元,具体用于确定网卡队列中新增指向第一共享内存的目标存储空间的第一指针,目标存储空间用于存储数据报文。
可选地,在第六方面的一种可能的实现方式中,上述的第一指针被读取后失效。
本申请第七方面提供了一种通信装置,该通信装置可以是第一主机。也可以是第一主机的部件(第一主机中的收发包服务端、处理器、芯片、或芯片系统等),该通信装置包括:接收单元,用于接收第一虚拟机发送的第一通告报文,第一通告报文包括数据报文对应的第一虚拟存储地址以及数据报文的长度,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第一主机或不同于第一主机的第二主机上;确定单元,用于根据地址映射表确定第一虚拟存储地址对应的第一物理存储地址,第一物理存储地址为数据报文所在第一共享内存对应的物理存储地址,地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;获取单元,用于根据第一物理存储地址以及长度获取数据报文;发送单元,用于若第二虚拟机部署在第一主机上,则向第二虚拟机发送第二通告报文,第二通告报文包括第二虚拟存储地址以及长度,第二虚拟存储地址由第一物理存储地址转化得到,第二通告报文用于第二容器获取数据报文。
可选地,在第七方面的一种可能的实现方式中,上述中的发送单元,还用于若第二虚拟机部署在第二主机上,则向第二主机发送数据报文。
可选地,在第七方面的一种可能的实现方式中,上述中的第一虚拟机、第一主机以及第二虚拟机共用第一共享内存,第二虚拟机部署在第一主机上;或者第一虚拟机与第一主机共用第一共享内存,第二虚拟机部署在第二主机上;第一共享内存用于存储数据报文。
本申请第八方面提供了一种通信装置,该通信装置可以是第二主机。也可以是第二主机的部件(第二主机中的收发包服务端、处理器、芯片、或芯片系统等),该通信装置包括:接收单元,用于接收来自第一主机的数据报文,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第二主机上,第一主机与第二主机为不同的主机;确定单元,用于根据地址映射表确定数据报文的物理存储地址对应的虚拟存储地址,地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;生成单元,用于根据虚拟存储地址以及数据报文的长度生成通告报文;发送单元,用于向第二虚拟机发送通告报文,通告报文用于第二容器获取数据报文。
可选地,在第八方面的一种可能的实现方式中,上述中的第二虚拟机与第二主机共用一个共享内存,物理存储地址以及虚拟存储地址指向共享内存;
共享内存用于存储数据报文。
本申请第九方面提供一种通信装置,该通信装置可以是第二虚拟机。也可以是第二虚拟机的部件(例如第二虚拟机中的收发包客户端等),该通信装置包括:
接收单元,用于接收通告报文,通告报文包括数据报文所在的虚拟存储地址以及数据报文的长度,数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,第一虚拟机部署在第一主机上,第二虚拟机部署在第一主机或不同于第一主机的第二主机上;
获取单元,用于根据虚拟存储地址以及长度获取数据报文。
可选地,在第九方面的一种可能的实现方式中,上述中的通告报文由第一主机生成,第二虚拟机部署在第一主机上,第一虚拟机、第一主机以及第二虚拟机共用第一共享内存,第一共享内存用于存储数据报文。
可选地,在第九方面的一种可能的实现方式中,上述中的通告报文由第二主机生成,第二虚拟机部署在第二主机上,第二虚拟机以及第二主机共用一个第二共享内存,第二共享内存用于存储数据报文。
可选地,在第九方面的一种可能的实现方式中,上述中的通告报文还包括网卡队列的标识,网卡队列的标识用于识别第二容器对应的虚拟接口上属于第二容器的网卡队列。
可选地,在第九方面的一种可能的实现方式中,上述通信装置还包括:处理单元,用于将第二指针写入第二容器的网卡队列,以使得第二容器获取数据报文,第二指针指向第一共享内存或第二共享内存的目标存储空间,目标存储空间用于存储数据报文。
本申请第十方面提供了一种通信装置,该通信装置可以是第一虚拟机,也可以是第一虚拟机的部件(例如第一虚拟机中的收发包客户端等),该通信装置执行前述第一方面或第一方面的任意可能的实现方式中的方法。
本申请第十一方面提供了一种通信装置,该通信装置可以是第一主机,也可以是第一主机的部件(例如第一主机中的收发包服务端、处理器、芯片或芯片系统),该通信装置执行前述第二方面或第二方面的任意可能的实现方式中的方法。
本申请第十二方面提供了一种通信装置,该通信装置可以是第二主机,也可以是第二主机的部件(例如第二主机中的收发包服务端、处理器、芯片或芯片系统),该通信装置执行前述第二方面或第二方面的任意可能的实现方式中的方法。
本申请第十三方面提供了一种通信装置,该通信装置可以是第二虚拟机,也可以是第二虚拟机的部件(例如第二虚拟机中的收发包客户端等),该通信装置执行前述第一方面或第一方面的任意可能的实现方式中的方法。
本申请第十四方面提供了一种通信装置,包括:处理器,处理器与存储器耦合,存储器用于存储程序或指令,当程序或指令被处理器执行时,使得该装置实现上述第一方面或第一方面的任意可能的实现方式中的方法,或者使得该装置实现上述第二方面或第二方面的任意可能的实现方式中的方法,或者使得该装置实现上述第三方面或第三方面的任意可能的实现方式中的方法,或者使得该装置实现上述第四方面或第四方面的任意可能的实现方式中的方法。
本申请第十五方面提供了一种通信系统,包括上述第一方面的方法中的第一虚拟机(或者第一虚拟机中的收发包客户端)、上述第二方面的方法中的第一主机(或者第一主机中的收发包服务端)、上述第三方面的方法中的第二主机(或者第二主机中的收发包服务端)以及上述第四方面的方法中的第二虚拟机(或者第二虚拟机中的收发包客户端)中的至少一个。或者,该通信系统包括第六方面的通信装置、第七方面的通信装置、第八方面的通信装置以及第九方面的通信装置中的至少一个。或者,该通信系统包括第十方面的通信装置、第十一方面的通信装置、第十二方面的通信装置以及第十三方面的通信装置中的至少一个。
本申请第十六方面提供了一种计算机可读介质,其上存储有计算机程序或指令,当计算机程序或指令在计算机上运行时,使得计算机执行前述第一方面或第一方面的任意可能的实现方式中的方法,或者使得计算机执行前述第二方面或第二方面的任意可能的实现方式中的方法,或者使得计算机执行前述第三方面或第三方面的任意可能的实现方式中的方法,或者使得计算机执行前述第四方面或第四方面的任意可能的实现方式中的方法。
本申请第十七方面提供了一种计算机程序产品,该程序产品包括程序,当该程序被运行时,使得前述第一方面或第一方面的任意可能的实现方式中的方法被执行,使得前述第二方面或第二方面的任意可能的实现方式中的方法被执行,使得前述第三方面或第三方面的任意可能的实现方式中的方法被执行,使得前述第四方面或第四方面的任意可能的实现方式中的方法被执行。
其中,第五、第六、第十、第十四、第十五、第十六、第十七方面或者其中任一种可能实现方式所带来的技术效果可参见第一方面或第一方面不同可能实现方式所带来的技术效果,此处不再赘述。
其中,第五、第七、第十一、第十四、第十五、第十六、第十七方面或者其中任一种可能实现方式所带来的技术效果可参见第二方面或第二方面不同可能实现方式所带来的技术效果,此处不再赘述。
其中,第五、第八、第十二、第十四、第十五、第十六、第十七方面或者其中任一种可能实现方式所带来的技术效果可参见第三方面或第三方面不同可能实现方式所带来的技术效果,此处不再赘述。
其中,第五、第九、第十三、第十四、第十五、第十六、第十七方面或者其中任一种可能实现方式所带来的技术效果可参见第四方面或第四方面不同可能实现方式所带来的技术效果,此处不再赘述。
从以上技术方案可以看出,本申请通过发送通告报文的方式传输数据报文所在的地址和长度,而不用频繁拷贝数据报文,可以减少容器之间传输数据报文带来的时延。
附图说明
图1为现有技术中的虚拟化结构示意图;
图2为本申请实施例中的网络框架示意图;
图3为现有技术中容器间通信过程的示意图;
图4至图6为本申请实施例中几种通信系统的结构示意图;
图7为本申请实施例中业务处理方法一个流程示意图;
图8至图13为本申请实施例中通信装置的几种结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
其中,在本申请的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B。本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。并且,在本申请的描述中,除非另有说明,“多个”是指两个或多于两个。另外,为了便于清楚描述本申请实施例的技术方案,在本申请的实施例中,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。
首先,对本申请实施例中的部分用语进行解释说明,以便于本领域技术人员理解。
1、虚拟化、容器技术:
虚拟化是云计算的重要基础,传统虚拟化技术以虚拟机(也可以称为虚拟机)为管理单元,各虚拟机拥有独立的操作系统内核,具有良好的隔离性。容器技术可以看作一种轻量级的虚拟化方式,该技术将应用与必要的执行环境打包成容器镜像,使得应用程序可以直接在宿主机中相对独立地运行。容器技术在操作系统层进行虚拟化,可在宿主机内核上运行多个虚拟化环境。相比于传统的应用测试与部署,容器的部署无需预先考虑应用的运行环境兼容性问题;相比于传统虚拟机,容器无需独立的操作系统内核就可在宿主机中运行,实现了更高的运行效率与资源利用率。容器技术是将应用程序打包到单独的容器之中,进行封装的技术,容器技术将每个应用程序隔离开,打断了程序之间的依赖和连接关系,也就是说,一个庞大的服务系统在容器技术的支持下,可以由许多不同的应用程序所寄居的容器组合而成。容器技术有效地将由单个操作系统管理的资源划分到隔离的组中,以更好地在隔离的组之间平衡有冲突的资源使用需求,属于操作系统级的虚拟化技术,由于其轻量级的特性,被广泛应用。
2、Docker:
Docker是目前最具代表性的容器平台之一,Docker容器技术以宿主机中的容器为管理单元,各容器共用宿主机内核资源,并通过虚拟化技术实现资源的隔离与限制。容器技术的核心,是通过约束和修改进程的动态表现,从而为其创造出一个“边界”。
对于Docker等大多数Linux容器来说,控制组群(control groups,Cgroups)技术是用来制造约束的主要手段,而命名空间(Namespace)技术则是用来修改进程视图的主要方法。Namespace和Cgroups是Linux内核特性,namespaces是对全局系统资源的一种封装隔离,使得处于不同namespace的进程拥有独立的全局系统资源,改变一个namespace中的系统资源只会影响当前namespace里的进程,对其他namespace中的进程没有影响。Linux Cgroup是Linux内核的一个功能,用来限制、控制与分离一个进程组群的资源(如中央处理器(central processing unit,CPU)、内存、磁盘输入输出等)。所以,容器本质上是一个加了 限定参数的进程,一个正在运行的Docker容器,其实就是一个启用了多个Linux Namespace、受Cgroups配置的资源限制的应用进程。
3、虚拟机容器:
虚拟机容器是针对容器隔离安全问题提出的一种解决方案,通过将多个容器部署在传统虚拟机中,将虚拟机的安全性优势和容器的运行效率与资源利用率优势结合起来,在牺牲一些性能的情况下大大提高了容器的安全性。
在容器化场景下,容器间如何通信是一个重要课题,容器间通信需要用到网络虚拟化技术。网络虚拟化是虚拟化中的重要一环,该技术可在物理网络上虚拟多个相互隔离的虚拟网络,从而使得不同用户之间使用独立的网络资源切片,从而提高网络资源利用率,实现弹性的网络。
4、eventfd:
eventfd是Linux 2.6提供的一种系统调用,它可以用来实现事件通知。eventfd包含一个由内核维护的64位无符号整型计数器,创建eventfd时会返回一个文件描述符,进程可以通过对这个文件描述符进行读(read)/写(write)来读取/改变计数器的值,从而实现进程间通信。
5、Kubernetes(k8s):
Kubernetes是开源的容器集群管理系统。在Docker技术的基础上,为容器化的应用提供部署运行、资源调度、服务发现和动态伸缩等一系列完整功能,提高了大规模容器集群管理的便捷性。Kubernetes是一个完备的分布式系统支撑平台,具有完备的集群管理能力,多扩多层次的安全防护和准入机制、多租户应用支撑能力、透明的服务注册和发现机制、內建智能负载均衡器、强大的故障发现和自我修复能力、服务滚动升级和在线扩容能力、可扩展的资源自动调度机制以及多粒度的资源配额管理能力。同时Kubernetes提供完善的管理工具,涵盖了包括开发、部署测试、运维监控在内的各个环节。
6、Pod:
Pod是kubernetes可以部署和管理的最小单元,如果想要运行一个容器,先要为这个容器创建一个Pod。同时一个Pod也可以包含多个容器,之所以多个容器包含在一个Pod里,往往是由于业务上的紧密耦合。Pod中可以同时运行多个进程(作为容器运行)协同工作,同一个Pod中的容器会自动的分配到同一个node上,同一个Pod中的容器共享资源、网络环境和依赖,它们总是被同时调度。每个Pod都会被分配一个唯一的网际互连协议(Internet Protocol,IP)地址。Pod中的所有容器共享网络空间,包括IP地址和端口。
7、云计算架构:
云计算架构可以用三层SPI(SaaS、PaaS、IaaS)模型进行表述:
软件即服务(Software as a Service,SaaS)层(S层):用户看到的和使用的东西,网页、手机软件(application,APP)、报表等。
平台即服务(Platform as a Service,PaaS)层(P层):可以理解为平台层,通俗意义上的后台。
基础设施即服务(Infrastructrue as a Service,IaaS)层(I层):可以理解为基础设施层,各种网络、服务器或主机、存储设备。
其中,把硬件资源集中起来一个关键性技术突破就是虚拟化技术。虚拟化可以提高资源的有效利用率,使操作更加灵活,同时简化变更管理。单台物理服务器可以有多个虚拟机,同时提供分离和安全防护,每个虚拟机就象在自己的硬件上运行一样。这种把主机集中管理,以市场机制通过虚拟化层对外提供服务,用按使用量收费的盈利模式,形成了云计算的基础层。这就是IaaS,构成了云计算的基础层。
由于传统的网络环境中,一台物理主机包括一个或多个网卡(network interface card,NIC),要实现与其他物理主机之间的通信,需要通过自身的NIC连接到外部的网络设施。对应用进行隔离,往往是将一个应用部署在一台物理设备上。为了减少对物理资源的浪费,可以借助虚拟化技术对一台物理资源进行抽象(如图1所示),将一张物理网卡虚拟成多张虚拟网卡(virtual NIC,vNIC),通过虚拟机来隔离不同的应用。其中,虚拟机与虚拟机之间的通信,由虚拟交换机(vswitch,vsw)完成,虚拟网卡和虚拟交换机之间的链路也是虚拟的链路,整个主机内部构成了一个虚拟的网络,如果虚拟机之间涉及到三层的网络包转发,则由虚拟路由器来完成。
一般情况下,这一整套虚拟网络的模块都可以独立出去,由第三方来完成,如其中比较出名的一个解决方案就是开放虚拟交换机(Open vSwitch,OVS)。OVS是一款虚拟交换软件。虚拟交换就是利用虚拟平台,通过软件的方式形成交换机部件。跟传统的物理交换机相比,虚拟交换机配置更加灵活。一台普通的服务器可以配置出数十台甚至上百台虚拟交换机,且端口数目可以灵活选择。OVS的优势在于它基于软件定义网络(software-defined networking,SDN)的设计原则,方便虚拟机集群的控制与管理,另外就是它分布式的特性,可以“透明”地实现跨主机(或称为服务器)之间的虚拟机通信,如图2所示,图2是跨主机启用OVS通信的示意图。当前容器网络和虚拟机网络多采用此方案。其中虚拟化管理单元可以为容器也可以为虚拟机。
结合图2以及图3对目前虚拟机容器的通信方法进行描述,如图3所示,网络管理上多采用两套管理系统并存的方式进行管理,虚拟机中的容器网络和主机上I层虚拟机网络被分开管理,虚拟机网络使用开放计算管理平台(openStack,OPS)进行管理,而容器网络则使用k8s进行管理。容器间通信可以分为以下三种情况:
1、同一虚拟机内容器间的通信。
该情况下,流量仅在虚拟机内进行转发,目前主流方案是使用OVS或Linux网桥直接进行转发。下面以使用OVS网桥互通的情况为例进行描述(其他情况类似)。OVS上有网桥,每创建一个容器时,OVS会将容器的虚拟网卡挂接在其网桥上。同一虚拟机内的所有容器均连接在OVS的网桥上,通过该OVS网桥通信。
同一虚拟机内的容器1发往容器2的报文,先从容器1中经容器1的虚拟网卡拷贝到虚拟机中的OVS网桥上,再由OVS网桥拷贝至容器2的虚拟网卡上,整个过程共有一次转发和二次拷贝。这种情况下,虚拟机内容器间通信方式与传统裸机容器通信方式一致。
2、同一主机上两个虚拟机上的容器间的通信。
该情况涉及容器到虚拟机、以及虚拟机到主机(host)间的通信,图3中容器2和容器3间的通信,需要经过虚拟机中的容器网络和主机上的I层网络转发。以虚拟机上及host上均使用OVS网桥进行转发为例,容器2发往容器3的报文,首先从容器2中经容器2的虚拟 网卡拷贝到虚拟机中的OVS网桥上,再由OVS网桥拷贝至第一虚拟机(可以称为vm1)的虚拟网卡,接着从vm1的虚拟网卡拷贝到host上的OVS网桥,此时报文到达host上。数据从host发往容器3过程中,与报文从容器2发往host的路径刚好相反,需要的转发次数和拷贝次数是一致的。所以整个过程共有三次转发和五次拷贝。这种情况下,使用虚拟机容器比传统裸机容器多了虚拟机中OVS至虚拟机网卡,以及虚拟机网卡到host OVS间来回的四次拷贝。
3、虚拟机的容器与主机外界的通信。
该情况涉及容器到host的通信、及host到外界间的通信,这里只讨论容器到host这一段的通信。报文从容器1发往host的过程中,首先报文从容器1的虚拟网卡拷贝到虚拟机中的OVS网桥上,接着由OVS网桥拷贝至vm1的虚拟网卡,最后从vm1的虚拟网卡拷贝到host上的OVS网桥,此时报文到达host上,再由host转发到外界。这个过程共有二次转发和三次拷贝。这种情况下,使用虚拟机容器比传统裸机容器多了虚拟机中OVS至虚拟机网卡,以及虚拟机网卡到host OVS间的二次拷贝。
从图3可以看出,容器间传输的报文需要经过多次拷贝,转发性能较低。
针对上述问题,本申请实施例提供了一种通信方法,通过发送通告报文的方式传输数据报文所在的地址和长度,而不用频繁拷贝数据报文,可以减少容器之间传输数据报文带来的时延。本申请中的数据报文可以是任何方式封装的、任何种类的用于容器间通信的数据。例如,该数据报文可以用于承载控制信令,也可以用于承载业务数据了,可以包括协议信息,也可以是数据净荷,可以是二层数据,也可以是三层数据或其他层的数据。
图4给出了本申请实施例提供的通信方法所适用的通信系统示意图,该通信系统包括:主机和虚拟机。虚拟机可以运行在主机上。
其中,主机包括用户空间(user space)部分和内核空间(kernel space)部分,user space包括agent和虚拟交换机,虚拟交换机中含有收发包服务端。Kernel space包括Hypervisor。虚拟机包括proxy、收发包客户端、一个或多个容器(图中示出了容器1和容器2),每个容器对应一个虚拟接口(以下统称为接口),例如,容器1对应接口1,容器2对应接口2。
主机上部署代理(agent)组件,虚拟机中部署代理(proxy)组件,agent组件和proxy组件由k8s统一管理。相较于图3中虚拟机的容器网络和主机上虚拟机网络被分开管理,虚拟机网络需要对接openStack进行管理,容器网络需要对接k8s进行管理。图4使用了一套整合的网络管理方案将容器网络和虚拟机网络同时管理,简化了虚拟机容器的网络管理的复杂度。
k8s将容器创建事件下发到主机上时,主机上的agent监听到该事件,通过eventfd机制将容器创建事件通知到虚拟机中的proxy,由proxy负责容器网络的创建和管理(例如:接口创建以及绑定)。
运行在主机上的agent是一个支持插件式扩展的框架,负责虚拟机网络管理的插件和负责容器网络管理的插件同时运行在agent的框架下,共同管理主机上的网络。虚拟机网络管理插件可以采用kubevirt、virtlet等虚拟机管理方案,具体此处不做限定。容器网络管理参考图4中的管理通道,虚拟机中的容器不再由虚拟机自行管理,而是由主机同一管理。
容器间的数据传输参考图4中的数据通道,虚拟机中不再部署vsw,在主机上的vsw启动时,会从Hypervisor上获取本机上所有虚拟地址到物理地址的映射关系(可以称为地址映射表),并且运行过程中也会动态地同步更新地址映射关系。内核中Hypervisor掌握有整个内存资源,其维护虚拟地址到机器地址的映射关系,收发包客户端与Hypervisor之间的控制通道主要用于收发包客户端从Hypervisor处获取虚拟地址和物理地址的映射关系。收发包服务端与收发包客户端之间的控制通道主要用于收发包服务端(server)监听收发包客户端(client)的消息,以及维护收发包客户端的连接到虚拟机的对应关系,以区分不同虚拟机的连接。主机上的虚拟机启动后,虚拟机中的收发包客户端也同时启动,跟主机上的收发包服务端建立连接,并开始监视虚拟机上容器的网卡队列。若网卡队列新增报文,虚拟机中的收发包客户端与主机中的收发包服务端之间利用eventfd机制进行报文收发通知,通过虚拟机与主机共享内存减少或避免虚拟机和主机间收发报文的拷贝。其中,evevtfd也可以理解为底层通知机制,不经过协议栈。
可以理解的是,虚拟机上的一个接口也可以连接更多的容器,例如:一个接口连接两个容器,如图5所示,容器1与容器2共用接口1,容器3用接口2。另外,通信系统中主机和虚拟机的数量可以是多个,具体此处不做限定。例如:如图6所示,该通信系统包括服务器1与服务器2。其中,虚拟机1、虚拟机2以及虚拟交换机1部署在服务器1上,虚拟机3与虚拟交换机2部署在服务器2上。虚拟机1包括容器1与容器2,且容器1与容器2共用接口1。虚拟机2中包括容器3,容器3使用接口1进行通信。虚拟机3包括容器4与容器5,且容器4与容器5共用接口1。k8s管理整个系统,服务器1(也可以称为主机1或节点1)与服务器2(也可以称为主机2或节点2)之间通过交换机互通,交换机可以是叶子交换机(leaf)和/或骨干交换机(spine)。每个服务器都运行一个分布式agent,用于同一管理该服务器上的虚拟机网络和容器网络。每个服务器上的每个虚拟机中运行一个分布式proxy,用于接受agent的调用,执行本虚拟机内具体的容器网络管理事件。每个服务器上的vsw内运行收发包服务端,服务器上每个虚拟机内均运行一个收发包客户端,收发包服务端与收发包客户端通过eventfd机制协作完成容器之间的通信。
下面结合图4至图6的通信系统,对本申请实施例中的通信方法进行描述。本申请实施例中的通信装置(也可以称为服务器、网络设备等)可以是指第一虚拟机、第二虚拟机、第一主机或第二主机,具体此处不做限定。
请参阅图7,本申请实施例提供的通信方法的一个实施例包括步骤701至步骤710b。该通信方法可以由虚拟机和主机执行,也可以由虚拟机中的收发包客户端和主机中的收发包服务端执行,具体此处不做限定。
在步骤701中,第一虚拟机获取数据报文的第一虚拟存储地址以及长度。
本申请实施例中第一虚拟机获取数据报文的第一虚拟存储地址以及长度的方式有多种,可以是通过确定第一容器的网卡队列新增数据报文的方式,进而获取第一虚拟存储地址以及长度。还可以是除了第一虚拟机的其他装置向第一虚拟机发送第一虚拟存储地址和长度的方式等,具体此处不做限定。可选地,第一主机与第一虚拟机共用第一共享内存,该第一共享内存用于存储数据报文,第一虚拟存储地址指向第一共享内存,或者,当第一共享内存空间较大时,第一虚拟存储地址指向第一共享内存中存储所述数据报文的存储空间。
可选地,上述确定第一容器的网卡队列新增数据报文具体可以是,确定第一容器的网卡队列中新增指向第一共享内存的目标存储空间的第一指针,该目标存储空间存储有数据报文。
本申请实施例中的数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,即需要在第一容器与第二容器之间传输的报文。
在步骤702中,第一虚拟机根据所述第一虚拟存储地址以及所述长度生成第一通告报文。
第一虚拟机获取数据报文的第一虚拟存储地址以及长度之后,根据第一虚拟存储地址以及长度生成第一通告报文。
可选地,第一虚拟机中的收发包客户端根据第一虚拟存储地址以及该长度生成第一通告报文。
示例性的,第一通告报文的格式可以如表1所示:
表1
字段 样例 说明
Length 500 数据报文的长度
Address 0xb7a3001000000000 数据报文所在的虚拟存储地址
可选地,第一通告报文还包括接口编号,该接口编号可以用于识别第二容器所连接
的第二虚拟机中的接口。
示例性的,若接口1对应一个网卡队列标识(queue ID),第一通告报文的格式可以
如表2或表3所示:
表2
字段 样例 说明
Length 500 数据报文的长度
Veth 1 接口编号
Address 0xb7a3001000000000 数据报文所在的虚拟存储地址
可选地,第一通告报文还包括网卡队列的标识,该网卡队列标识可以用于识别第二
容器对应的虚拟接口上属于第二容器的网卡队列。
表3
字段 样例 说明
Length 500 数据报文的长度
queue ID 2 网卡队列标识
Address 0xb7a3001000000000 数据报文所在的虚拟存储地址
可选地,若一个虚拟机接口承载多个容器的虚拟网卡,本申请实施例中的通告报文
增加queue ID,以区分同一接口上不同容器的网卡队列,虚拟机以及主机存储有容器的
网卡队列与queue ID的对应关系,使得发送通告报文时,可以增加queue ID识别接口
上属于某一容器的网卡队列。
示例性的,若接口1对应多个网卡队列标识,第一通告报文的格式可以如表4所示:
表4
字段 样例 说明
Length 500 数据报文的长度
Veth 1 接口编号
queue ID 2 网卡队列标识
Address 0xb7a3001000000000 数据报文所在的虚拟存储地址
可以理解的是,上述第一通告报文的格式只是举例,具体格式此处不做限定。
在步骤703中,第一虚拟机向第一主机发送第一通告报文。
第一虚拟机生成第一通告报文之后,向第一主机发送第一通告报文。
可选地,第一虚拟机中的收发包客户端向第一主机中的收发包服务端发送第一通告报文,具体可以采用eventfd机制传输第一通告报文,可以理解为第一虚拟机中的收发包客户端与第一主机中的收发包服务端作为第一主机上的两个进程,通过eventfd机制进行了进程间通信来传输第一通告报文。
在步骤704中,第一主机根据地址映射表确定第一虚拟存储地址对应的第一物理存储地址。
本申请实施例中第一主机获取地址映射表的方式可以是从第一主机内核中的Hypervisor处获取,也可以是通过其他装置向第一主机发送地址映射表的方式获取,具体此处不做限定。该地址映射表存储有一个物理存储地址与多个虚拟存储地址的对应关系。内核中的Hypervisor维护虚拟存储地址与机器地址(也可以理解为物理存储地址)的映射关系(即地址映射表)。
第一主机获取地址映射表以及第一通告报文之后,确定第一虚拟存储地址对应的第一物理存储地址,该第一物理存储地址为数据报文所在存储空间(可以理解为前面提到的第一共享内存)对应的物理存储地址,或者可以理解为第一物理存储地址指向第一共享内存。
可选地,第一主机中的收发包服务端确定第一虚拟存储地址对应的第一物理存储地址。
在步骤705中,第一主机根据第一物理存储地址以及长度获取数据报文。
第一主机确定数据报文的第一物理存储地址之后,根据第一物理存储地址以及长度从第一共享内存中获取数据报文。
可选地,第一主机中的收发包服务端根据第一物理存储地址以及长度从第一共享内存中获取数据报文。
可选地,第一主机根据数据报文中的目的地址和vsw转发规则,确定数据报文的下一跳地址和出接口,进而根据数据报文的下一跳地址和/或出接口确定第二虚拟机上的第二容器是部署在第一主机上,还是部署在第二主机上。其中,vsw转发规则可以是预先配置好的。
可选地,第一主机获取数据报文之后,可以根据数据报文确定第二虚拟机部署在第一主机上还是第二主机上。若第二虚拟机部署在第一主机上,则执行步骤706a和步骤707a。若第二虚拟机部署在第二主机上,则执行步骤706b至步骤710b。
在步骤706a中,若第二虚拟机部署在第一主机上,则第一主机向第二虚拟机发送第二通告报文。
若第二虚拟机部署在第一主机上,则第一主机确定第一物理存储地址对应的第二虚拟存储地址,根据第二虚拟存储地址以及数据报文的长度生成第二通告报文。并向第二虚拟机发送第二通告报文。其中,第一虚拟存储地址与第二虚拟存储地址可以相同或不相同,但是第一虚拟存储地址与第二虚拟存储地址与第一物理存储地址对应,也可以理解为第一虚拟存储 地址与第二虚拟存储地址指向同一个物理存储空间。
本申请实施例中第二通告报文的格式如前述第一通告报文的格式类似,具体此处不再赘述。
可选地,第一主机中的收发包服务端生成第二通告报文之后,根据对应关系表向第二虚拟机中的收发包客户端发送第二通告报文。其中,该对应关系表存储有虚拟机与收发包客户端的对应关系,一个虚拟机对应一个收发包客户端。
在步骤707a中,第二虚拟机根据第二通告报文获取数据报文。
第二虚拟机接收第二通告报文之后,根据第二虚拟存储地址以及长度获取数据报文。可以理解为,第二虚拟机根据长度以及第二虚拟存储地址从第一共享内存中读取出数据报文。由于第二虚拟机部署在第一主机上,且第一虚拟机、第一主机以及第二虚拟机共用第一共享内存。又由于第二虚拟存储地址指向存储数据报文的第一共享内存。因此,第二虚拟机可以根据第二虚拟存储地址找到存储数据报文的第一共享内存,并根据长度从第一共享内存中取出数据报文。
可选地,第二虚拟机中的收发包客户端收到第二通告报文之后,根据第二虚拟地址以及长度读取出数据报文。并将数据报文放在第二容器的网卡队列上,从而使得第二容器获取数据报文。
可选地,第一指针被读取后失效(第一虚拟机或者第一虚拟机中的收发包客户端读取),或者第二容器获取数据报文之后反馈一个响应报文(用来指示第二容器已正确接收数据报文),第一虚拟机可以从第一容器的网卡队列中删除第一指针。
在步骤706b中,若第二虚拟机部署在第二主机上,则第一主机向第二主机发送数据报文。
可选地,第一主机中的收发包服务端向第二主机中的收发包服务端发送数据报文。
可选地,第一主机根据数据报文中的目的地址和vsw转发规则向第二主机发送数据报文。
可以理解的是,也可以是第一主机通过第三主机向第二主机发送数据报文,即第一主机并不是直接向第二主机发送数据报文,相应的,第二主机接收来自第一主机的数据报文。对于中间设备(第三主机)可以没有,也可以有多个,具体此处不做限定。
在步骤707b中,第二主机根据地址映射表确定第二物理存储地址对应的第三虚拟存储地址。
第二主机接收第一主机发送的数据报文,将数据报文存储在第二物理存储地址,并根据地址映射表将存储数据报文的第二物理存储地址转化为第三虚拟存储地址。例如,第二主机接收第一主机发送的数据报文之后,将数据报文存储在第二共享内存,第二共享内存的物理存储地址为第二物理存储地址。
可选地,第二主机中的收发包服务端根据地址映射表确定第二物理存储地址对应的第三虚拟存储地址。
可选地,第二虚拟机与第二主机共用一个第二共享内存,第二共享内存存储有数据报文,第二物理存储地址与第三虚拟存储地址指向第二共享内存。
在步骤708b中,第二主机根据第三虚拟存储地址以及数据报文的长度生成第三通告报文。
第二主机确定第三虚拟存储地址之后,根据第三虚拟存储地址以及数据报文的长度生成第三通告报文。
可选地,第二主机中的收发包服务端根据第三虚拟存储地址以及数据报文的长度生成第三通告报文。
本申请实施例中第三通告报文的格式如前述第一通告报文的格式类似,具体此处不再赘述。
在步骤709b中,第二主机向第二虚拟机发送第三通告报文。
可选地,第二主机中的收发包服务端向第二虚拟机中的收发包客户端发送第三通告报文。
在步骤710b中,第二虚拟机根据第三通告报文获取数据报文。
第二虚拟机接收第三通告报文之后,根据第三虚拟存储地址以及长度获取数据报文,可以理解为,第二虚拟机根据长度以及第三虚拟存储地址从第二共享内存中读取出数据报文。由于第二虚拟机部署在第二主机上,第二虚拟机与第二主机共用第二共享内存。又由于第三虚拟存储地址指向存储数据报文的第二共享内存。因此,第二虚拟机可以根据第三虚拟存储地址找到存储数据报文的第二共享内存,并根据长度从第二共享内存中取出数据报文。
可选地,第二虚拟机中的收发包客户端收到第三通告报文之后,根据第三虚拟存储地址以及长度读取出数据报文。并将数据报文放在第二容器的网卡队列上,从而使得第二容器获取数据报文。
一种可能实现的方式中,本申请实施例的通信方法包括步骤701至703,即虚拟机与主机之间的通信。另一种可能实现的方式中,本申请实施例的通信方法包括步骤701至707a,即同一主机上不同虚拟机中的容器之间的通信。另一种可能实现的方式中,本申请实施例的通信方法包括步骤701至步骤705、步骤707a至步骤710b,即不同主机上的容器之间的通信。
本申请实施例中的通信方法可以应用于Linux Container(LXC),也可以应用于libvirt-lxc,还可以应用于Docker、Rocket等场景下,具体此处不做限定。
本申请实施例中,一方面,通过发送通告报文以及虚拟机与主机间共享内存的方式传输数据报文所在的地址和长度,减少容器之间传输数据报文带来的时延,而不用频繁拷贝数据报文,可以减少数据报文在传输中的拷贝或转发。另一方面,agent组件和proxy组件由k8s一套管理系统统一管理(即虚拟机网络和容器网络统一管理)。相较于图3中虚拟机的容器网络和主机上虚拟机网络被分开管理,本申请实施例使用了一套整合的网络管理方案将容器网络和虚拟机网络同时管理,简化了虚拟机容器的网络管理的复杂度。
相应于上述方法实施例给出的方法,本申请实施例还提供了相应的装置,包括用于执行上述实施例相应的模块。所述模块可以是软件,也可以是硬件,或者是软件和硬件结合。
请参阅图8,为本申请实施例中通信装置的一个实施例,该通信装置可以是第一虚拟机,也可以是第一虚拟机的部件(例如第一虚拟机中的收发包客户端),该通信装置包括:
获取单元801,用于获取数据报文的第一虚拟存储地址以及所述数据报文的长度,所述数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在第一主机上,所述第二虚拟机部署在所述第一主机或不同于所述第一主机的第二主机上;
生成单元802,用于根据所述第一虚拟存储地址以及所述长度生成第一通告报文;
发送单元803,用于向所述第一主机发送所述第一通告报文,所述第一通告报文用于使所述第一主机触发所述第二容器获取所述数据报文。
可选地,通信装置还包括:确定单元804,用于确定所述第一容器的网卡队列新增所述数据报文。
可选地,第一指针被读取后失效。
可选地,所述第一虚拟机、所述第一主机以及第二虚拟机共用第一共享内存,所述第二虚拟机部署在所述第一主机上;或者所述第一虚拟机与所述第一主机共用所述第一共享内存,所述第二虚拟机部署在所述第二主机上;所述第一共享内存用于存储所述数据报文,所述第一虚拟存储地址指向所述第一共享内存。
可选地,第一通告报文还包括网卡队列的标识,所述网卡队列的标识用于识别所述第二容器对应的虚拟接口上属于所述第二容器的所述网卡队列。
可选地,确定单元804,具体用于确定所述网卡队列中新增指向所述第一共享内存的目标存储空间的第一指针,所述目标存储空间用于存储所述数据报文。
本实施例中,通信装置中各单元所执行的操作与前述图4至图7所示实施例中对于第一虚拟机或第一虚拟机中的收发包客户端描述的类似,此处不再赘述。
本实施例中,发送单元803通过发送通告报文的方式传输数据报文所在的地址和长度,减少容器之间传输数据报文带来的时延,即减少数据报文在传输中的拷贝或转发。
请参阅图9,本申请实施例中通信装置的另一个实施例,该通信装置可以是第一主机,也可以是第一主机的部件(例如第一主机中的收发包服务端、处理器、芯片、或芯片系统等),该通信装置包括:
接收单元901,用于接收第一虚拟机发送的第一通告报文,所述第一通告报文包括数据报文对应的第一虚拟存储地址以及所述数据报文的长度,所述数据报文为所述第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在第一主机上,所述第二虚拟机部署在所述第一主机或不同于所述第一主机的第二主机上;
确定单元902,用于根据地址映射表确定所述第一虚拟存储地址对应的第一物理存储地址,所述第一物理存储地址为所述数据报文所在第一共享内存对应的物理存储地址,所述地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;
获取单元903,用于根据所述第一物理存储地址以及所述长度获取所述数据报文;
发送单元904,用于若所述第二虚拟机部署在所述第一主机上,则向所述第二虚拟机发送第二通告报文,所述第二通告报文包括第二虚拟存储地址以及所述长度,所述第二虚拟存储地址由所述第一物理存储地址转化得到,所述第二通告报文用于所述第二容器获取所述数据报文。
可选地,发送单元904,还用于若所述第二虚拟机部署在所述第二主机上,则向所述第二主机发送所述数据报文。
可选地,所述第一虚拟机、所述第一主机以及第二虚拟机共用第一共享内存,所述第二虚拟机部署在所述第一主机上;或者所述第一虚拟机与所述第一主机共用所述第一共享内存,所述第二虚拟机部署在所述第二主机上;所述第一共享内存用于存储所述数据报文。
本实施例中,通信装置中各单元所执行的操作与前述图4至图7所示实施例中对于第一主机或第一主机中的收发包服务端描述的类似,此处不再赘述。
本实施例中,接收单元901接收第一虚拟机发送的第一通告报文之后,若第二虚拟机部 署在第一主机上,则发送单元904向第二虚拟机发送第二通告报文,发送单元904通过发送通告报文的方式传输数据报文所在的地址和长度,减少容器之间传输数据报文带来的时延。
请参阅图10,本申请实施例中通信装置的另一个实施例,该通信装置可以是第二主机,也可以是第二主机的部件(例如第一主机中的收发包服务端、处理器、芯片、或芯片系统等),该通信装置包括:
接收单元1001,用于接收来自第一主机的数据报文,所述数据报文为所述第一虚拟机上的第一容器与所述第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在所述第一主机上,所述第二虚拟机部署在第二主机上,所述第一主机与所述第二主机为不同的主机;
确定单元1002,用于根据地址映射表确定数据报文的物理存储地址对应的虚拟存储地址,所述地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;
生成单元1003,用于根据所述虚拟存储地址以及所述数据报文的长度生成通告报文;
发送单元1004,用于向所述第二虚拟机发送所述通告报文,所述通告报文用于所述第二容器获取所述数据报文。
可选地,第二虚拟机与所述第二主机共用一个共享内存,所述第二虚拟机部署在所述第二主机上,所述物理存储地址以及所述虚拟存储地址指向所述共享内存;所述共享内存用于存储所述数据报文。
本实施例中,通信装置中各单元所执行的操作与前述图4至图7所示实施例中对于第二主机或第二主机中的收发包服务端描述的类似,此处不再赘述。
本实施例中,接收单元1001接收来自第一主机的数据报文,生成单元1003将根据第三虚拟存储地址以及数据报文的长度生成第三通告报文,发送单元1004向第二虚拟机发送第三通告报文。发送单元1004通过发送通告报文的方式传输数据报文所在的地址和长度,减少容器之间传输数据报文带来的时延。
请参阅图11,本申请实施例中通信装置的另一个实施例,该通信装置可以是第二虚拟机,也可以是第二虚拟机的部件(例如第二虚拟机中的收发包客户端),该通信装置包括:
接收单元1101,用于接收通告报文,所述通告报文包括数据报文所在的第二虚拟存储地址以及所述数据报文的长度,所述数据报文为第一虚拟机上的第一容器与所述第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在第一主机上,所述第二虚拟机部署在所述第一主机或不同于所述第一主机的第二主机上;
获取单元1102,用于根据所述第二虚拟存储地址以及所述长度获取所述数据报文。
可选地,通信装置还包括:处理单元1103,用于将第二指针写入所述第二容器的网卡队列,以使得所述第二容器获取所述数据报文,所述第二指针指向所述第一共享内存或所述第二共享内存的目标存储空间,所述目标存储空间用于存储所述数据报文。
可选地,所述通告报文由所述第一主机生成,所述第二虚拟机部署在所述第一主机上,所述第一虚拟机、所述第一主机以及所述第二虚拟机共用第一共享内存,所述第一共享内存用于存储所述数据报文。
可选地,通告报文由所述第二主机生成,所述第二虚拟机部署在所述第二主机上,所述第二虚拟机以及所述第二主机共用一个第二共享内存,所述第二共享内存用于存储所述数据报文。
可选地,通告报文还包括网卡队列的标识,所述网卡队列的标识用于识别所述第二容器对应的虚拟接口上属于所述第二容器的所述网卡队列。
本实施例中,通信装置中各单元所执行的操作与前述图4至图7所示实施例中对于第二虚拟机或第二虚拟机中的收发包客户端描述的类似,此处不再赘述。
本实施例中,通过接收单元1101接收通告报文以及确定数据报文所在的地址和长度,进而获取单元1102获取数据报文,减少容器之间传输数据报文带来的时延。
请参阅图12,为上述实施例中所涉及的通信装置的一种可能的示意图,该通信装置具体可以为前述实施例中的第一主机(其中,第一虚拟机部署在第一主机上或者第一虚拟机以及第二虚拟机部署在第一主机上)或第二主机(其中,第二虚拟机可以部署在第二主机上),该通信装置可以包括但不限于处理器1201、通信端口1202、存储器1203、总线1204。
处理器1201可以是中央处理器单元,通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。该处理器1201也可以是实现计算功能的组合,例如包含一个或多个微处理器的组合,数字信号处理器和微处理器的组合等等。为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
存储器1203中可以包括第一共享内存或第二共享内存,用来存储数据报文。
本申请实施例中,第一虚拟机与第一主机共用一套物理设备,或者第一虚拟机、第二虚拟机与第一主机共用一套物理设备,或者第二虚拟机与第二主机共用一套物理设备,具体此处不做限定。
需要说明的是,图12所示通信装置具体可以用于实现图4至图7对应方法实施例中通信装置所执行的步骤的功能,并实现通信装置对应的技术效果,图12所示通信装置的具体实现方式,均可以参考图4至图7对应的各个方法实施例中的叙述,此处不再一一赘述。
可选地,通信装置还可以如图13所示,该通信装置可以包括但不限于处理器1301、通信端口1302、存储器1303、总线1304。其中图13中各单元的功能以及有益效果可参考前述图12中各单元的描述,与前述图12不同的是,图13中的处理器1301包括收发包服务端以及收发包客户端,收发包客户端,主要是监视虚拟机中容器的报文收发队列,并生成如前述图4至图7所示实施例中的通告报文,收发包的客户端运行在虚拟机上。另外一部分是收发包服务端,负责报文的处理和生成如前述图4至图7所示实施例中的通告报文,收发包服务端运行在物理服务器上。
本申请实施例还提供一种存储计算机执行指令的计算机可读存储介质,当计算机执行指令被处理器执行时,该处理器执行如前述实施例中通信装置可能的实现方式所述的方法,其中,该通信装置具体可以为前述图4至图7对应方法实施例中通信装置。
本申请实施例还提供一种存储一个或多个计算机的计算机程序产品,当计算机程序产品被该处理器执行时,该处理器执行上述通信装置可能实现方式的方法,其中,该通信装置具体可以为前述图4至图7对应方法实施例中通信装置。
本申请实施例还提供了一种芯片系统,该芯片系统包括处理器,用于支持通信装置实现上述通信装置可能的实现方式中所涉及的功能。在一种可能的设计中,该芯片系统还可以包 括存储器,存储器,用于保存该通信装置必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件,其中,该通信装置具体可以为前述图4至图7对应方法实施例中通信装置。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。

Claims (25)

  1. 一种通信方法,其特征在于,所述方法包括:
    获取数据报文的第一虚拟存储地址以及所述数据报文的长度,所述数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在第一主机上,所述第二虚拟机部署在所述第一主机或不同于所述第一主机的第二主机上;
    根据所述第一虚拟存储地址以及所述长度生成第一通告报文;
    向所述第一主机发送所述第一通告报文,所述第一通告报文用于使所述第一主机触发所述第二容器获取所述数据报文。
  2. 根据权利要求1所述的方法,其特征在于,所述数据报文存储在第一共享内存中,所述第一虚拟存储地址指向所述第一共享内存,
    所述第一虚拟机、所述第一主机以及所述第二虚拟机共用所述第一共享内存,所述第二虚拟机部署在所述第一主机上;
    或者
    所述第一虚拟机与所述第一主机共用所述第一共享内存,所述第二虚拟机部署在所述第二主机上。
  3. 根据权利要求2所述的方法,其特征在于,所述获取数据报文的第一虚拟存储地址以及所述数据报文的长度之前,所述方法还包括:
    确定所述第一容器的网卡队列新增所述数据报文。
  4. 根据权利要求3所述的方法,其特征在于,所述第一通告报文还包括网卡队列的标识,所述网卡队列的标识用于识别所述第二容器对应的虚拟接口上属于所述第二容器的所述网卡队列。
  5. 根据权利要求3或4所述的方法,其特征在于,所述确定所述第一容器的网卡队列新增所述数据报文,包括:
    确定所述网卡队列中新增指向所述第一共享内存的目标存储空间的第一指针,所述目标存储空间用于存储所述数据报文。
  6. 根据权利要求5所述的方法,其特征在于,所述第一指针被读取后失效。
  7. 一种通信方法,其特征在于,所述方法包括:
    接收第一虚拟机发送的第一通告报文,所述第一通告报文包括数据报文对应的第一虚拟存储地址以及所述数据报文的长度,所述数据报文为所述第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在第一主机上,所述第二虚拟机部署在所述第一主机或不同于所述第一主机的第二主机上;
    根据地址映射表确定所述第一虚拟存储地址对应的第一物理存储地址,所述第一物理存储地址为所述数据报文所在第一共享内存对应的物理存储地址,所述地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;
    根据所述第一物理存储地址以及所述长度获取所述数据报文;
    若所述第二虚拟机部署在所述第一主机上,则向所述第二虚拟机发送第二通告报文,所述第二通告报文包括第二虚拟存储地址以及所述长度,所述第二虚拟存储地址由所述第一物理存储地址转化得到,所述第二通告报文用于所述第二容器获取所述数据报文。
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:
    若所述第二虚拟机部署在所述第二主机上,则向所述第二主机发送所述数据报文。
  9. 根据权利要求7或8所述的方法,其特征在于,所述第一虚拟机、所述第一主机以及所述第二虚拟机共用所述第一共享内存,所述第二虚拟机部署在所述第一主机上;
    或者
    所述第一虚拟机与所述第一主机共用所述第一共享内存,所述第二虚拟机部署在所述第二主机上。
  10. 一种通信方法,其特征在于,所述方法包括:
    接收来自第一主机的数据报文,所述数据报文为第一虚拟机上的第一容器与第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在所述第一主机上,所述第二虚拟机部署在第二主机上,所述第一主机与所述第二主机为不同的主机;
    根据地址映射表确定所述数据报文的物理存储地址对应的虚拟存储地址,所述地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;
    根据所述拟存储地址以及所述数据报文的长度生成通告报文;
    向所述第二虚拟机发送所述通告报文,所述通告报文用于所述第二容器获取所述数据报文。
  11. 根据权利要求10所述的方法,其特征在于,
    所述第二虚拟机与所述第二主机共用一个共享内存,所述物理存储地址以及所述虚拟存储地址指向所述共享内存;
    所述共享内存用于存储所述数据报文。
  12. 一种通信方法,其特征在于,所述方法包括:
    接收通告报文,所述通告报文包括数据报文所在的虚拟存储地址以及所述数据报文的长度,所述数据报文为第一虚拟机上的第一容器与所述第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在第一主机上,所述第二虚拟机部署在所述第一主机或不同于所述第一主机的第二主机上;
    根据所述虚拟存储地址以及所述长度获取所述数据报文。
  13. 根据权利要求12所述的方法,其特征在于,所述通告报文由所述第一主机生成,所述第二虚拟机部署在所述第一主机上,所述第一虚拟机、所述第一主机以及所述第二虚拟机共用第一共享内存,所述第一共享内存用于存储所述数据报文。
  14. 根据权利要求12所述的方法,其特征在于,所述通告报文由所述第二主机生成,所述第二虚拟机部署在所述第二主机上,所述第二虚拟机以及所述第二主机共用第二共享内存,所述第二共享内存用于存储所述数据报文。
  15. 根据权利要求12至14中任一项所述的方法,其特征在于,所述通告报文还包括网卡队列的标识,所述网卡队列的标识用于识别所述第二容器对应的虚拟接口上属于所述第二容器的所述网卡队列。
  16. 根据权利要求15所述的方法,其特征在于,所述方法还包括:
    将第二指针写入所述第二容器的网卡队列,以使得所述第二容器获取所述数据报文,所述第二指针指向所述第一共享内存或所述第二共享内存的目标存储空间,所述目标存储空间 用于存储所述数据报文。
  17. 一种通信系统,其特征在于,所述通信系统包括第一虚拟机、第一主机以及第二虚拟机,所述第一虚拟机用于:
    获取数据报文的第一虚拟存储地址以及所述数据报文的长度,所述数据报文为所述第一虚拟机上的第一容器与所述第二虚拟机上的第二容器之间通信的报文,所述第一虚拟机部署在第一主机上,所述第二虚拟机部署在所述第一主机或不同于所述第一主机的第二主机上;
    根据所述第一虚拟存储地址以及所述长度生成第一通告报文;
    向所述第一主机发送所述第一通告报文,所述第一通告报文用于使所述第一主机触发所述第二容器获取所述数据报文。
  18. 根据权利要求17所述的通信系统,其特征在于,所述第一主机用于:
    根据地址映射表确定所述第一虚拟存储地址对应的第一物理存储地址,所述第一物理存储地址为所述数据报文所在存储空间对应的物理存储地址,所述地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;
    根据所述第一物理存储地址以及所述长度获取所述数据报文。
  19. 根据权利要求18所述的通信系统,其特征在于,所述第一主机还用于:
    若所述第二虚拟机部署在所述第一主机上,则向所述第二虚拟机发送第二通告报文,所述第二通告报文包括第二虚拟存储地址以及所述长度,所述第二虚拟存储地址由所述第一物理存储地址转化得到,所述第二通告报文用于所述第二容器获取所述数据报文;
    若所述第二虚拟机部署在所述第二主机上,则向所述第二主机发送所述数据报文。
  20. 根据权利要求17-19任意一项所述的通信系统,其特征在于,所述通信系统还包括所述第二主机,用于:
    根据地址映射表将第二物理存储地址转化为第三虚拟存储地址,所述数据报文的存储空间的物理地址为第二物理存储地址,所述地址映射表存储有一个物理存储地址与一个或多个虚拟存储地址的对应关系;
    根据所述第三虚拟存储地址以及所述数据报文的长度生成第三通告报文;
    向所述第二虚拟机发送所述第三通告报文,所述第三通告报文用于所述第二容器获取所述数据报文。
  21. 根据权利要求19所述的通信系统,其特征在于,所述第二虚拟机部署在所述第一主机上,所述第二虚拟机用于:
    接收所述第一主机发送的第二通告报文;
    根据所述第二虚拟存储地址以及所述长度获取所述数据报文。
  22. 根据权利要求20所述的通信系统,其特征在于,所述第二虚拟机部署在所述第二主机上,所述第二虚拟机用于:
    接收所述第二主机发送的第三通告报文;
    根据所述第三虚拟存储地址以及所述长度获取所述数据报文。
  23. 一种通信装置,其特征在于,包括:处理器,所述处理器与存储器耦合,所述存储器用于存储程序或指令,当所述程序或指令被所述处理器执行时,使得所述装置执行如权利要 求1至6中任一项所述的方法,或者使得所述装置执行如权利要求12至16中任一项所述的方法。
  24. 一种通信装置,其特征在于,包括:处理器,所述处理器与存储器耦合,所述存储器用于存储程序或指令,当所述程序或指令被所述处理器执行时,使得所述装置执行如权利要求7至9中任一项所述的方法,或者使得所述装置执行如权利要求10或11所述的方法。
  25. 一种计算机可读介质,其特征在于,其上存储有计算机程序或指令,当所述计算机程序或指令在计算机上运行时,使得计算机执行如权利要求1至6中任一项所述的方法、或执行如权利要求7至9中任一项所述的方法、或执行如权利要求10或11所述的方法、或执行如权利要求12至16中任一项所述的方法。
PCT/CN2021/116145 2021-01-28 2021-09-02 一种通信方法、装置以及系统 WO2022160714A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110120171.8A CN114816651A (zh) 2021-01-28 2021-01-28 一种通信方法、装置以及系统
CN202110120171.8 2021-01-28

Publications (1)

Publication Number Publication Date
WO2022160714A1 true WO2022160714A1 (zh) 2022-08-04

Family

ID=82525389

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/116145 WO2022160714A1 (zh) 2021-01-28 2021-09-02 一种通信方法、装置以及系统

Country Status (2)

Country Link
CN (1) CN114816651A (zh)
WO (1) WO2022160714A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116016320A (zh) * 2022-12-30 2023-04-25 中国联合网络通信集团有限公司 数据传输方法、装置及计算机可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160055017A1 (en) * 2014-08-23 2016-02-25 Vmware, Inc. Application publishing using memory state sharing
CN109992352A (zh) * 2017-12-29 2019-07-09 迈普通信技术股份有限公司 数据传输方法、装置、电子设备及可读取存储介质
WO2019161557A1 (zh) * 2018-02-24 2019-08-29 华为技术有限公司 一种通信的方法及装置
CN110572288A (zh) * 2019-11-04 2019-12-13 河南戎磐网络科技有限公司 一种基于可信容器的数据交换方法
CN110659143A (zh) * 2019-08-13 2020-01-07 深圳信息职业技术学院 一种容器间的通讯方法、装置及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160055017A1 (en) * 2014-08-23 2016-02-25 Vmware, Inc. Application publishing using memory state sharing
CN109992352A (zh) * 2017-12-29 2019-07-09 迈普通信技术股份有限公司 数据传输方法、装置、电子设备及可读取存储介质
WO2019161557A1 (zh) * 2018-02-24 2019-08-29 华为技术有限公司 一种通信的方法及装置
CN110659143A (zh) * 2019-08-13 2020-01-07 深圳信息职业技术学院 一种容器间的通讯方法、装置及电子设备
CN110572288A (zh) * 2019-11-04 2019-12-13 河南戎磐网络科技有限公司 一种基于可信容器的数据交换方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116016320A (zh) * 2022-12-30 2023-04-25 中国联合网络通信集团有限公司 数据传输方法、装置及计算机可读存储介质
CN116016320B (zh) * 2022-12-30 2024-03-19 中国联合网络通信集团有限公司 数据传输方法、装置及计算机可读存储介质

Also Published As

Publication number Publication date
CN114816651A (zh) 2022-07-29

Similar Documents

Publication Publication Date Title
US11792126B2 (en) Configuring service load balancers with specified backend virtual networks
US11074091B1 (en) Deployment of microservices-based network controller
CN110875848B (zh) 控制器和用于配置虚拟执行元件的虚拟网络接口的方法
US11743182B2 (en) Container networking interface for multiple types of interfaces
US20220294885A1 (en) Technologies for network packet processing between cloud and telecommunications networks
US20230123775A1 (en) Cloud native software-defined network architecture
EP4307115A1 (en) Multiple virtual network interface support for virtual execution elements
US20220334864A1 (en) Plurality of smart network interface cards on a single compute node
US11991077B2 (en) Data interfaces with isolation for containers deployed to compute nodes
TWI408934B (zh) 網路介面技術
CN111522653A (zh) 基于容器的网络功能虚拟化平台
US11095716B2 (en) Data replication for a virtual networking system
WO2014206105A1 (zh) 虚拟交换方法、相关装置和计算机系统
US20200389399A1 (en) Packet handling in software-defined networking (sdn) environments
EP4199457A1 (en) Packet drop monitoring in a virtual router
WO2022160714A1 (zh) 一种通信方法、装置以及系统
WO2021103657A1 (zh) 网络操作方法、装置、设备和存储介质
WO2020108292A1 (zh) 虚拟私有云通信系统、系统配置方法及控制器
Guay et al. Early experiences with live migration of SR-IOV enabled InfiniBand
Antón et al. Rina-based virtual networking solution for distributed vnfs: Prototype and benchmarking
EP4184323A1 (en) Performance tuning in a network system
CN108886476B (zh) 虚拟交换机数据平面和数据平面迁移的多个提供器框架
US11818041B2 (en) Containerized management of forwarding components in a router using routing engine processor
EP4160410A1 (en) Cloud native software-defined network architecture
EP4075757A1 (en) A plurality of smart network interface cards on a single compute node

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21922309

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21922309

Country of ref document: EP

Kind code of ref document: A1