48

Improve Azure VM backup and restore performance

 5 years ago
source link: https://www.tuicool.com/articles/hit/VZVzquA
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

If you are running virtual machines (VMs) in Azure, you should be using Azure Recovery Services (ARS) to back them up. This blog, which runs WordPress on an Ubuntu Server VM, has been using Azure backup since 2016. It’s saved my butt multiple times. It costs about $5/month/VM I think, which is well worth the peace of mind. I’ve only had one issue with Azure backup in over two years and that was quickly resolved by reinstalling the Azure VM agent .

But performance isn’t stellar. My little VM takes, on average, about five hours to backup. That may be OK since backup is non-disruptive and file-system consistent. But faster is always better, right?

Yesterday, I stumbled on this Azure blog post from March, 2018 announcing better performance and large disk support. The new feature is enabled  at a subscription level and despite the post saying there would be an option to update to the new backup stack for the subscription in the portal, I couldn’t find it. However, registering the subscription for the updated stack was a snap.

[I’ve been converting to the new Azure “Az” cmdlets that were recently announced. They are easier to use (less typing!) and, best of all, are complete on macOS under PowerShell Core 6. You can specify Enable-AzureRMAlias with a scope to use your current scripts. The examples below use the new cmdlets. It looks like the PowerShell team was careful to map all the new cmdlet verbs and nouns to the old ones as much as possible. So there’s no reason not to use the new module now. Also, be sure  not  to install the old “AzureRM” module alongside the new “Az” module]

To register the subscription for the new backup capabilities, here’s the code I used:

Login-AzAccount
Get-AzSubscription –SubscriptionName "YourSubscriptionNameHere" | Select-AzSubscription
Register-AzProviderFeature -FeatureName “InstantBackupandRecovery” –ProviderNamespace Microsoft.RecoveryServices

While your vault is being updated, you will see a “Registering” status:

3YbURnB.jpg!web Get-AzProviderFeature registering status (click to enlarge)

It can take some time for the Azure Recovery Services backup stack to be updated, as seen here:

7raaIfi.jpg!web Azure backup feature registration in process (click to enlarge)

If you want to keep an eye on the registration process, here’s a quick-and-dirty script that will run until the registration process is complete:

while ( (Get-AzProviderFeature -FeatureName "InstantBackupandRecovery" -ProviderNamespace Microsoft.RecoveryServices).RegistrationState -eq "Registering")
{
 
    (Get-Date -format G) + ": still registering"
    Start-Sleep -Seconds 90
 
}
(Get-Date -format G) + ": registration complete"

When feature registration is complete, run a backup and after it completes, you will want to compare the performance of the immediately preceding backup (the old backup stack) to the current backup (with the new backup stack). In my case, the improvement was dramatic — an almost 30% drop in elapsed time. Here are my results, along with the (messy) pwsh script I used to get just the two backups I wanted to compare:

zyMnyiI.jpg!web Azure backup performance improvement (click to enlarge)

That’s quite a performance gain for about five minutes’ work! I highly recommend you check all your Azure recovery vaults with a quick Get-AzProviderFeature -FeatureName "InstantBackupandRecovery" -ProviderNamespace Microsoft.RecoveryServices .

It’ll be worth it.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK