当前位置:网站首页>Cloud native technology container knowledge points

Cloud native technology container knowledge points

2022-07-06 22:43:00 Beipiao's vegetable Xiaobai

Part of this article is excerpted from CNCF The official account : Link address

About resources

Any resource of the server is valuable , especially CPU, But in actual production activities , Utilization of resources , But not very high , Can occupy the server 50% It's already very good

How to save resources

The rational allocation of resources is to make full use of servers , The most effective way to reduce costs , The simplest and most effective way , Is to use containers

Why containers compare VM Can improve resource utilization ?

  1. The resource isolation occupation of virtualization itself 10%, The container itself does not occupy more than 1%. This is because Docker Using the host kernel , Without the need for Guest OS. therefore , When you create a new container ,Docker There is no need to reload an operating system like a virtual machine , This avoids guidance 、 Loading the operating system kernel is a time-consuming and resource-consuming process .

  2. When you create a new virtual machine , Virtual machine software needs to be loaded Guest OS, This new process is minute level , and Docker Because of the direct use of the host's operating system, this process is omitted , Containers only need the necessary running environment to start , Including file system 、 The system class library 、shell Environmental Science . Therefore, the boot is lighter than the virtual machine .

  3. The positioning and capabilities of containers and virtualization are different , It also enables applications to run in containers and make full use of resources . It mainly includes the following points :

  • When containers use resources , Can be based on Limit/Request Mechanism , Give containers elastic resource allocation .
  • The container is extremely simple / Automatic capacity expansion and contraction , The application can be deployed , It is not necessary to allocate resources according to the maximum resource needs at the beginning , You can only add instances quickly when you need them .
  • When the container encounters failure or resource preemption conflict , It can automatically migrate to other nodes with resources .
    Based on the above three points , So that resources can be used more fully and effectively

 Insert picture description here

Why containers are lighter , What is the mechanism of the container ?

The container is similar to VM, But they have a relaxed isolation property , The operating system can be shared between applications (OS). therefore , Containers are considered lightweight . Container and VM similar , Has its own file system 、CPU、 Memory 、 Process space, etc . Because they are separated from the infrastructure , So you can cross clouds and OS Release version for migration .

Docker yes LXC(Linux Container) and AUFS(AnotherUnionFS) A combination :LXC Is responsible for resource management ,AUFS Is responsible for image management ; Include Cgroup,
Namespace,Chroot And so on , And pass Cgroup Resource management , The three are actually one ring after another .Cgroup Is to implement resource management at the bottom ,LXC stay Cgroup There's a layer of packaging on it , And then Docker And in the LXC It encapsulates a layer of .
 Insert picture description here

原网站

版权声明
本文为[Beipiao's vegetable Xiaobai]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061448052456.html