Ephemeral OS Disks – what are they and when to use them

Ephemeral disks are something that have been in preview for a while now but have only very recently became generally available. If you look up the word ephemeral in the dictionary you will see it is defined as “something lasting for a very short time”. Essentially what this means is that the disk is non-persistent so any data written to this disk will be lost should the VM get deallocated. If there is an issue with the VM where you need to either redeploy to another host or perform any action that would deallocate the VM then it will be re-imaged with a new OS disk from the image that was used to create it.

This may sound familiar and yes it operates in exactly the same way as the temp storage (D drive) does. This is used as local storage by Azure to improve VM performance. and is also non-persistent.

With most Azure VMs the disks are kept on remote storage, i.e. they are not stored on the same host as the VM. If you choose to use an ephemeral OS disk then your OS disk will be stored on the same host as your VM and it will be kept on SSD storage. This will provide for lower latency and faster performance. It gets better because in addition to this the cost of an ephemeral OS disk is zero. Yes, that’s right it’s free. A point I regularly have to make to customers is that the storage cost of the OS disk is not included in your VM compute costs. You have to include this in your pricing estimates and this price varies depending on disk type, capacity and Azure region. As an ephemeral OS disk is free, this means you would only need to price for your data disks (if required). Note: Data disks will not be ephemeral and therefore kept on remote storage (for most VM sizes at least).

This all sounds good but when would you want to use one of these, when would you have a VM with a non-persistent OS disk?

Any VM that is built from an image either from the Azure marketplace or a custom uploaded image can be used but the workload would have to be stateless. All data would have to be kept either on separate disks, on different VMs or on other storage sources and so that the application state is not dependent on the VM. Where this works particularly well is with Virtual Machine Scale Sets which are deployed from an image. Here, the number of running instances in the scale set is either increased or decreased based on demand or a defined schedule. As the number of running instances can be constantly changing this is a great way to make use of those free OS disks and as they are stored on local SSD storage the time it takes to deploy a new instance should be improved.

Another example where does should work well is with RDS Session Hosts and with Windows Virtual Desktop. If these are configured with User Profile Disks and ideally with the new FSLogix profile containers (again not kept on the same VM) then most likely ephemeral OS disks can be used here too keeping your costs down and improving performance for your customers.

A few gotchas at the time of writing to be aware of:

  • OS disks cannot be resized
  • Resizing your VM will redeploy the VM and re-image your OS disk
  • VMs cannot be stopped and started therefore automation scripts for this purpose cannot be used
  • The size of the OS disk is based on the cache size of the VM size you have selected, therefore you need to choose a VM size that has a large enough cache to host your OS disk image. This means ephemeral OS disks for smaller VM sizes are simply not available in most cases

Ephemeral disks are one of those Azure features that are worth keeping in mind for any future projects. They may often not be suitable but it’s worth considering them where appropriate as they can save on cost as well as providing better performance and it’s not often that those two go hand in hand.

One thought on “Ephemeral OS Disks – what are they and when to use them

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.