Skip to content

suggestion: add explanation about the disabled compress option of server-adapter to workarounds section #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
imattferreira opened this issue Jan 30, 2023 · 9 comments

Comments

@imattferreira
Copy link
Contributor

Hey, what's up everyone?!

Today, when the server-adapter creates a NextJS server, the open-next disables the compress option and in the code is mentioned a bug in the bundled compression package, this being the cause of the option being disabled.

https://github.com/serverless-stack/open-next/blob/265acefeaeac5511cee84089a71d79412a3aad21/src/adapters/server-adapter.ts#L22-L24

With this option disabled, the server don't compress rendered content causing a decrease performance in the network transfers between server to the client.

I would particularly like to see a better explanation and a possible recommendation to make a alternative solution about this in the Limitations and workarounds of readme, to turn this limitation of open-next more evident to other developers that want to use this lib.

@Gregory-Ledray
Copy link

@khuezy
Copy link
Contributor

khuezy commented Jan 31, 2023

Looks like the original ticket on vercel was closed due to not being reproducible on the latest version. I'll give this a shot.

@khuezy
Copy link
Contributor

khuezy commented Jan 31, 2023

@MattFerreira18 do you know the performance hit of not compressing?

@khuezy
Copy link
Contributor

khuezy commented Jan 31, 2023

I was able to deploy a successful app w/ compression turned on (default value). I've include the change in #30

@imattferreira
Copy link
Contributor Author

imattferreira commented Feb 1, 2023

Are you unable to compress responses using CloudFront?

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html?icmpid=docs_cf_help_panel#DownloadDistValuesCompressObjectsAutomatically

@Gregory-Ledray Ohh thanks, I didn't know that cloudfront had a option to configure gzip.

@imattferreira
Copy link
Contributor Author

@MattFerreira18 do you know the performance hit of not compressing?

@khuezy sorry but I don't know the performance hit of not compressing in a app using open-next and I can't now create a benchmark with the open-next 😕.

But I already saw in other stacks that the gzip is enabled, a small increase of CPU usage in exchange for a reduction more than 10% of the served files size (and consequently reducing the bandwidth usage).

@khuezy
Copy link
Contributor

khuezy commented Feb 1, 2023

@MattFerreira18 The CF distribution already encodes the response via Broli. If you look at the response headers, content-encoding: br. So I don't think setting compress: true matters, it might mess things up by double encoding?

@AG-Teammate
Copy link

There are a couple of issues with compression on CloudFront level:

  • Transfers between Lambda region and CloudFront edges are uncompressed and take performance hit,
  • CloudFront may skip compression and cache uncompressed version during high load (peak hours)

@conico974
Copy link
Contributor

Feel free to reopen if you still have issues

@conico974 conico974 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants