Azure VM Disk Caching

Azure VM Disk types :

there are 3 types of disk used with Azure VM's

OS Disk - azure automatically attaches a vhd for the OS when we create VM.

Temporary disk - azure automatically assigns temporary disk when we create VM. This storage is present on the phycical machine that is hosting your VM & your VM can move to a different host any point in time due to various reasons like hardware failure or re-deploy & your data may loose. This disk is used for data, such as page and swap files.

Data Disk - its a vhd that we attach to store data , additional disk.


Caching Option for Azure VM's

Caching utilizes the local RAM and SSD drives on underlying VM host.

there are 3 common options for VM disk caching :

Read/write - Write-back cache. Use this option only if your application properly handles writing cached data to persistent disks.

Read-only - Reads are done from the cache hence it improves latency and potentially gain higher IOPS per disk

None - No cache. select this option for write-only and write-heavy disks. log files are a good candidate bacuse they write heavy operations.

Disk caching options can't be changed for L-Series and B-series virtual machines.



Performance considerations:

OS Disk :-

Default behaviour is to use cache in read/write mode

if you have application that store data files on the OS disk and also does lots of randome read / write operations to the data files, consider moving those files to a data disk that has the caching turned off, because if the read queue does not contain sequential reads, caching will be of little or no benefit.

Overhead of maintaining the cache, as of the data was sequential, can reduce disk performance.


Data Disk :-

For performance-sensitive applications, you should use data disks rather than the os disk. Using separate disks allows you to configure the appropriate cache settings for each one.

For e.g  Azure VM running SQL Server , enabling Read-only caching on the data disk can result in the significant performance improvements. Log files on the other hand are good candidate for the data disk with no caching.


Changing Caching Option via Powershell :

Simple 3 line code can help you change the caching of the disk.

$vm = get-azvm -ResourceGroupName "RGName" -Name "VMName"

$vm.StorageProfile.DataDisks

Set-AzVMDataDisk -vm $vm -Name "diskname" -Caching ReadWrite | Update-AzVM


you can also use portal to do that go to VM >> Disk >> click edit and change the option there.

Below link would give the detailed information -

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage-performance





No comments:

Post a Comment

Azure Firewall - Detail Overview

Azure Firewall is a cloud-native and intelligent network firewall security service that provides the best of breed threat protection for you...