One of your go-live tasks once you have built a VM in Azure, should be to ensure that the Azure disk cache settings on the Linux VM data disks, are set correctly in accordance with the Microsoft recommended settings. In this post I explain the disk cache options and how they apply to SAP and especially to SAP databases such as SAP ASE and SAP HANA, to ensure you get optimum performance.
What Are the Azure Disk Cache Settings?
In Microsoft Azure you can configure different disk cache settings on data disks that are attached to a VM.NOTE : You do not need to consider changing the O/S root disk cache settings, as by default they are applied as per the Azure recommendations.
Only specific VMs and specific disks (Standard or Premium Storage) have the ability to use caching. If you use Azure Standard storage, the cache is provided by local disks on the physical server hosting your Linux VM. If you use Azure Premium storage, the cache is provided by a combination of RAM and local SSD on the physical server hosting your Linux VM.
There are 3 different Azure disk cache settings:
None ReadOnly (or “read-only”) ReadWrite (or “read/write”)
The cache settings can influence the performance and also the consistency of the data written to the Azure storage service where your data disks are stored.
Cache Setting: None
By specifying “None” as the cache setting, no caching is used and a write operation at the VM O/S level is confirmed as completed once the data is written to the storage service. All read operations for data not already in the VM O/S file system cache, will be read from the storage service.
Cache Setting: ReadOnly
By specifying “ReadOnly” as the cache setting, a write operation at the VM O/S level is confirmed as completed once the data is written to the storage service. All read operations for data not already in the VM O/S file system cache, will be read from the read cache on the underlying physical machine, before being read from the storage service.
Cache Setting: ReadWrite
By specifying “ReadWrite” as the cache setting, a write operation at the VM O/S level is confirmed as completed once the data is written to the cache on the underlying physical machine. All read operations for data not already in the VM O/S file system cache, will be read from the read cache on the underlying physical machine, before being read from the storage service.
Where Do We Configure the Disk Cache Settings?
The disk cache settings are configured in Azure against the VM (in the Disks settings), since the disk cache is both physical host and VM series dependent. It is *not* configured against the disk resource itself, as explained in my previous blog post: Listing Azure VM DataDisks and Cache Settings Using Azure Portal JMESPATH & Bash
Any Recommendations for Disk Cache Settings?
There are specific recommendations for Azure disk cache settings, especially when running SAP and especially when running databases like SAP ASE or SAP HANA.
In general, the rules are:
Disk Usage Azure Disk Cache Setting Root O/S disk (/) ReadWrite – ALWAYS! HANA Shared ReadOnly ASE Home (/sybase/<SID>) ReadOnly Database Data HANA=None, ASE=ReadOnly Database Log None
The above settings for SAP ASE have been obtained from SAP note 2367194 (SQL Server is same as ASE) and from the general deployment guide here: https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/dbms_guide_general The use of write caching on the ASE home is optional, you could choose ReadOnly, it would help protect the ASE config file in a very specific scenario. It is envisaged that using ASE 16.0 with SRS/HADR you would have a separate data disk for the Replication Server data (I’ll talk about this in another post). The above settings for HANA have been taken from the updated guide here: https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage which is designed to meet the KPIs mentioned in SAP note 2762990.
The reason for not using a write cache every time, is because an issue at the physical host level, affecting the cache, could cause the application (e.g database) to think it has committed data, when it actually isn’t written to disk. This is not good for databases, especially if the issue affects the transaction/redo log area. Data loss could occur.
It’s worth noting that this cache “issue” has always been true of every caching technology ever created, on which databases run. Storage tech vendors try to mitigate this by putting batteries into the storage appliances, but since the write cache in Azure is at the physical host level, there’s just no guarantee that when the VM O/S thinks the write operation has committed to disk, that it has actually been written to disk.
How About Write Accelerator?
There are specific Azure VM series (M-series at current) that support something known as “Write Accelerator”. This is an extra VM level setting for Premium Storage disks attached to M-series VMs.
Enabling the Write Accelerator setting is a requirement by Microsoft for production SAP HANA transaction log disks on M-Series VMs. This setting ebales the Azure VM to meet the SAP HANA key performance indicators in note 2762990. Azure Write Accelerator is designed to provide lower latency write times on Premium Storage.
You should ensure that the Write Accelerator setting is enabled where appropriate, for your HANA database transaction log disks. You can check if it is enabled following my previous blog post: Listing Azure VM DataDisks and Cache Settings Using Azure Portal JMESPATH & Bash
I’ve tried my best to find more detailed information on how the Write Accelerator feature is actually provided, but unfortunately it seems very elusive. Robert Boban (of Microsoft) commented on a LinkedIn post here : “It is special caching impl. for M-Series VM to fulfill SAP HANA req. for <1ms latency between VM and storage layer. “.
Check the IOPS
Once you have configured your disks and the cache settings, you should ensure that you test the IOPS achieved using the Microsoft recommended process. You can follow similar steps as my previous post: Recreating SAP ASE Database I/O Workload using Fio on Azure
As mentioned in other places in the Microsoft documentation and SAP notes such as 2367194, you need to ensure that you choose the correct size and series of VM to ensure that you align the required VM maximum IOPS with the intended amount of data disks and their potential IOPS maximum. Otherwise you could hit the VM max IOPS before touching the disk IOPS maximum.
Enable Accelerated Networking
Since the storage is itself connected to your VM via the network, you should ensure that Accelerator Networking is enabled in your VMs Network Settings:
Checking Cache Settings Directly on the VM
As per my previous post Checking Azure Disk Cache Settings on a Linux VM in Shell , you can actually check the Azure disk cache settings on the VM itself. You can do it manually, or write a script (better option for whole landscape validation).
Summary:
I discussed the two types of storage (standard or premium) that offer disk caching, plus where in Azure you need to change the setting. The table provided a list of cache settings for both SAP ASE and SAP HANA databases and their data disk areas, based on available best-practices.
I mentioned Write Accelerator for HANA transaction log disks and ensuring that you enable Accelerated Networking. Also provided was a link to my previous post about running a check of IOPS for your data disks, as recommended by Microsoft as part of your go-live checks.
A final mention was made another post of mine, with a great way of checking the disk cache settings across the VMs in the landscape.
Useful Links:
Windows File Cache https://docs.microsoft.com/en-us/azure/virtual-machines/linux/premium-storage-performance https://docs.microsoft.com/en-us/azure/virtual-machines/windows/how-to-enable-write-accelerator https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage#production-storage-solution-with-azure-write-accelerator-for-azure-m-series-virtual-machines https://petri.com/digging-into-azure-vm-disk-performance-features https://techcommunity.microsoft.com/t5/running-sap-applications-on-the/sap-on-azure-general-update-march-2019/ba-p/377456 https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/dbms_guide_general https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage SAP Note 2762990 – How to interpret the report of HWCCT File System Test SAP Note 2367194 – Use of Azure Premium SSD Storage for SAP DBMS Instance
You may also be interested in: