rubrikinc / rubrik-sdk-for-powershell

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

Really slow performance when using download scripts. Proposed change included #844

Open MatsBEkman opened 9 months ago

MatsBEkman commented 9 months ago

Is your feature request related to a problem? Please describe.

Performance performance problems when using download from powershell script

$ProgressPreference = 'SilentlyContinue' needs to be added before any Invoke-WebRequest @WebRequestSplat Used for downloads from a prepared link

In our environment we went from doing restore 14 hours to 20 min for a large file just by adding this to the scripts

Scripts that we know using this are: Start-RubrikDownload.ps1 Start-RubrikVMDownload.ps1

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
}

Increases performance by a factor of at least 40

Describe the solution you'd like

Change the following scripts: Start-RubrikDownload.ps1 Start-RubrikVMDownload.ps1

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
}

Increases performance by a factor of at least 40

Describe alternatives you've considered

No response

Additional context

No response