What are typical use cases for LXC and VM?

I am trying to decide when an LXC container might be a better choice than using a full virtual machine.

Do you have any specific use cases that may lead to some arguments anyway?

Are LXCs more PaaS-oriented to run applications without hardware control? Do we always need to use the virtual machine on "IaaS", where we want to control the infrastructure?

Hi,

+8
docker virtual-machine virtualization cloud lxc
source share
4 answers

I do not think IaaS needs virtual machines. Using LXC, you can define a limit on the number of cpushare and memory users.

The VM thing is pretty heavy, so for example, PHP / MySQL / Apache, you will have 1 VM. Since LXCs are lightweight, you can have 3 LXCs, so it scales much better (if you need to outline mysql, just duplicate mysql LXC)

+5
source share

LXC looks like a chroot prison on steroids. For argumentation, you can consider this a lightweight VM (although this is not a virtual machine at all).

If you’ve already tried to write an application designed to work in an ephemeral infrastructure, LXC simply allows you to do this at a lower cost.

For me, the coolest thing about LXC is the community growing around it. Consider something like docker - the docker image is relatively portable. It provides tools for configuring identical containers on physical hardware or in a virtual virtual machine running on your desktop or in a virtual machine provided by Amazon or Rackspace. This brings us closer to the dream of being able to record in one place.

+8
source share

LXC runs much faster than virtual machines and uses less host resources on each container than virtual machines, so they are ideal for combining packing a large number of isolated processes onto a single host and / or often starting them.

One use case is to run unit tests in reproducible environments (combined with a snapshot file system like Docker ). You can expand the entire container, run the test and close it as quickly as you can start the test. The advantage of LXC is that all non-nuclear dependencies of the test will be inside the container. This may be another Linux difference (for example, the host may be Ubuntu, and the container may run Centos, although they must share the host kernel).

+2
source share

For me, the advantage of lxc is that it helps you have a very small environment. Therefore, it is used fully if it has only one application. If you want multiple applications running in your environment, VM is better. Another case where a virtual machine is better is when you want to use a different kernel than the host kernel.

For me, lxc is a really lightweight VM system. With speed and size is better. But limiting may not be what you need.

+1
source share

All Articles