Method and device for running heterogeneous instruction set containers in container cloud platform

By cropping QEMU and customizing cores, the problems of poor operation performance and complex management of container images on the Shenwei and Loongson CPU platforms are solved, efficient operation and resource conservation are achieved, and the shortcomings of scarce mirror resources are alleviated.

CN114168255BActive Publication Date: 2024-11-26DIANKEYUN (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010949478.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-10
Publication Date
2024-11-26
Estimated Expiration
2040-09-10

AI Technical Summary

Technical Problem

The prior art has poor performance and complex management when running container image on Shenwei and Loongson CPU platforms, and high resource consumption, resulting in the problem of scarce container image resources.

Method used

By cutting the QEMU virtualization tool, a virtual machine based on the standard instruction set is built, and customized kernels are loaded in the virtual machine, and the container runtime module is encapsulated to achieve efficient operation of heterogeneous instruction set containers.

Benefits of technology

It improves the operating efficiency of containers on Shenwei and Loongson CPUs, reduces resource consumption, alleviates the problem of scarce mirror resources, and realizes the rapid deployment and transparent management of massive container images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114168255B_ABST
    Figure CN114168255B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for operating a heterogeneous instruction set container in a container cloud platform, the method comprising: selecting a node for deploying a workload based on workload deployment information and cluster load status from a user terminal; obtaining a container image from an image repository based on the chip type of the selected node and the name / or address of the container image used by the workload, and in the absence of a Shenwei or Loongson instruction set version, starting a tailored QEMU on the selected node to build a virtual machine based on the x86‑64 instruction set; loading a compiled virtual machine kernel encapsulated with a container runtime in the built virtual machine; loading the container runtime after kernel initialization, and running a user-specified container image to start one or more applications in a heterogeneous instruction set container. The method of the present invention enables a large number of container resources in the image community to run efficiently in CPUs such as Shenwei and Loongson, allowing domestic platforms to make full use of existing massive open source container resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing technology, and in particular to a method and device for operating a heterogeneous instruction set container, and in particular to a method and device for operating a heterogeneous instruction set container for Shenwei and Loongson platforms. Background Art

[0002] Container technology is an indispensable part of the development of the cloud industry in recent years. The use of container technology services on cloud computing platforms has produced container cloud platform technology. The core of container technology is to group and divide available resources such as computing, storage, and network in the operating system so that applications can run independently in each resource group. This way of working can isolate the resource usage of different applications to a certain extent, and can also reuse basic functional components at the bottom of the operating system. However, this method has an inherent technical limitation, that is, after the application is compiled (the process of generating an executable program from source code), the application can only run on the instruction set architecture specified by the compiler. Instruction set refers to the basic instruction set used by a computing chip. In the field of cloud computing, it generally refers to the instruction set of the CPU in the cloud node (physical machine). At present, the most common instruction sets are the x86 and x86-64 instruction sets promoted by Intel / AMD; the Power (PPC64) instruction set promoted by IBM; and the aarch (arm) and aarch64 (arm64) instruction sets promoted by ARM. At present, the instruction sets of China's independently developed CPU chips are slightly different. For example, Shenwei chips use the independently developed SW64 instruction set; Loongson chips use an extended instruction set based on the MIPS64 instruction set. For CPUs such as Shenwei and Loongson that use non-mainstream instruction sets (heterogeneous instruction sets), many large applications need to make complex modifications to the code to fully adapt to the instruction set architecture specified by the compiler. Therefore, the applications and containers that can run on platforms based on Shenwei and Loongson CPUs are still very limited.

[0003] Before starting one or more applications in a container, the application and the runtime environment it uses will be packaged to form a compressed file package (also called a container image). Container images distinguish instruction set architectures. For example, the world's largest container image community dockerhub.com, the container images provided by global developers in the community are limited to mainstream instruction sets such as x86, x86-64, aarch, aarch64, and PPC64. Therefore, for Shenwei and Loongson chips, the current massive container resources in the container image community are very scarce and can be used directly. Therefore, a large number of applications in the community need to be re-adapted and repackaged for the corresponding container platform. In order to enable massive open source container image resources to run on CPUs such as Shenwei and Loongson that use non-mainstream instruction sets, the existing technology has provided a technical foundation for Shenwei / Loongson platforms to run heterogeneous containers. By using software virtualization technology, instructions such as x86-64 are translated into instructions that can be correctly executed by Shenwei and Loongson CPUs.

[0004] Figure 1 The figure shows the operating architecture of heterogeneous containers on the traditional Sunway / Loongson platform using software virtualization technology. Figure 1 As shown in the figure, in the operation scheme corresponding to the operation architecture, QEMU is used on the physical machine using Shenwei / Loongson CPU to start the virtual machine of the x86-64 instruction set, and then the operating system of the same instruction set (x86-64 instruction set) is installed in the virtual machine; and the container environment is deployed on the operating system, and finally a large number of x86-64 instruction set container images in the dockerhub.com community are run in the virtual machine. After the operating system provides the basic resource components, the container technology can be used to start one or more applications in the container. However, for Figure 1 The architecture shown has poor application performance, and the complete operating system running in the virtual machine requires management of these containers outside the virtual machine, which makes the container management process more complicated, ultimately resulting in low operating efficiency of the method, cumbersome container management process, and serious resource consumption.

[0005] How to make the massive container resources in the image community run efficiently in the originally unsupported Shenwei and Loongson CPUs is an urgent problem to be solved. Summary of the invention

[0006] In view of this, an embodiment of the present invention provides a method and apparatus for operating a heterogeneous instruction set container to eliminate or improve one or more defects in the prior art.

[0007] The technical solution of the present invention is as follows:

[0008] A method for operating a heterogeneous instruction set container in a container cloud platform, the method comprising the following steps:

[0009] Selecting a node for deploying the workload based on workload deployment information from a user terminal and a cluster load state, wherein the workload deployment information includes: a name and / or address of a container image used by the workload;

[0010] Obtaining a container image from an image repository based on the chip type of the selected node and the name / or address of the container image used by the workload, and in the case where there is no image version applicable to the predetermined heterogeneous instruction set in the image repository, starting a tailored QEMU on the selected node to build a virtual machine based on a predetermined standard instruction set, wherein the tailored QEMU retains modules related to an instruction translation mechanism and modules related to a basic core hardware resource simulation mechanism, and some or all modules other than the retained modules related to the instruction translation mechanism and modules related to the basic core hardware resource simulation mechanism are trimmed;

[0011] Loading a compiled virtual machine kernel encapsulating a container runtime into the constructed virtual machine, wherein the virtual machine kernel includes: a basic hardware resource management program, a permission management component, a process management component, a basic communication component, and a container runtime related module component;

[0012] After the kernel is initialized, the container runtime is loaded and the user-specified container image is run to start one or more applications in the heterogeneous instruction set container.

[0013] Optionally, before selecting a node for deploying the workload, the method further includes: compiling QEMU using the source code of the container cloud platform, and tailoring the functional modules of QEMU.

[0014] Optionally, the workload deployment information includes the name of the workload, the name and / or address of the container image used by the workload, and the namespace into which the workload is to be included; the predetermined standard instruction set is the x86-64 instruction set; the heterogeneous instruction set is the instruction set adopted by Shenwei or Loongson chips that are heterogeneous to the x86-64 instruction set.

[0015] Optionally, before loading the virtual machine kernel, the method further includes the following steps: modifying the kernel configuration file before the virtual machine kernel is compiled; adding container runtime related modules; and encapsulating the container runtime module in the virtual machine kernel.

[0016] Optionally, the step of encapsulating the container runtime module in the virtual machine kernel includes: encapsulating the container runtime suite into the first process of the kernel; the step of loading the container runtime after the kernel is initialized includes: after the kernel is initialized, running the first process to load the container runtime; the method also includes: transferring the user-specified container image to the virtual machine and running the application in the container image.

[0017] Optionally, before starting the tailored QEMU on the selected node, the method further includes: obtaining the container image version running on the corresponding node from the image repository based on the CPU type of the selected node and the image in the workload deployment information; and when it is determined that the container image version has a predetermined heterogeneous instruction set version, pushing the obtained container image to the selected node.

[0018] Optionally, the runtime-related module components include: a 9P file system module, a network block storage device module, a fair group scheduling module, a cgroup scheduling module for a remote direct data access (RDMA) controller, an advanced configuration and power interface module for PCI devices, a compact PCI bus module, an ipset framework module, a virtual network module, a virtual network card module, a cgroup scheduling module based on network traffic classification, a network layered service scheduling module, a module that provides element addition and deletion functions for the ipset module, a network filter (netfilter) tracking module, a universal host controller for PCI devices, and a de facto group policy scheduler.

[0019] Optionally, the modules pruned by the pruned QEMU include some or all of the following modules: avx2 module, bluez module, brlapi module, bzip2 module, cocoa module, curses module, dmg module, gtk module, libiscsi module, libusb module, linux-aio module, qom-cast-debug module, sdl module, seccomp module, smartcard module, spice module, tpm module, usb-redir module, vnc module, vnc-jpeg module, vnc-png module, vnc-sasl module, vte module, whpx module, xen module and xen-pci-passthrough module.

[0020] On the other hand, the present invention also provides a device for running a heterogeneous instruction set container in a container cloud platform, the device comprising a processor and a memory, the memory storing computer instructions, the processor being used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the device implements the steps of the method described above.

[0021] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned method when executed by a processor.

[0022] The method and device for operating heterogeneous instruction set containers in the container cloud platform of the present invention enable massive container resources in the image community to run efficiently in Shenwei and Loongson CPUs, greatly reduce resource consumption, and effectively alleviate the shortcoming of scarce container image resources.

[0023] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically pointed out in the written description, claims, and drawings.

[0024] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.

[0026] Figure 1 Schematic diagram of the operation method of heterogeneous containers on traditional Shenwei / Loongson platforms.

[0027] Figure 2 for Figure 1 Schematic diagram of the heterogeneous container operation architecture corresponding to the operation method shown.

[0028] Figure 3 It is a schematic diagram of the operation method of the heterogeneous container of the Shenwei / Loongson platform in one embodiment of the present invention.

[0029] Figure 4 Schematic diagram of the operating architecture of the heterogeneous container of the Shenwei / Loongson platform in one embodiment of the present invention.

[0030] Figure 5 The present invention is a flowchart of a method for operating a heterogeneous instruction set container in a container cloud platform according to an embodiment of the present invention.

[0031] Figure 6 The figure is a flow chart of a method for operating a heterogeneous instruction set container in another embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0033] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.

[0034] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0035] The inventors found in the process of implementing the present invention that the poor operation performance and complicated container management process of the heterogeneous container operation scheme on the traditional Shenwei / Loongson platform are caused by the following reasons: on the one hand, Figure 1 and Figure 2 The software virtualization in the solution requires running a complete operating system in the virtual hardware, resulting in a large consumption of physical machine performance; on the other hand, the complete operating system will introduce management processes that are irrelevant to the operation of the container, resulting in additional consumption of computing, storage, and network resources. In addition, since a complete operating system is installed in the virtual machine, the virtual machine's operating system will take over all virtual hardware resources. Therefore, the container cloud platform needs to additionally monitor the computing, storage, and network resource overhead within the virtual machine in order to achieve effective management and scheduling. All of these have resulted in the operating efficiency and container management of heterogeneous instruction set containers in existing container cloud platforms not being guaranteed.

[0036] The virtualization technology used by virtual machines is a technology that relies on software to simulate hardware functions and create a virtual computer system. Virtualization technology can be divided into software virtualization technology and hardware virtualization technology.

[0037] Software virtualization technology implements the function of a hardware through software coding. All its computing operations are performed by the CPU of the physical machine, so the execution efficiency is relatively low. The representative open source tool of software virtualization technology is QEMU, which allows the system and application to run on virtual hardware (isomorphic or non-isomorphic instruction sets) by translating CPU instructions. In the software virtualization solution, all CPU instructions of the virtual machine must be sent to the real CPU hardware through the virtual machine manager (VMM), which generates additional overhead in instruction transmission; on the other hand, in addition to instructions, the CPU execution also needs to maintain its own state, so the VMM needs to maintain the running state of the real CPU and the running state of the virtual CPU. Each time the instructions generated in the virtual machine are run, the VMM needs to synchronize the running state of the real CPU and the virtual CPU to ensure the correct execution of the instructions. Therefore, the VMM has many management processes, and the CPU instructions generated in the virtual machine are cumbersome and inefficient.

[0038] Hardware virtualization technology mainly achieves high-performance virtualization by combining the underlying implementation of the operating system with the CPU hardware function. Its typical technical representatives include KVM, XEN, and Intel VT. Hardware virtualization technology directly encapsulates the VMM's CPU state maintenance function into the CPU hardware, allowing the CPU to store different operating states and switch quickly. In this way, the CPU instructions in the virtual machine no longer need to be passed through the VMM, but can be directly executed in the real CPU, so the execution efficiency is higher. However, hardware virtualization technology cannot run applications with non-isomorphic instruction sets in a virtual environment.

[0039] Based on the limitations of hardware virtualization technology, in an embodiment of the present invention, software virtualization technology is used to enable the massive X86_64 container image resources of the container open source community to run efficiently on non-mainstream instruction set CPUs such as Shenwei and Loongson; but the purpose of the present invention is to reduce the additional performance overhead caused by virtual machines to physical machines while using software virtualization technology, and improve the operating efficiency of non-isomorphic instruction set applications; in addition, the present invention also transparently transmits the container running status and resource usage overhead in the virtual machine to the container cloud platform, so that the platform can directly monitor and manage the containers inside the virtual machine.

[0040] In order to achieve the above objectives, the embodiments of the present invention improve the existing method of running heterogeneous instruction set containers based on QEMU, and provide a new operation scheme for heterogeneous instruction set containers in a container cloud platform. Figure 3 Shown is a schematic diagram of the operation method of the heterogeneous container of the Shenwei / Loongson platform in one embodiment of the present invention. Figure 4 Schematic diagram of the operation architecture of the heterogeneous container of the Shenwei / Loongson platform in one embodiment of the present invention. Figure 3 and Figure 4As shown, in the solution of the present invention, QEMU is tailored and the tailored QEMU is used to build a virtual machine. In addition, a customized kernel is used in the virtual machine to replace the complete operating system in the prior art, and the container runtime is encapsulated in the kernel. Finally, when the container runtime is loaded in the kernel, the container image specified by the customer is run to start one or more applications in the heterogeneous instruction set container. Compared with the traditional method, the solution of the present invention has a faster startup speed, less additional resource consumption, and higher operating efficiency, which can effectively alleviate the shortcoming of scarce container image resources.

[0041] Currently, for container cloud platform customers based on Sunway and Loongson CPUs, only a very small number of well-adapted container images are available. By using the heterogeneous container operation method on Sunway and Loongson platforms proposed in the present invention, a large number of open source container image resources can be quickly deployed while ensuring basic operation performance. At the same time, in terms of operation, the method can be transparent to users.

[0042] like Figure 5 As shown, the method for running a heterogeneous instruction set container in a container cloud platform according to an embodiment of the present invention includes steps S110-S150. The method can be implemented on a container cloud platform.

[0043] In step S110 , a node for deploying the workload is selected based on the workload deployment information from the user terminal and the cluster load status.

[0044] Users of the container cloud platform can log in to the container cloud platform, enter the cluster management page with deployment permissions, and enter the workload deployment page by entering a service deployment request (such as clicking the "Service Deployment" button on the cluster management page).

[0045] The user fills in the workload deployment information in the deployment interface. The workload deployment information may include at least: a) the name of the workload; b) the name and / or address of the container image used by the workload; c) the namespace to be included in the workload. In addition, other more information may be included. Among them, the name or address of the container image is used to locate the container image so that the system knows where to download the image file. Namespace is a means of container permission management. Containers in the same namespace will be more convenient in data exchange, network communication, etc.

[0046] After the workload deployment information filled in by the user is completed, it can be transmitted to the container cloud platform. The container cloud platform then selects the node (physical machine) used to deploy the workload based on the cluster load status, and then obtains the CPU type of the node.

[0047] In step S120 , the container cloud platform obtains the container image from the image repository based on the chip type of the selected node and the name and / or address of the container image used by the workload.

[0048] An image repository is a location where container images of different applications are centrally managed. It uniformly stores, manages, and distributes container images in the form of network services. The managed content includes but is not limited to different applications, different versions of the same application (development version, instruction set architecture version), etc.

[0049] The container cloud platform can search the image repository for container images (including the version of the container image) that can run on the corresponding node based on the node CPU type and the name or address of the container image. The container image exists in the form of a file, but it contains the complete content of the application and the runtime it needs.

[0050] In step S130, when the container cloud platform determines that there is no image version applicable to the predetermined heterogeneous instruction set in the image repository, the tailored QEMU is started on the selected node to build a virtual machine based on the predetermined standard instruction set.

[0051] Here, the predetermined heterogeneous instruction set may be an instruction set of a Shenwei or Loongson chip that is heterogeneous with the x86-64 instruction set; the predetermined standard instruction set may be, for example, the x86-64 instruction set. When the container cloud platform determines that the instruction set of Shenwei or Loongson does not exist in the image repository, the tailored software virtualization tool QEMU is started on the selected node to build a virtual machine based on the x86-64 instruction set.

[0052] QEMU is a complete set of pure virtual hardware platform tools, and is also an open source simulator and virtual machine manager. QEMU mainly provides two functions: 1) As a user-mode simulator, it uses a dynamic code translation mechanism to execute code different from the host architecture; 2) As a virtual machine supervisor, it simulates the entire system and creates a virtual machine close to the host performance. The functional structure of the existing software virtualization tool QEMU is relatively complex. In the embodiment of the present invention, only the instruction translation mechanism of QEMU and the most basic core hardware resource simulation are required. Therefore, in order to improve its runtime performance in this method, in addition to a small amount of code modification when compiling QEMU to adapt to Shenwei and Loongson CPUs, customized tailoring is also performed. The so-called "tailoring" refers to the function simplification and / or individual function optimization based on the original solution, retaining the hardware simulation functions of CPU, memory, storage and network, disabling the simulation components and functional modules that are not required in the container cloud platform scenario, thereby improving the operating efficiency of QEMU itself. The list of these tailored modules is shown in Table 1.

[0053] Table 1. List of modules that are pruned from QEMU

[0054]

[0055]

[0056] The pruned modules listed in Table 1 are only examples. Based on the module composition of QEMU, there may be fewer modules. Of course, there may be more modules. The pruned QEMU is intended to retain the instruction translation mechanism related modules and the basic core hardware resource simulation mechanism related modules and pruned some or all modules other than the retained instruction translation mechanism related modules and the basic core hardware resource simulation mechanism related modules.

[0057] The QEMU used in the present invention needs to be compiled using the source code of Shenwei or Loongson. During the compilation, the purpose of functional tailoring of QEMU can be achieved by modifying the parameters of the compilation command. For example, the parameters of the compilation command of the module can be modified to "disable" to indicate the disabling of the module or "enable" to indicate the enabling of the module.

[0058] Alternatively, in step S130, if the container image has the Shenwei / Loongson instruction set version, the image can be pushed to the node selected by the container cloud platform, and the container runs in a conventional manner until the operation is terminated or the user actively closes and stops the workload.

[0059] Alternatively, if there is no Shenwei / Loongson instruction set version or X86_64 instruction set version in the image repository, it means that the container image does not exist. The container cloud platform then feedbacks the user that the workload deployment has failed through the interactive page and returns to the workload deployment page.

[0060] In step S140, the compiled virtual machine kernel encapsulating the container runtime is loaded into the constructed virtual machine.

[0061] The virtual machine kernel may include: a basic hardware resource management program, a rights management component, a process management component, a basic communication component and a runtime related module component.

[0062] Figure 1 The traditional container operation method shown is to create a complete virtual machine, run a complete operating system, and then run the container specified by the customer in the operating system of the virtual machine. In the embodiment of the present invention, in order to improve the operating efficiency on the Shenwei and Loongson platforms, not only QEMU is tailored, but also a customized kernel is used in the virtual machine to replace the complete operating system. The customized kernel here refers to the kernel running in the virtual machine, and there is no special requirement for the kernel of the physical machine.

[0063] like Figure 2 and Figure 4 As shown in the figure, the components of the virtual machine kernel are not many. From a macro perspective, the kernel mainly includes basic hardware resource management programs, permission management components, process management components, basic communication components, and core hardware drivers (such as memory / hard disk / network card / display / keyboard and mouse, etc.). Therefore, the disk space occupied by the kernel is often around 20MB (megabytes). Compared with the GB (gigabyte) level capacity of the operating system, the kernel only uses 1% of the storage space of the operating system and lacks the realization of most of the underlying functions.

[0064] In the process of implementing the present invention, the inventors found that the kernels used by Shenwei and Loongson chips lacked some module components that the container runtime relied on. Therefore, in order to enable the virtual machine kernel to support the container operating conditions and have basic dynamic capacity expansion capabilities and the ability to pass the container state in the virtual machine through the virtual machine, the present invention has achieved two major improvements: 1) encapsulating the container runtime in the kernel; 2) completing all kernel module components required for the container runtime.

[0065] The container runtime is a program (running environment) that can create and run containers based on images obtained online. The operations of encapsulating the container runtime in the kernel may include:

[0066] The container runtime suite (such as libcontainer) is encapsulated into the first process of the kernel (also called process No. 1, the first process commonly used in Linux systems is called systemd). Process No. 1 is the first process started after the kernel is loaded, and its main function is to manage and schedule other processes. In the prior art, if a complete operating system is started, the first step is also to load the kernel into the memory, run process No. 1, and then start other additional programs of the operating system. Therefore, after the present invention embeds the container runtime in process No. 1, process No. 1 can include a complete container operating environment. Combined with its existing process management function, it can rely on process No. 1 to run the container image and start the application packaged in the image. Process No. 1 then manages and schedules the application.

[0067] In addition, the module components that need to be supplemented when completing the container runtime include: 9P file system module, network block storage device module, fair group scheduling module, remote direct data access (RDMA) controller control group (cgroup) scheduling module, PCI device advanced configuration and power interface module, compact PCI bus module, ipset framework module, virtual network module, virtual network card module, cgroup scheduling module based on network traffic classification, network layered service scheduling module, module that provides element addition and deletion functions for ipset module, network filter netfilter tracking module, PCI device universal host controller and fact group policy scheduler, etc. Table 2 shows these module components and function descriptions to be supplemented, and the present invention supplements these modules to the virtual machine kernel.

[0068] Table 2. Complete list of kernel modules running in the virtual machine

[0069]

[0070]

[0071] To complete the modules listed in the table above, you can modify the configuration file to add the modules before compiling the kernel. It should be noted that this kernel runs on Shenwei and Loongson CPUs, and its kernel source code must use a version that supports Shenwei or Loongson. The following Table 3 is an example of the configuration file.

[0072] Table 3. Example of a virtual machine kernel configuration file

[0073]

[0074]

[0075] In the above kernel configuration, y means that the compilation result is embedded in the kernel boot file, and m means that the compilation result is put into the packaged compressed file of the kernel module as a module file.

[0076] After the container runtime component is embedded in the kernel, since the virtual machine kernel can provide hardware resources and container runtime (operating environment), the kernel alone can provide a complete container operating environment. On the other hand, by adding a network communication module to the kernel, the container operating status in the virtual machine can be transferred from the virtual machine alone, and the instructions of the container cloud platform can be transferred to the virtual machine, ensuring that the container in the virtual machine can be correctly executed, managed and scheduled.

[0077] By replacing the operating system running inside the virtual machine with the system kernel, the basic time for initializing the environment in the virtual machine can be greatly reduced. If the complete operating system is started, it takes 5 minutes or even longer for the virtual machine to be ready. However, if only the kernel is started, the task can be completed in less than a minute. Therefore, the present invention has achieved the ability to run X86_64 containers in virtual machines without relying on a large operating system by embedding the container runtime in the kernel.

[0078] In step S150, the container runtime is loaded after the virtual machine kernel is initialized, and the container image specified by the user is run, thereby starting one or more applications in the heterogeneous instruction set container.

[0079] That is, the present invention embeds the container runtime in the virtual machine kernel, and after loading the container runtime, the user-specified container image can be run in the virtual machine kernel, thereby running the X86_64 container in the virtual machine without relying on a large operating system. The specific process of running the X86_64 container can be the same as the existing technology, and will not be repeated here.

[0080] Through the present invention, a large number of X86_64 architecture container images can be quickly deployed to the Shenwei and Loongson platforms while ensuring basic operating performance.

[0081] The present invention adopts software virtualization technology, and the selection of the kernel in the virtual machine will not be limited by the CPU instruction set architecture. By modifying the virtualization tool (QEMU), the virtual machine kernel, etc., the cost of running heterogeneous containers on the Shenwei and Loongson platforms is greatly reduced. At the same time, the method of the present invention does not need to make any changes to the operating system, kernel, and hardware of the physical machine; for the existing container image, no changes are required.

[0082] FIG6 is a flow chart of a method for operating a heterogeneous instruction set container in a container cloud platform according to another embodiment of the present invention. Figure 6 As shown, the operation method includes the following steps:

[0083] Step S61: A user of the container cloud platform logs in to the container cloud platform.

[0084] Step S62, the user of the container cloud platform enters the cluster management page with deployment permissions, clicks the "Service Deployment" button, and enters the workload deployment page.

[0085] In step S63, the user of the container cloud platform fills in the workload deployment information and uploads it to the container cloud platform. The information includes at least required items, such as: a) the name of the workload; b) the name and / or address of the container image used by the workload; c) the namespace into which the workload is to be included.

[0086] In step S64, the container cloud platform receives the workspace load deployment information filled in by the user and starts to deploy the workload. It selects the node to be used to deploy the workload based on the cluster load status, and then obtains the CPU type of the node (such as Shenwei or Loongson type), and further searches the image repository for the container image that can be run on the corresponding node based on the CPU type of the node and the name or address of the container image.

[0087] Step S65: The container cloud platform confirms whether the name or address of the container image is correct based on the search result. If not, step S72 is executed to prompt the user that the image does not exist, and step S73 is further executed to return to the "Service Deployment" page. If the name or address of the container image is correct, step S66 is executed.

[0088] Step S66: The container cloud platform confirms whether there is a version of the container image in the image repository for Shenwei or Loongson. If so, execute steps S67 and S71 to download the container image and run it normally. The image is pushed to the node selected by the container cloud platform. The container runs in a conventional manner until the operation is terminated or the user actively shuts down or stops the workload. If it is confirmed that there is no version of the container image for Shenwei or Loongson, but there is an image of the X86_64 instruction set version, execute step S68 and further execute the aforementioned Figure 5 The method described is:

[0089] In step S68, download the image of the X86_64 instruction set version;

[0090] Step S69, start the virtual machine of the X86_64 instruction set. More specifically, it includes: 1) starting QEMU on the selected node to build a virtual machine based on the X86_64 instruction set; 2) loading the X86_64 kernel that has been packaged with the container runtime in the virtual machine; 3) after the kernel is initialized, run process No. 1 (such as systemd or init), start the virtual machine, and load the container runtime.

[0091] Step S70, the container cloud platform runs the X86_64 instruction set version of the image, for example, transfers the user-specified container image into the virtual machine using the 9P file system and runs the application service or service program in the container image until the operation is terminated or the user actively closes or stops the workload (step S71).

[0092] For the customers of the container cloud platform, the only operations that the customers directly participate in in this process are the deployment of work services and filling in relevant information. The method executed by the container cloud platform will not be perceived by the users. Therefore, the method of the present invention is transparent to the users.

[0093] In addition, the method of the present invention can reduce the complexity of virtual machine manager management by tailoring QEMU while using software virtualization technology, reduce the additional performance overhead caused by virtual machines to physical machines, and improve the operating efficiency of non-isomorphic instruction set applications. Compared with traditional methods, the solution of the present invention has faster startup speed, less additional resource consumption, and higher operating efficiency, which can effectively alleviate the shortcoming of scarce container image resources.

[0094] The above is described with reference to the heterogeneous instruction set of Shenwei or Loongson chips as an example, but the present invention is not limited to this and can also be applied to container operation based on heterogeneous instruction sets of other types of chips.

[0095] Corresponding to the above method, the present invention also provides a device for running a heterogeneous instruction set container in a container cloud platform, the device comprising a processor and a memory, the memory storing computer instructions, the processor being used to execute the computer instructions stored in the memory, and the device implementing the steps of the above method when the computer instructions are executed by the processor. The device may be, for example, a container cloud platform.

[0096] The present invention also relates to a storage medium on which computer program code can be stored, and when the program code is executed, various embodiments of the method of the present invention can be implemented. The storage medium can be a tangible storage medium, such as an optical disk, a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM or any other form of tangible storage medium known in the technical field.

[0097] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0098] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium or transmitted on a transmission medium or a communication link via a data signal carried in a carrier. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, and the like. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0099] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.

[0100] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for operating a heterogeneous instruction set container in a container cloud platform, characterized in that: The method comprises the following steps: Selecting a node for deploying the workload based on workload deployment information from a user terminal and a cluster load state, wherein the workload deployment information includes: a name and / or address of a container image used by the workload; Obtaining a container image from an image repository based on the chip type of the selected node and the name and / or address of the container image used by the workload, and in the case where there is no image version applicable to the predetermined heterogeneous instruction set in the image repository, starting a tailored QEMU on the selected node to build a virtual machine based on a predetermined standard instruction set, wherein the tailored QEMU is trimmed of some or all modules except for modules related to the instruction translation mechanism and modules related to the basic core hardware resource simulation mechanism; Loading a compiled virtual machine kernel encapsulating a container runtime into the constructed virtual machine, wherein the virtual machine kernel includes: a basic hardware resource management program, a permission management component, a process management component, a basic communication component, and a container runtime related module component; After the kernel is initialized, the container runtime is loaded and the container image specified by the user is run to start one or more applications in the heterogeneous instruction set container.

2. The method according to claim 1, characterized in that Before selecting a node for deploying the workload, the method further includes: Compile QEMU using the source code of the container cloud platform, and tailor the functional modules of QEMU.

3. The method according to claim 1, characterized in that The workload deployment information also includes the name of the workload and the namespace into which the workload is to be included; The predetermined standard instruction set is the x86-64 instruction set; The predetermined heterogeneous instruction set is the instruction set of the Shenwei or Loongson chip that is heterogeneous with the x86-64 instruction set.

4. The method according to claim 1, characterized in that Before loading the virtual machine kernel, the method further includes the following steps: Before the virtual machine kernel is compiled, modify the kernel configuration file; Add container runtime related modules; Encapsulate the container runtime module in the virtual machine kernel.

5. The method according to claim 4, characterized in that The step of encapsulating the container runtime module in the virtual machine kernel includes: encapsulating the container runtime suite into the first process of the kernel; The step of loading the container runtime after the kernel is initialized includes: after the kernel is initialized, running the first process to load the container runtime; The method also includes: transmitting the container image specified by the user to the virtual machine and running the application program in the container image.

6. The method according to claim 1, characterized in that Before starting the tailored QEMU on the selected node, the method further includes: Obtain the container image version running on the corresponding node from the image repository based on the CPU type of the selected node and the image in the workload deployment information; When it is determined that the container image version in the image repository has a predetermined heterogeneous instruction set version, the container image is downloaded and the obtained container image is pushed to the selected node.

7. The method according to claim 6, characterized in that The runtime-related module components include: a 9P file system module, a network block storage device module, a fair group scheduling module, a control group cgroup scheduling module of a remote direct data access (RDMA) controller, an advanced configuration and power interface module of a PCI device, a compact PCI bus module, an ipset framework module, a virtual network module, a virtual network card module, a cgroup scheduling module based on network traffic classification, a network layered service scheduling module, a module that provides element addition and deletion functions for the ipset module, a network filter tracking module, a universal host controller of a PCI device, and a fact group policy scheduler.

8. The method according to claim 1, characterized in that The trimmed modules of the trimmed QEMU include some or all of the following modules: avx2 module, bluez module, brlapi module, bzip2 module, cocoa module, curses module, dmg module, gtk module, libiscsi module, libusb module, linux-aio module, qom-cast-debug module, sdl module, seccomp module, smartcard module, spice module, tpm module, usb-redir module, vnc module, vnc-jpeg module, vnc-png module, vnc-sasl module, vte module, whpx module, xen module and xen-pci-passthrough module.

9. A device for running a heterogeneous instruction set container in a container cloud platform, the device comprising a processor and a memory, characterized in that: The memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the method as described in any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.