Home>Article>Operation and Maintenance> What is the difference between jvm and docker
Difference: 1. Docker runs with almost no additional performance loss, while jvm will have additional CPU and memory losses; 2. Docker is portable, flexible, and can be used with Linux, while jvm is bulky and virtual. The degree of machine coupling is high; 3. The image stored by docker is small, while the image stored by jvm is huge.
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
Docker has fewer abstraction layers than a virtual machine. Docker does not require a hypervisor to virtualize hardware resources. Programs running in docker containers directly use the hardware resources of the actual physical machine. Therefore, docker will have obvious advantages in efficiency in terms of CPU and memory utilization.
Docker uses the host's kernel and does not require Guest OS. Therefore, when creating a container, there is no need to reload an operating system kernel like a virtual machine. This avoids the time-consuming and resource-consuming process of booting, loading the operating system kernel and returning. When a new virtual machine is created, the virtual machine software needs to load the Guest OS, and the return to the new creation process takes minutes. It only takes a few seconds to create a new docker container.
Compared between Docker and JVM:
Docker runs with almost no additional performance loss, while the JVM operating system consumes additional CPU and memory
Docker is portable, flexible, and adaptable to Linux, while the JVM is bulky and highly coupled to the virtual machine
The image stored by Docker is small and easy to store and transfer. The JVM image is huge.
"Container" technology such as docker simulates an entire operating system. It exists statically and can support the execution of applications on the same platform, and the container itself is process-independent.
JVM is an execution platform for specific code. It exists when running. It can only support the execution of specific code and must be within the JVM process.
Containers are usually platform-related. , Containers such as Docker for the Linux kernel cannot be directly compatible with Windows; and virtual machines such as jvm are platform-independent and almost all platforms are consistent containers that execute native code, which is the so-called "machine code";
jvm executes specific standard pseudocode (i.e. jvm bytecode). The container is isolated from the host. Without host mapping, the program cannot directly access host resources;
jvm is not isolated from the host and can be mapped by itself. And using the host resource container is static, self-contained, has a file system, and an executable program. It does not necessarily have to start a process;
jvm only makes sense when it is started as a process, it is independent , does not have its own file system, and does not contain applications. It just interprets specific codes from files or other sources as required from the entry point
Generally speaking, virtual machines such as JVM and Docker have some technical origins Yes, they are all virtualized host environments
It’s just that JVM is a higher-level, application-oriented, and specific virtual execution environment. Docker is biased towards the operating system level and is a universal execution environment
Recommended learning: "docker video tutorial"
The above is the detailed content of What is the difference between jvm and docker. For more information, please follow other related articles on the PHP Chinese website!