Microservices: Why choose Containers over Virtual Machines.

In the previous article, we've setup a cluster of SSH-enabled Raspberry PIs that will serve as nodes for a Kubernetes cluster. Before demonstrating the steps required to install Docker and Kubernetes on our Raspberry PI Cluster, we will tackle the added value that containers provide over virtual machines.

Computing is the process of running "intangible functions" on a set of "tangible" resources (CPUs, RAM, Disk and Network) to accomplish a task at hand, from a simple "Hello World" application to a complex distributed system. Over time, the hardware producers had continuously unveiled more powerful versions of their products, often the applications running on top of them does not even utilize a fraction of the resources provided by their hosting physical machines. Thus, giving birth to virtualization of resources that enable applications to run concurrently.

Prior to the cloud revolution, virtual machines had been the dominant form of virtualization technique used for isolating application environments hosted by large on-premise physical machines. The sudden boom of cloud industry (charges you for resources you provision and utilize) caused large companies to search for more efficient ways of running applications on infrastructure they rent. Thus, giving birth to Containerization.

What's is an Application Container?

An application container is an instance of a lightweight, independent executable software package that includes everything (Guest OS, Runtime, Libraries, Application) it requires to run and perform its job. Application containerization is a form of virtualization that abstracts on the OS layer which makes them more efficient than virtual machines (abstracts on the Kernel level through Hypervisor Implementations).

That's the same purpose why VM's exist right?

Yes, containers and VMs share the same purpose (To isolate applications into their own environment and make efficient use of underlying physical layer), but containers provide the following advantages over VMs:

  • Containers are way more smaller.

    Virtual machines abstract at hardware level which requires a hypervisor that would manage its kernels (Core of the operating system) as well as the kernels of other virtual machines that run on the host system. Containers on the other hand run on top of a single Kernel which makes it more efficient and lightweight (The weight of Linux Busybox is 2MB!).

  • Containers are Immortals!

    Don't get it wrong, containers do fail for unexpected reasons! Containers outclass VMs when it comes to OS corruptions because they can be re-instantiated from immutable images that originate from a Docker Repository which makes them resilient against corruption. VMs on the other hand succumb from OS level corruptions and would be impossible to recover if there are no backups that exists.

  • Containers boot faster

    Containers run on top of the host OS kernel which make them boot faster than virtual machines. This is even faster on a host OS (running at the time of container service provision) provided by cloud platforms like Windows Azure.

  • Containers scale better in the cloud

    On cloud platforms like Windows Azure, provisioning additional containers is faster than spinning up virtual machines using Virtual Machine Scale Sets.

Conclusion

Isolating applications using Virtual Machines is a perfectly acceptable way of efficiently using physical machines, but containers provide added value over Virtual Machines especially on cloud platforms like Windows Azure.

Related Articles


Why don't you become a Microservice Ninja?


Comments

Post a Comment

Popular posts from this blog

Building Simple API Gateways with Ocelot and ASP.net Core

API Gateway in a Nutshell

Replicating Netflix Part 1: Installing Raspbian Lite using Etcher

10 Steps to Setup and Containerize an Express Server