PowerShell script exchange
Post Reply
squebel
Service Provider
Posts: 127
Liked: 11 times
Joined: Sep 27, 2019 5:06 pm
Contact:

Get-VBRRestorePoint very slow

Post by squebel »

Seen some other recent posts on this topic so I thought I would hop in too... the Get-VBRRestorePoint cmdlet is extremely slow.

"Get-VBRRestorepoint -name vmname" takes nearly 2 minutes to run. This is on a VBR server that has little load on it during the middle of the day on Sunday. The environment is pretty big, a lot of jobs, and a lot of servers and restore points but the server and SQL database (running external) is not busy at all at 2pm on a Sunday.

The following code, which gets the backup sizes for all the vm's of one customer (15 vm's) takes 30 minutes to run:

Code: Select all

$total = 0
foreach ($vm in $vmlist){
    $bkupsize = ((Get-VBRRestorePoint -name $vm.name).getstorage().stats.backupsize |Measure-Object -sum).sum/1GB
    write-host $vm.name,$bkupsize -ForegroundColor Yellow
    $total += $bkupsize
    }
    write-host "Total: ",$total -ForegroundColor Yellow
If I run "Get-VBRBackup -name backupjobname |Get-VBRRestorePoint -name vmname" it's almost instantaneous. Is there really that much inefficiency in the pure Get-VBRRestorePoint cmdlet that if you don't focus it on a job first, it's basically 120x slower?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-VBRRestorePoint very slow

Post by oleg.feoktistov »

Hi,

Under the hood Get-VBRRestorePoint acts differently with or without Backup parameter passed.
Without Backup parameter we first get the list of all backups supported for output using CBackup.GetAll() static method. Then we take each backup object and invoke CBackup.GetOibs() dynamic method.
With Backup parameter we execute CBackup.GetOibs() on a backup object passed right away. Hence, the performance difference.

In the script you shared you could increase performance by bringing Get-VBRRestorePoint out of the loop and executing it one time instead of 15 times:

Code: Select all

$total = 0
$rps = Get-VBRRestorePoint
foreach ($vm in $vmlist){
    $rpsFiltered = $rps | where {$_.Name -eq $vm.name)
    $bkupsize = ($rpsFiltered.getstorage().stats.backupsize |Measure-Object -sum).sum/1GB
    write-host $vm.name,$bkupsize -ForegroundColor Yellow
    $total += $bkupsize
    }
    write-host "Total: ",$total -ForegroundColor Yellow
Best regards,
Oleg
squebel
Service Provider
Posts: 127
Liked: 11 times
Joined: Sep 27, 2019 5:06 pm
Contact:

Re: Get-VBRRestorePoint very slow

Post by squebel »

Thanks for the response, Oleg.

I will test your suggestion but are you saying that running Get-VBRRestorePoint against the entire environment will be faster than running it and telling it to look for just one vm?
squebel
Service Provider
Posts: 127
Liked: 11 times
Joined: Sep 27, 2019 5:06 pm
Contact:

Re: Get-VBRRestorePoint very slow

Post by squebel »

Ok, wow, this is MUCH faster. Thank you so much for the suggestion!!
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-VBRRestorePoint very slow

Post by oleg.feoktistov »

You are welcome, glad it helped!
Of course, running Get-VBRRestorePoint without any parameters won’t be faster than running it with Name specified. But in your case you use Get-VBRRestorePoint inside a loop. Which means it is invoked N times, where N is an amount of iterations. If you iterate over 15 vms, you invoke the cmdlet 15 times etc. So, yes, executing Get-VBRRestorePoint against the entire environment, but just one time and outside the loop will in fact be faster. Unless you have one iteration of a foreach loop.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests