One common question when deploying a cloud architecture is why using virtual servers (probably an IaaS) instead of using a bare metal server directly. The right choice depends on the concrete use case of the system and is determined by different factors, but the main one is the performance/cost ratio (using the available resources with efficiency). This post aims to give an opinion about why choosing one of the options, giving advantages and disadvantages for each one.
Why using bare metal directly?
If money is no object and performance is the only thing that matters, this is a perfectly rational choice. Virtualization adds an abstraction layer over the resources available, but it’s not free of charge, and the performance is reduced compared to a bare metal server with the same resources, including the “noisy neighbor” effect. This effect is given by having multiple virtual machines running on the same physical server, so these VMs are not physically isolated and one of them can affect the performance of the rest by fighting for shared hardware resources (like IO devices or networks). Even security can be involved if the virtual instances are not properly isolated. Actual state of the art allows avoiding some of these problems, but there’s still an impact in the performance. Major Hayden performed a benchmark to compare running on bare metal against KVM (linux kernel hypervisor, used for virtualization) and he showed that there is a 2% performance impact. When looking at IO performance (disk, memory and network) the difference is even bigger. For those who need a probe of these results, there is a very interesting study performed by IBM comparing native servers against Docker containers and KVM virtualization.
Why using an IaaS provider?
Imagine that there is a house with a perimeter of eighty meters. The aim is to put a wood fence around the house, which should have a height of two meters to avoid thieves entering the house. For doing that, there are eight wood boards from a previous work. Each board has a width of one meter and a height of twenty meters. One way to go is to place these boards together in front of the house, but, even when the fence has a height of twenty meters, it only covers eight meters of the eighty meters perimeter, so the thieves can still enter the house easily. This means that the available resources don’t fit the use case and another solution is needed. The easier solution is to go to a DIY store and buy eighty boards, each one with a width of one meter and a height of two meters, and then build the fence putting all the new boards together. However, other solution is to get a compass saw and start splitting each of the eight original boards into ten smaller boards with the desired size, getting the same resources in the previous solution. The first option was faster (has a better performance), but also was more expensive, because there is a need to buy the required boards. The second one was slower (splitting the boards is not an easy job) but there is no additional cost, having a more efficient use of the available resources by adapting them to fit the use case.
The compass saw is like the IaaS provider (Openstack) and the original wood boards are like bare metal legacy servers. As the example shows, the IaaS allows making a more efficient use of the resources, reducing costs and giving more flexibility (very different use cases can be covered by the same resources) and scalability (adding and removing virtual machines is easier than physical ones when there are enough resources). The final result is a cost reduction, but with a performance impact. So, if there are legacy resources or there are many different use cases that need to be covered by the same resources without taking care of performance, the IaaS provider is the right choice.
For choosing between using bare metal or an IaaS provider the two main attributes to consider should be performance against cost. This ratio is the key for choosing one of the options, but there can be some preferences for one of the attributes.
Performance is always better in bare metal servers than when using an IaaS provider due to the abstraction layer added by virtualization, but it allows improving resource utilization so it has lower costs.
Finally, it’s important to mention that some IaaS providers can work directly with bare metal servers instead of virtual instances, taking the advantages of the two options.
I started getting in touch with Big Data, using Spark and the Hadoop ecosystem, working with cloud providers. Now, as a Big Data Developer, I work with IaaS, Terraform, Ansible, Scala, Spark… I am a vocational Computer Scientist and I enjoy learning new technologies and discovering new things.