Cloud Basics: What is a Virtual Machine?
Quick Introduction into the World of Virtual Machines and Virtualization
Today, we’ll take a look at the technology that made cloud computing possible: virtual machines. Virtual machines are the cornerstone of modern cloud computing (see Cloud Basics: What You Should Know). They solved lots of problems we had in the past when it comes to infrastructure resource utilization and efficiency.
But before we take a look at the world of virtualization and virtual machines, we’ll take a quick detour and look at how we handled infrastructure resource utilization before virtual machines came to the rescue and created the multitrillion-dollar cloud business of today.
The PRE-Virtual Machines Era
We all know that businesses rely on applications that are hosted on servers - airlines, for their booking systems; retail businesses for inventory management and shopping platforms, etc. That part hasn’t changed, but the way it is handled did.
In the past, before VMs, all these companies had to buy physical machines for every application they wanted to host. For example, an airline company had to buy servers for their new booking system to run on.
But then the question is: how powerful should those servers be? If you buy servers that aren’t powerful enough, you risk your business as a result of your systems not being able to handle the throughput. And if you get servers that are more powerful than you need, then you lose money because those servers aren’t efficiently utilized and most of their resources are never used, staying idle. Then we add all the recurring operating expenses per server, like electricity for power and cooling, paying staff, storage space, etc.
Many of you might rightfully ask the question: why don’t we put a few applications on a single server? It’s not that there weren’t cases like that, but the risks of multiple applications running on the same host machine are many, some of which are:
Two applications might need different versions of OS, web servers, frameworks, or other dependencies.
Compromising the host machine due to a hack or a virus leads to all of the apps being compromised as well.
Accessing the same host resources by multiple processes (apps) can lead to resource conflicts, locks, etc.
Scaling individual apps requires buying more powerful hardware for the server (scaling up) for all apps to share, not just the one that needed it in the first place.
What is a Virtual Machine
A virtual machine (VM) is a software-based, or "virtual," version of a computer, equipped with its own dedicated operating system (OS), CPU, memory, and storage, assigned to it by the physical machine within which it resides, known as the host. The host could be your personal computer or a server in a cloud provider's data center (see Cloud Basics: What You Should Know).
How Does a Virtual Machine work?
Virtual machines utilize a process called virtualization, which allows a single physical machine to distribute its hardware resources, like CPU, RAM and storage, among multiple virtual computers, known as virtual machines. This process is managed by a piece of software called a hypervisor, which oversees the allocation of resources and ensures that each virtual machine operates in its own, distinct virtual space, separate from the others. This whole process allows virtual machines to be highly independent and secure from one another.
What Are the Benefits of Using Virtual Machines?
Virtual machines address all of the challenges mentioned earlier. Let's examine each one:
Two applications might need different versions of OS, web servers, frameworks, or other dependencies.
Virtual machines are isolated environments that have their own OS and applications, such as web servers and frameworks. Two VMs on the same host can run different operating systems—such as Linux and Windows—without interference, thanks to the complete isolation provided by the hypervisor.
Compromising the host machine due to a hack or a virus leads to all of the apps being compromised as well.
Each VM operates in its own private sphere, offering complete isolation. Thus, a hack or virus targeting one VM will only impact that specific VM and not others. This isolation is a key reason why virtualization technology powers the cloud, allowing different entities to rent computing resources on the same physical machine without concern for the activities of other tenants.
Accessing the same host resources by multiple processes (apps) can lead to resource conflicts, locks, etc.
Virtual machines operate with their own set of OS and dependencies, ensuring that VM1 cannot interfere with the resources or processes of VM2, and vice versa. They exist as separate entities.
Scaling individual apps requires buying more powerful hardware for the server (scaling up) for all apps to share, not just the one that needed it in the first place.
This is where virtual machines shine. Through the magic of virtualization it’s now possible to buy those powerful servers and utilize their resources efficiently by distributing them across multiple tenants. And that’s really what’s happening today with cloud computing.
Cloud providers like Azure and AWS provide computing resources (VMs) to millions of clients worldwide. They achieve this by purchasing powerful servers and virtualizing them according to their clients’ needs. You want a machine with 8GB of RAM and 4 core CPU? No problem. You want something more powerful? Again, no problem. Cloud providers have got you covered, no matter what your requirements are; they offer nearly endless amounts of computing power available to you.
Scaling up (upgrading the hardware) or scaling out (adding more VMs) is a matter of a few clicks. For instance, if your e-commerce app experiences a surge in traffic around Valentine’s Day, you can easily adjust the scale to meet the demand and then scale down afterward. The best part is that you only pay for the resources you use.
Therefore, there's no need to invest in expensive servers that remain idle most of the time, incurring maintenance and electricity costs. Instead, you can rent servers from cloud providers and focus on running your business while they handle the rest.
Virtualization technology has kickstarted the cloud computing era, enabling millions of businesses and individuals worldwide to run their applications on the internet. From industry giants like Netflix to your neighbor Joe with his WordPress blog, the widespread adoption of virtual machines and virtualization has made this all possible.
If you found this useful, please consider sharing it on social media and subscribing. Insights like this one take a lot of time to produce and your support motivates me to keep going. 🙂