Understanding Azure Virtual Machines

Rupesh K. Roy  Print 
14 Sep 2018
 
Intermediate
915

Azure Virtual Machines are on-demand computing resources or virtual machines offering of Microsoft Azure. We can typically use a VM as a service when required and shut down the system when not in use. The Azure Virtual Machines are listed under Infrastructure as a service (IaaS) category in Azure. With Azure Virtual Machines we get more control over the environment to customize the development environment or hosting. In fact, the concept behind the Azure Virtual Machine is the same that runs the entire cloud platform – Virtualization.

Virtualization - This is the same as it sounds- the process of sharing resources like compute, Storage, network and cloud service so that it is virtually available. We can create a virtual machine (VM) in our own system too by sharing the Hardware configurations. Similarly, in large data centres, Cloud service providers share some physical servers to be made available to many cloud service consumers by the process called virtualization. Azure VMs are part of hardware virtualization. An advanced topic will be discussed in a separate section for software virtualization called Containerization.

Virtual machine - A Virtual machine is a ready-made computer system that has been made available by Visualization concept. That means, a VM is a copy of some part of shared resource in a data center to be optimized and used according to the need. We can install operating system of our choice, configure networks to connect and use shared storage.

Why Azure Virtual Machine?

It is always a question in the mind of developer to choose between Azure PaaS Services and Azure IaaS Services to build and develop cloud-based solutions that allows to make use of best features in Azure. In such scenarios, it is important to understand the capabilities of Azure IaaS and Azure PaaS. Having learnt already about the Azure PaaS section in previous articles, let us try to understand some features and capabilities of Azure VMs

  1. More Control – With Azure VMs, Developer have more control over the development environment which is very helpful in case of building a highly secured architecture for a complex solution. Developers can choose operating system, Networking, Storage connections etc. to build a sandbox solution.

  2. Easy Diagnostics – Azure VMs provides the facility to troubleshoot issues with options like remote debugging, event logs, IIS logs, application logs etc.

  3. Alerts – We can trigger actions and alerts based on metrics of computing resources consumed by VM.

  4. Pricing – We can shut down and stop the VMs if not in use. A stopped VM will not incur any charge. Restarting the VM will maintains its state based on persistent disks.

  5. Scaling – We can scale up/down and out/In the Virtual machines. Auto scale feature is also there to support based on some metrics. For example, scale out to 5 instances when CPU utilization is greater than 70% for more than 5 minutes.

  6. Scale Sets – Virtual Machine Scale Sets are group of VMs with identical configuration and will be managed by a load balancer.

Virtual Machine Size

In Azure Portal, we can create a VM from the available list of the pre-loaded Operating system from the marketplace like Windows Virtual machine, Linux Virtual machine. Both Windows and Linux virtual machines have similar size and type of VMs available in the marketplace.

  1. General purpose – Sizes: Av2, B, Dv2, Dv3, DSv2, Dsv3 These sizes of Azure VMs are generally used for small or medium traffic web servers and can be used as a development or test environment. It has a balanced CPU to memory ratio.

  2. Compute optimized - Sizes: F, Fs, FSv2 This category is optimized for running heavy background work loads. This size group is suitable for medium traffic web server and has high CPU to memory ratio.

  3. Memory Optimized – Sizes: Ev3, ESv3, G, M, GS These VMs have High memory to CPU ratio and recommended for relational databases and in memory analytics.

  4. Storage Optimized – Size: Ls This VM category is suitable for large databases like No SQL and Big Data storage. It has high through put and IO operations.

  5. GPU optimized -Sizes: NV, NC, NCv2, NCv3 GPU optimized VM sizes are specialized virtual machines available for high density graphical rendering work or video editing. These sizes are designed for compute-intensive, graphics-intensive, and visualization workloads.

  6. High Performance – Size H This is the highest power category VM with highest throughput and network interfaces.

Virtual Machine Prices

Azure VM has two kind of pricing modals - Pay as you Go and Reserved Virtual machine Instance.

  1. Pay as you Go – This modal charge only for the time compute resource like Azure VM is used. It does not have any long-term commitment or any fixed monthly charges. We can scale out or even stop the VM in order to utilize efficiently and reduce bills.This kind of plan works for short term projects with un-predictable business requirements. Developers try out the stability of application in this plan.

  2. Reserved Instances – This plan brings an advanced purchase option for a reserved VM instance for a period of 1 or 3 years. With this, users get up to 72 % price savings than pay as you go plan. Reserved Virtual machines can easily be replaced with another one in case of any downgrade in performance. This plan suits with stable traffic on applications deployed on Azure VM. Software development with the fixed budget can prefer having a reserved Azure VM.

Important Information

Currently, Azure has put a default quota limit of 20 for the number of Azure VMs per subscription in a specific region. This should be kept in mind while architecting complex solutions. This can be further increased by raising a support ticket.

Virtual Machine Architecture

Azure VM is actually dependent on many other components. Lets deep dive into the Architecture.

Source: docs.microsoft.com

Resource Group – A resource group a logical container for all related resources based on the lifetime of resources. This also helps to provide access to users for a particular set of resources attached to same resource group.

Virtual machine - This can be created in Azure by portal, PowerShell or Azure CLI from the list of published images or by a custom image VHD file uploaded into Azure Blob.

Temporary disk -The VM also has a temporary disk stored on a physical drive on the host machine. It is not persisted during reboot events.

Virtual network – VMs can be deployed in a separate Virtual network (VNet) that can be divided into multiple subnets to support different layers of application architecture. Each Subnet should be associated with different Network Security Group (NSG) with defined inbound and outbound rules which takes care of allowing or denying web traffic.

Network Interface – The Network Interface (NIC) allows the VM to be configured for the Virtual Network.

Public IP – A public IP address is by default added with a VM. This is used to communicate with VM from outside like Remote Desktop.

VM Availability Sets

In order to ensure high availability of Azure VM Solutions, there is a unique feature called Availability Sets. This manages the VMs by deploying them in different cluster nodes in data centers. To understand Virtual Machine Availability Sets, we need to first understand these two terms

  1. Fault Domain

    A set of racks in a data centre that has a common power source. This means that if the power supply goes off, the VMs deployed in those set of racks will shut down. Like how we organize bookshelves in a library, a particular shelveset for a particular section of books can be considered to a fault domain.

  2. Update Domain

    One rack in a Fault domain is called update domain. This can be considered as one unit in a cabinet of hardware or one unit of the subsection in a book shelve. Multiple update domains are part of a fault domain. If the power goes off for the fault domain, the update domains automatically go down.

To meet the SLA of 99.95%, it is recommended to group one or more virtual machines in an Availability Set. This ensures that in case of planned or unplanned maintenance activities, at least one VM is up and running. By default, Azure deploys the virtual machines in an availability set in 3 Fault domains and 5 update domains. We can configure it to use up to 20 update domains. It is recommended to have different availability sets for web servers and API servers. We cannot assign existing VMs to an Availability Set. We should first create an availability set and then while creating VMs we should associate Availability Sets to VMs.

Scaling

We can perform scale up/down and Scale out/in operations on virtual machines.

Vertical Scaling

In vertical scaling, the size of the VM is changed. Scale up for VMs is to upgrade the size of VM to a higher level. This will require reboot of the system and that will have an outage. Similarly, scale down of VM instance is to downgrade the size of VM.

Horizontal Scaling

Horizontal scaling means increasing or decreasing the number of VM instances. For Scale-out operation of VM, we can add another similar configuration VM instance and add a load balancer to distribute the incoming HTTP requests. This kind of scaling is well supported with Virtual machine Scale Sets. For Scale-In, VM instances are removed. It is easy to manage VMs with Scale sets as VMs can be created on demand or scheduled time from a central configuration. A load balancer will automatically be created and integrated. This also takes care of deploying multiple VMs across Availability sets.

Summary

Azure Virtual machines are the right option to start using Azure as a platform to build and deploy solutions. It resembles the same as a web server but allows the flexibility to use enhanced cloud-related features. We can connect Azure VMs to on-premise Virtual Networks and other servers to ensure the secured transaction of requests within the network domain through a private passage. With Azure VMs, we have that flexibility to start and use the VM when required and then turn off when not. This lowers the burden of keeping and maintaining heavy infrastructure.

Hands-on Learning
+