Microsoft are always adding more features and configuration options that can be used for your Virtual Machine deployments and I find quite often some of these go under the radar at the time and get overlooked either for subsequent deployments or as options for optimizing existing deployments.
I decided to put together a few options that can be used to get increased performance from your Virtual Machines in terms of CPU, storage and networking performance. Some of these options may have an additional cost consideration but this might be a cheaper alternative than simply going for a larger VM size and throwing more compute power at a problem.
1. Select the correct VM series – the first place to start is to make sure you have selected the most appropriate VM series for your workload type. This is not simply a matter of picking a series that has the amount of vCPU cores and RAM that you require and sits within your price range. The role of your Virtual Machine is a very important thing to consider when choosing your VM series. Each VM series has different hardware and configuration traits and is designed in a way that will provide optimal performance based on these traits. For example does the role of your Virtual Machine require performance optimized for CPU, memory, disk performance, network throughput or perhaps a combination of some of these?
If you are unsure what to choose then I generally recommend the Dv2/Dsv2 series as a good ‘general purpose’ series. This link provides a good summary of each of the available series and remember that the options are increasing all the time so it’s important to continually assess your options for future optimization.
2. Use Premium SSD managed disks – this may be another obvious one but choosing a higher performance disk type will reduce latency and increase throughput which can have a dramatic performance improvement. This one comes with a cost increase but where available and applicable (i.e. for stateless workloads) consider using an Ephemeral OS disk which is free. I have another blog post about this already which you can read here.
3. Use larger managed disks – often you will only want to choose a disk that is sized for the amount of storage that you require today and of course with the cloud you can simply increase this in size when needed. If you want better performance however you may want to use a larger managed disk size initially even if you don’t require the additional storage and this is due to the increased IOPS and throughput you get based on the size of the disk.
For example, a 1TiB Premium SSD managed disk will provide 5,000 IOPS and a throughput of 200MB/second versus a 256GiB managed disk which offers 1,100 IOPS and a throughput of 125MB/second.
4. Disk striping – you can stripe your disks together within the OS to aggregate the IOPS and throughput. If using Windows Server 2012R2/2016/2019 you can simply use Storage Spaces to create a volume with the combined storage, IOPS and throughput of the disks used. For example, if we combine 4 x 256GiB from our example above we would get a single 1Tib volume with a potential combined 4,400 IOPS and combined 500MB/second throughput.
Note: You will need to make sure your selected VM size can support this amount of disk IOPS and throughput in order to get the full benefit.
5. Disk caching – configure the caching option on your disks for optimal performance. You can choose between ‘None’, ‘Read-only’ and ‘Read/write’ caching which depending on your workload can improve your disk performance, particularly when working with SQL Server and where you have used separate data disks for SQL data and log files. Here you would select a ‘Read-only’ cache for the data disk and a cache type of ‘None’ for the logs disk.
Note: Not supported for B-series and L-series VMs.
6. Accelerated networking – this feature effectively removes the virtual switch from the host allowing the NIC to forward network traffic directly to the virtual machine. This results in reduced jitter, lower latency and decreased CPU utilization on the Virtual Machine due to the lack of the virtual switch and the processing of network traffic this requires.
Note: This feature is only available on some VM sizes.
7. Proximity placement groups – keeps your virtual machines located closer together physically within the Microsoft data centers reducing network latency. Especially useful when using Availability Sets or Availability Zones where your Virtual Machines will be kept apart by design, this helps reduce the physical distance between them.
Note: At the time of writing this feature is still in preview so not recommended for production just yet.
That’s just a few examples of some adjustments you can make to your Azure deployments to get better performance from your Virtual Machines today. There will always be more features and configuration options added from Microsoft in the future so it’s always good to know how you can continue to optimize your Azure deployments as the cloud continually evolves.