How storage options in Azure impact SQL Server performance

SQL Server in azure using an IaaS deployment comes with many pros (and cons) over PaaS offerings. One of the nice things about IaaS is the full control you have over SQL Server and to a large extent the infrastructure it’s deployed on. There are many different VM SKU’s to suit your instances requirements as well as a handful of storage options. This blog will focus on storage and show you how it can be make or break for your sql server in Azure.

For IaaS the most commonly used storage is an Azure managed disk, of which there are 5 types; Ultra, PremiumV2, Premium SSD, Standard SSD and Standard HDD.

A breakdown of their capabilities at the time of writing can be seen below:

FeatureUltra DiskPremium SSD v2Premium SSDStandard SSDStandard HDD
Disk TypeSSDSSDSSDSSDHDD
ScenarioIO-intensive workloads such as SAP HANA, top-tier databases (SQL, Oracle), and other transaction-heavy workloads.Production and performance-sensitive workloads that require consistently low latency and high IOPS/throughput.Production and performance-sensitive workloadsWeb servers, lightly used enterprise apps, dev/testBackup, non-critical, infrequent access
Max Disk Size65,536 GiB65,536 GiB32,767 GiB32,767 GiB32,767 GiB
Max Throughput10,000 MB/s1,200 MB/s900 MB/s750 MB/s500 MB/s
Max IOPS400,00080,00020,0006,0002,000 โ€“ 3,000*
Latency (Claimed)‘low sub millisecond’‘~1 ms’sub millisecond’‘single-digit millisecond latencies’‘single-digit millisecond latencies’Write <=10ms
Read <= 20ms
Usable as OS Disk?NoNoYesYesYes

Test

Azure generally does what it says on the tin throughput wise. If you crank the dial to 500MBps that’s the throughput you can get. Latency is where it can get interesting though, and it’s interesting to note there are no SLA’s attached to storage latency.

As such lets take a look at how these different disks perform when inserting 50,000 integers sequentially into a single int column table; paying specific attention to write latency and writelog waits to see if there is any correlation and its impact on query execution times.

This test is loosely indicative of how storage choices can affect sql server write operations commonly found in daily processes with lots of sequential writes

All tests were also run on a Standard E8bds v5 (8 vcpus, 64 GiB memory) deployed from a marketplace image which has a max uncached Ultra Disk and Premium SSD V2 disk throughput IOPS/MBps of 44200/1200 and 33000/930 for premium. Log file throughput never reached disk or vm throughput limits adding weight to the latency correlation.

Summary

StorageLatency msInsert Time
Pv20.636 seconds
Ultra0.945 seconds
Premium SSD21 minute 44
Standard HDD43 Minutes 32

As you can see there is a strong correlation between the disks write latency and the time it takes for the query to execute, further backed up by the fact most of the session waits are writelog.

“This wait type is when a thread is waiting for a log block to be written to disk by an asynchronous I/O.”

Another interesting thing to note is I have consistently seen Pv2’s outperform ultra disk in log file write latency’s. However, ultra’s do have lower read latency’s.

Scripts used for the test can be seen below:

Scripts to run the insert and look at session wait statistics

Premium V2 insert

Log Drive
  • Premium SSD v2 LRS
  • 14740IOPs
  • 313MBps Throughput
Test
  • 36 Seconds
  •  0.6 ms write latency on the log drive via perfmon
  • < 1ms write latency via DMV’s
  • 34048ms of WRITELOG waits (35 seconds of writelog….)

Ultra Disk Insert

Log Drive
  • ULTRA SSD
  • 14740IOPs
  • 1024MBps Throughput
Test
  • 45 Seconds
  •  0.9 ms write latency on the log drive via perfmon
  • < 1ms write latency via DMV’s
  • 42762ms of WRITELOG waits (42 seconds of writelog….)

Premium SSD

Log Drive
  • Premium SSD LRS
  • 500 IOPs
  • 100MBps Throughput
Test
  • 1 minute 44
  • 2ms write latency on the log drive via perfmon
  • 1ms write latency via DMV’s
  • 102157ms of WRITELOG waits (1.7 minutes of writelog….)

Standard HDD

Log Drive
  • Standard HDD LRS
  • 500 IOPs
  • 60MBps Throughput
Test
  • 3 minutes 32
  • 4ms write latency on the log drive via perfmon
  • 4ms write latency via DMV’s
  • 207050ms of WRITELOG waits (4.45 minutes of writelog….)

Conclusion

It’s no surprise that disk types affect query performance, its just good to see why and by how much. Oh also, latency is pretty un-predictable, these were best cases seen over a few runs, but I have witnessed higher latency’s…


Categories:

Tags:


Leave a Reply

Your email address will not be published. Required fields are marked *

Comments