Download Build Packages taking more time in Octopus Deploy

Hi Team,
We have developed a powershell script to download the Packages from the Octopus Server and use the package data internally. The issue we are facing now is running the script as part of a runbook in octopus deploy is taking more time. Infact if I run this script directly on Powershell ISE it takes approximately[2 to 3 minutes]. But from Octopus Deploy it takes [6 to 7 Minutes]. The more the data Octopus Deploy Takes more time to execute the same script. and there is no latency as both via octopus Deploy[Powershell] and using Powershell ISE we are running in the same server.

Powershell Command where we are downloading the package:
Invoke-WebRequest -Uri “$OctoURL/api/$Spaces_Name/packages/packages-$packagename.$PackageVersion/raw?apikey=$API_Key” -OutFile “$ExtractTokenLocalPath\$GetName\$GetVersion\$Name\$package.$PackageVersion.zip”

Please let me know if there is any alternative method to download the packages faster. Please note we are trying to achieve this only via API and not via Octo.exe.

Hi @sujeshsasi!

Thanks for reaching out. I’ve encountered issues like this before, with trying to download large files being slow when using Invoke-Webrequest - it seems it does not handle large downloads well. When working around this, I changed my download method to use

(New-Object Net.WebClient).DownloadFile("https://URL", "OUTFILE")  

In my particular case, it trimmed the download down from 15+ minutes to <2 minutes. I’d suggest giving this a try to see if you have a marked improvement in your downloads.

1 Like

Wow! that did work . And it is faster too. thanks a lot,

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.