0

Google's documentation mentions that cdn can enable dynamic compression, and an example is provided below, but I can't successfully set the dynamic compression strategy

document

document link

The error I see when I execute the command is as follows, is it changed to other flags?And from the log, the size of the transferred image is not compressed.

error

txyh
  • 33
  • 2

2 Answers2

2

You can now enable Dynamic Compression from within the UX. Under the Backend Service/Bucket.

Enable Dynamic Compression

You may need to purge the old content in order for the new compressed content to be served. Cloud CDN will not evict a valid object just because you changed the configuration.

Dave
  • 434
  • 5
1

It looks like there are two problems. First, you appear to have an old version of gcloud that was released prior to the dynamic compression Beta. The right way to upgrade gcloud will depend on your platform, but it's typically gcloud components update or sudo apt-get upgrade google-cloud-sdk.

Once you have an up-to-date gcloud installation, you'll likely run into the second problem. Google's documentation incorrectly advises you to use gcloud compute, but you need to use gcloud beta compute while the feature remains in Beta:

$ gcloud compute backend-services update YOUR_BACKEND_SERVICE_NAME --compression-mode=AUTOMATIC ERROR: (gcloud.compute.backend-services.update) unrecognized arguments:

 --compression-mode flag is available in one or more alternate release tracks. Try:

  gcloud alpha compute backend-services update --compression-mode
  gcloud beta compute backend-services update --compression-mode

  --compression-mode=AUTOMATIC (did you mean '--custom-response-header'?)
  To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS
$
elving
  • 1,441
  • 8
  • 7
  • Thanks. The beta command works. But I can see from Google's log that the transmission size of images seems to have not changed. Is there any delay in the effectiveness of the command – txyh Apr 11 '22 at 08:37
  • @txyh, most image file formats already incorporate compression and so won't benefit from Google Cloud CDN dynamic compression. There's more information about what will and won't be compressed at [cloud.google.com/cdn/docs/dynamic-compression#response-not-compressed](https://cloud.google.com/cdn/docs/dynamic-compression#response-not-compressed). – elving Apr 11 '22 at 19:09