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.