Virtual Machine vs Container vs Serverless

Jul 11, 2022

Are VMs and Containers dead?

Of course, Not!

Then why is serverless computing getting a lot of press?

After all, any one of them enables a server infrastructure to run applications.

So, there must be a reason that serverless architecture is getting a buzz.

Yes, it is because serverless architectures provide an easy and quick way to launch applications, which every developer loves. But it does come with its own cons.

To understand the pros and cons of serverless architectures, we must also understand the pros and cons of VMs and containers.

So this blog is about understanding the differences between Virtual Machines (VM), containers, and serverless platforms and their pros and cons.

Just a point, though:

We will use a public cloud service provider (for example, AWS, Azure, or Google Cloud) as an example here to compare how they offer VMs, containers, and serverless. It does not necessarily mean you will need a public cloud to spin up your VMs or containers.

But we want to do it for one reason- to understand the meaning of serverless.

In reality, serverless is a different category. It is mainly a product offered by these cloud providers. It only makes sense to bring these cloud providers into the picture to better understand the differences.

So let’s get started.

In our view, the best way to understand the concept is to break the difference into three sets according to how each one came after the other.

 

  1. Bare Metal vs. Virtual Machine (VM)
  2. Virtual Machine vs. Container
  3. Container vs. Serverless

Bare Metal vs. Virtual Machine

 

What is Bare Metal?

Bare metal means a physical machine/server. Before the arrival of VMs, IT admins would dedicate an entire server to a single application. It was impossible to partition a server for running multiple applications, so it wasted many server resources.

However, the arrival of virtual machines (VMs) changed the scene.

 

What is a Virtual Machine (VM)?

VM uses the hypervisor, which partitions the server resources like RAM and CPU into multiple chunks. Consequently, one physical server can turn into multiple servers, each having its dedicated resources, thus reducing the need and costs of running various physical servers (dedicated hardware).

 

An Example of VM

The example below depicts a cloud provider that provides VMs to different customers. Each customer has a choice of running its OS called Guest Operating system (OS).

In contrast, the cloud provider maintains the Host OS (for example, Linux). This concept is called Infrastructure-as-a-service (IaaS), with the cloud provider as the IaaS provider.

 

Virtual Machine vs. Containers

As you may have noticed above, VMs run two types of OSs, one by the cloud provider Host OS and the other by each customer called Guest OS. This kind of duplication of OSs is both a strength and a weakness.

While running an independent Guest OS gives the freedom to a customer to choose an OS suitable to his applications, this also consumes extra resources as the server runs multiple OSs.

An alternative way is to run containers.

 

What is a Container?

A container is a lightweight alternative to a VM that does not need any Guest OS to run ( Well-known containers are Docker and LXC) or hypervisor. The individual container needs much fewer resources compared to an individual VM. It makes use of the host operating system. Customers can run applications independently but share the same Linux kernel as the Host machine.

 

How do Containers work?

Containers provide virtualization on the entire operating system level, compared to VMs that provide hardware virtualization.

However, containers are similar to VMs as they have their own user space (private space) to process and execute commands.

Today, containers form the building block of cloud-native architecture as they can run microservices much more efficiently than VMs. Containerized applications are constructed using container images very quickly using container orchestrators.

In the context of cloud providers, the service is called Container-as-a-service, shortened to CaaS.

It is time to examine the Pros and Cons of VMs and Containers.

Virtual Machines (VMs) vs. container

 

Pros and Cons of containers vs VMs

Here is a list of advantages and drawbacks of VMs vs. Containers.

 

                          Pros                            Cons
Virtual Machines (VMs)●     Hard isolation between different VMs.

 

●     Independent OS can be run, which gives freedom of choice for the OS to the customer.

 

●     More resource intensive (Needs more RAM and CPU)

 

●     Not as portable as containers

Containers●      Highly portable as they can move quickly from one cloud environment to other.

 

●     Efficient resource usage

 

●     Highly scalable

●      Security concerns as containers share the same host kernel, so additional security measures should be in place.

 

●     The customer is dependent on only one type of OS provided by the provider.

 Table: Pros and Cons of VM vs Containers.

 

Containers vs. Serverless

Let’s admit it. The term serverless is a misnomer as any application needs a server to run on.

How?

We need to know one challenge with VMs and Containers to understand this. While they provide an efficient way to run multiple applications on one server, the end user still needs to maintain the server part.

The user needs to take care of how their applications get executed, which Containers/VMs they will use for their applications, and how to scale those containers or VMs.

Wouldn’t it be better if the end-user does not care about the server or becomes “serverless”?

 

What is Serverless?

Serverless describes how organizations essentially outsource their servers instead of owning and maintaining their own. Instead, they leverage external, cloud-based servers to run serverless functions supported by a company like Amazon AWS.

Serverless enable a new business model for cloud providers and end users. They maintain and scale the infrastructure, and the organization just runs its applications. This is also called the Function-as-a-service (FaaS), and almost all cloud providers provide services besides the IaaS and CaaS, as shown in the following diagram.

 

Pros and Cons of Serverless vs containers

You may have realized by now that developers love serverless functions. This is  because they can test and deploy their code much more quickly without worrying about the dependencies of the underlying infrastructure. Also, it is less costly for the end customer as cloud providers usually charge when the server is used and not when it is idle.

However, serverless does come with its own cons. For example, the biggest challenge is the lack of standards. Today, every provider offers its service in its specific APIs, meaning a serverless application developed for one cloud provider is not directly portable to another. This can effectively provide a vendor lock-in for a customer.

The following summarizes the advantages and drawbacks of containers vs. Serverless.

 

ProsCons
Containers●     Highly portable as they can move quickly from one cloud environment to the other.

 

●     Complete control over infrastructure resources.

 

●     Highly scalable.

●     Security concerns as containers share the same host kernel, so additional security measures should be in place

 

●     The customer is dependent on only one type of OS provided by the provider.

 

●     More OPEX compared to maintaining serverless apps.

 

Serverless●      No need to manage servers

 

●     Fast instantiation of apps

 

●     No cost if the functions are not running

●      Security concerns as apps from different customers run on the same server

 

●     Not yet standardized, so vendor lock-in

 

Table: Pros and Cons of Containers vs. Serverless.

 

Commercial Examples of VM, Container and Serverless

Now you may be asking what are the commercial examples of VM (IaaS), Containers (CaaS), and Serverless Functions (FaaS). Here is one good example from AWS, Azure, and Google Cloud.

Conclusion:

 

VMs vs. Containers vs. Serverless (Which one is better?)

The answer to this question is not straightforward.

It depends on how much responsibility an organization wants to take and how much vendor lock-in the organization is willing to go with. Virtual machines and containers provide more control over the server resources that serverless environments cannot provide. However, serverless provides a faster time to market new services because of the ease of provisioning.

Does serverless mean death for VMs or containers?

No!

Serverless still needs VMs or containers as the underlying infrastructure. For example, AWS uses containers to run its serverless infrastructure.

Therefore, serverless is just a different business offering rather than a pure technical offering.

And if we remove the cloud provider from the equation and consider the case of a telco that needs to establish and maintain its own telco cloud. In that case, we can see that all the latest applications for mobile core take advantage of the cloud-native architecture that requires containers. For example, the 5G new core is developed using containers. These containers can run natively or inside virtual machines.

So if you are in a telco space and want to build your own cloud, the containers and VMs are still your best friends. But we do not know how things will change in the future…..

 

About Lanner White box and uCPE

Lanner is a leading provider of white box and  uCPE systems for various telecom applications like SD-WAN, SDN, NFV, Edge cloud, Open RAN, and orchestration. It operates in the US through its subsidiary-Whitebox Solutions (whiteboxsolution.com).

Lanner solutions are open hardware platforms based on x86 processors and thus software agnostic. This means the platform can run any infrastructure like VMs, containers, or serverless.

https://digitalcloud.training/cloud-computing-basics-serverless/

https://www.serverless.com/blog/serverless-faas-vs-containers/

https://www.techrepublic.com/article/serverless-computing-pros-and-cons-5-benefits-and-3-drawbacks/

Latest blogs