What’s Your Choice? VM, Container or Serverless

Shy
9 min readSep 23, 2019

--

Photo by Arnel Hasanovic on Unsplash

Last June 2019, our company answered our expenses in attending and touring one of the biggest developer conferences that happened this year 2019. The event claims to be the biggest Developer Conference in the Philippines, as they said on their website and in their Eventbrite event link. They invite foreign and local leaders that show excellence and take a big step forward in the IT industry and organize the conference annually. We had a great time at the event, and every one of my colleagues enjoyed being there.

One of my colleagues even writes his incredible insights about his Devcon Summit Experience.

It was a very changing moment for a developer like me because there were lots of professionals that share their insights on the latest technologies. The event consists of three tracks, each with separate topics. I have attended the first track, which is about “Automating Business Operations,” and I have learned many things about it. One of the topics that caught my attention is about servers. My aim in this blog is to describe and compare the pros and cons of each server type.

What are the kinds of servers?

A server is a type of device on a network that manages resources, and I would like to define some types of modern servers used in our age.

Virtual Machine (VM)

Virtual Machine Structure
Virtual Machine Structure

A virtual machine (VM) is an emulation of a computer system. There is no hardware involved, but the whole process of a computer system is being handled and executed to run certain applications. For this reason, it is a good tool to be a server because it only utilizes your personal computer to run another computer like a virtual machine.

Virtual machine servers provide fully equipped and functional virtual environments through virtualization technology. It allows us who are interested in setting and configuring servers such as some DevOps enthusiasts to install a lot of management tools to monitor and maintain our websites. Administrators could also easily configure these tools depending on how much resources are needed to run web applications completely.

Containers

Container Structure
Container Structure

A container is a standard unit of software that packages up code and all its dependencies, so the application runs quickly and reliably from one computing environment to another. — docker.com

So it is just basically a piece of processes that could run your web applications anywhere. It would have its IP addresses and CPU utilization.

Serverless

Serverless Structure
Serverless Structure

Serverless computing is a computing execution model that is being performed dynamically by the cloud provider to manage the allocation of machine resources. It is running our applications on some CPU and memory without having to worry about the configuration of hardware or software devices. Just deploy your code, and it will run! So easy right? It essentially means that all you need to do are the following:

  • make a good web application that performs a specific task
  • select the number of resources required to run your application
  • submit it to the server to execute

The service makes sure that your application gets the required amount of resources it needs to execute; therefore, the collective term Function as a Service (FaaS).

Comparison of the servers

Since we have defined each type of server, we are now going to compare them to each other. Here are some characteristics and notable features of servers discussed in DevCon Summit 2019.

Visual Representation of the Different Kinds of Servers and their Needs as a Server
Visual Representation of the Different Kinds of Servers and their Needs as a Server

Virtual Machine (VM)

Pros

  • VMs are independent
    Every virtual machine is operating relatively independent. Administrators don’t need to worry about their applications competing for ports and file names because it is taken care of. When I first installed a virtual machine, I just followed a series of steps that are very easy and understandable by a beginner like me. There are even more user-friendly VM that can set up everything in just a click.
Virtual Machine Configuration
A sample of a virtual machine I used. Its ports are automatically configured, and if I want to change anything, I could easily do it.
  • Established security tools
    I also agree that the main advantage of virtual machines would be its security. Linux, for example, has a high-security approach for its files and folders. Even though you know the credentials of a user, only some files or folders would be exposed to you.
    I often open this VM that blocks a user from accessing the machine when there are multiple failed attempts in logging in. I have also experienced accessing a VM successfully, but I could not open some of the folders because of the security levels configured in that specific path.
  • Optimization of resource usage
    Using virtual machines, we can also optimize our resource usage and maximize the storage to fit the needs of every project. Most servers have many capacities and have the capabilities to run all projects at once, and with that in mind, we can put more productive applications on a single system.

Cons

  • Takes up a lot of resources
    In my own experience, those virtual machines installed in my PC takes up most of my system resources. Each VM runs a virtual copy of all the hardware that the operating system needs to run, and this quickly adds up to a lot of RAM and CPU cycles. My advice? Don’t ever leave your virtual machine open when you are not using it.
  • More administrative work
    For administrators, using virtual machines could seem a lot of work. They need to maintain the system, wait for updates and always be on that updated version and secure everything on the virtual machine. But well if it’s your job maybe your used to it and wouldn’t be bothered anymore.
  • Duplicate files
    If we are working on multiple virtual machines, we would have a lot of duplicate files, especially if any of our VM’s have similar OS versions. It’s fine if you have a budget for extra resources like memory and disks. In my PC, I have many VM, and each of them is taking gigabytes out of my memory. Why didn’t I just put it in a single VM? I can’t because each of them has different needs like PHP versions, databases, and more.

Containers

Pros

  • When it works in your machine, It works everywhere
    With containers we could say that “When it works in your machine, It works everywhere” and that’s the beauty of it. We don’t have to think about the compatibility of our work with the server’s operating system or other specifications. Containers could be configured or can easily be changed provided you know how to configure your container.
  • Containers are like a simplified docker
    We all know what a docker is- It is a running instance of a docker image, and it simplifies the process of building, running, managing, and distributing applications. So basically a container is a simplified version of a simplified process of what an operating system can do. Amazing!
  • Lightweight
    Containers are very much lightweight — they are only megabytes in size and take just seconds to start, and because of that, you can put 2–3 times as many as applications on a single server with containers than you can with a VM. Additionally, you can create a portable, consistent operating environment for development, testing, and deployment.
  • Professional Growth
    Lastly, according to one of the speakers who is defending containers, containers help professionals with dual responsibility much easier (e.g., being a developer and DevOps Manager at the same time). He said that working on containers, he gets to manage both the server and his development team.

Cons

  • Security
    OS images are the basis of containers. It opens many problems lurking in the application images like outdated, insecure versions of software and libraries, buggy application, or even hidden malware. So there is a need to exert more efforts on adding security at container servers. If we look up online, we will see that hackers are mostly targeting systems that are hosted in containers and not secured properly.
  • DevOps is a must
    Containers inherently require knowledge of DevOps. Of course, without the knowledge of managing all automatic processes between software developments, you would not be able to use containers effectively.

Serverless

Pros

  • No hardware or software to manage
    There is no hardware or software needed to manage the server. The cloud provider itself is handling the management of the serverless computing up to the underlying hardware and OS, to even the web application’s platform layer.
  • Eliminates management of operations
    Like what I said, everything is on the cloud, and this eliminates the management of operations. Developers never have to deal with servers that lower expenses and frees up time so that developers may create and expand the application without being constrained by server capacity.
  • Cost lower than other servers
    Also, in serverless, we reduce costs. The value that you will pay is just for the duration of your function’s execution and the number of resources that your application consumed during its execution period. Duration is calculated from the time your application begins executing until it returns or terminated. It follows the pay as you receive the concept when the service is being used that just the time you are paying. Also, the computation for serverless computing is a little different from other traditional cloud pricing model.

Cons

  • Execution duration
    Serverless is designed to run for short durations of time. It is somewhat hard to achieve for big applications, but there are workarounds. Developers need extra effort to optimize each of their applications.
  • Stateless
    With serverless, the developer’s team should have the capability to set mindset because using it will bring a change with their development workflow. The team would also be moving from a stateful to stateless servers, and I think that would test the adaptability skills of a developer.
  • Complexity
    The smaller you make your applications, the more complex it’s going to become. I remember that one of the speakers defending the serverless said that he has a 10-line rule that all his functions should only be a maximum of 10 lines only. But I think it should be more than the lines of code. Imagine you break a function into ten different functions, instead of managing just one; you manage ten functions. What if you have thousands?

Conclusion

We have learned that there are servers that are ideal to be used based on each server’s capabilities. It may also depend on the project, whether it holds many functionalities or just a simple system. But more importantly, it depends on the clients’ needs and what they want. Also, when using VM and containers, we engage in using the DevOps process, and we have our focus on maintaining and management of operations. On the other hand, when we use serverless, we could have some resources ready for us. Then we’ll have more time listening to our customers and mainly focus on delivering what is valuable to them.

--

--