rubrikinc / rubrik-sdk-for-powershell

Rubrik Module for PowerShell
https://build.rubrik.com/sdks/powershell/
MIT License
102 stars 87 forks source link

Slow performance when downloading (restore) #845

Open MatsBEkman opened 9 months ago

MatsBEkman commented 9 months ago

Current Behavior

The performance when using
Start-RubrikDownload.ps1
Start-RubrikVMDownload.ps1
is really slow because of the way Invoke-WebRequest was implemented
It is missing a parameter to make it fast
$ProgressPreference = 'SilentlyContinue'
need to proceed the command
We are using Powershell version 5.1 that is included in this server version

Expected Behavior

By adding this parameter before Invoke-WebRequest @WebRequestSplat In both of the above scripts we speed up the download time by a factor of at least 40

Steps to Reproduce

Use the scripts to download a large file and measure the time (PS version 5.1 included in the server running) Modify the scripts as follows Original script in both cases above have at the end

if (Test-PowerShellSix) {
  $WebRequestSplat.SkipCertificateCheck = $true
  Invoke-WebRequest @WebRequestSplat
} else {
  Invoke-WebRequest @WebRequestSplat
}

Changing them to

if (Test-PowerShellSix) {
  $WebRequestSplat.SkipCertificateCheck = $true
  $ProgressPreference = 'SilentlyContinue'
  Invoke-WebRequest @WebRequestSplat
} else {
  $ProgressPreference = 'SilentlyContinue'
  Invoke-WebRequest @WebRequestSplat
}

Run the scripts again and measure the time

Context

No response

Failure Logs

No response