简体   繁体   中英

Brotli Gzip compression AWS

I have gone through various stack overflow questions on the "br/gzip" compression. Have some doubts around it.

AWS takes care of compression when configured correctly. Please correct understanding on following points,

  1. On the first request (non-cached ) to the server -
    Would the AWS take time to create compressed version of assets?

  2. I assume it would benefit end user post 1st request as compressed assets are available by then?

  3. What if single page application distribution can have br/gzip which can serve over AWS compression with help of Edge Lambda? The reason I think of this approach is the compressed version is already available in build so AWS don't have to manage even on the very first request.

  1. A CDN server can cache compressed versions of assets, but it is of limited usefulness. The server can only use compression methods that the client supports, and has to make evaluation for every request, so it would need to store 3 versions if it wanted to do that for plain/br/gzip. It would make sense for very popular documents, but for most content it will be best to store just one version.

  2. br/gzip compression is very fast and is typically done on-the-fly as data is streaming to the client. There's would be no benefit to the end user in pre-compressing assets.

  3. Precompressing assets for SPA distribution would be troublesome -- you need to keep 3 versions of everything and you have to control parts of the HTTP protocol that you should not normally worry about. The introduction of an edge lambda is going to make your request handling slower, as compared to the highly optimized just-download-the-file code path. Don't do it.

It seems that you are thinking of compression as being a lot more expensive than it really is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM