OctopusDSC: use gzip when talking to Octopus server

The OctopusDSC package uses the PowerShell Invoke-WebRequest and Invoke-RestMethod commands to communicate with the Octopus server. Out of the box, these do not request any compression on the response, but the header can be explicitly included; if the result is gzip-compressed, it will automatically decompress the result.

Some of the endpoints on the Octopus server that the DSC resources access can be large - for example, our /machines/all endpoint returns over 1 MB of JSON. With gzip enabled, that compresses down to only 64 KB over the wire.

It would be nice if the DSC code were updated to request gzip-compressed responses to reduce the amount of traffic we’re sending over the network. The Tentacle resource hits that /machines/all endpoint each time DSC runs. Multiply that by 600+ Tentacles, and that’s a lot of network traffic every 15-30 minutes.

$results = Invoke-WebRequest -Uri $apiEndpoint -Headers @{"X-Octopus-ApiKey"="$APIKey"; "Accept-Encoding"="gzip"} -UseBasicParsing

If the Octopus server doesn’t support gzip for some reason, it would just ignore the header and send an uncompressed response like it does now.

Hi @andrew.timson,

Thank you for contacting Octopus Support.

I’m going to pass this request along to our development team. However, I recommend also logging this request on our UserVoice forum here: https://octopusdeploy.uservoice.com/

I can definitely see how this would save bandwidth in your situation. We really appreciate suggestions like this that help us continue to improve Octopus.

If there is anything else we can assist with, please let us know.

Regards,
Donny

Hi @andrew.timson,

I just wanted to respond with a quick update.

It looks like we have a PR in to get this addressed. You may follow along here:

Once that is pushed to master, be sure to check for a new version of OctopusDSC here:

PowerShell Gallery | OctopusDSC 4.0.1055

If you have any questions, please let us know.

Regards,
Donny

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