Skip to content
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

Use Fastly to do Compression #120

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dstufft
Copy link
Member

@dstufft dstufft commented Feb 22, 2023

Basically this will use Fastly to handle our compression rather than letting Warehouse do it.

This should reduce the amount of CPU our origin servers expend, but more importantly it means that we can do certain optimizations in Warehouse around conditional GET requests where we can skip executing the view if we know ahead of time that we can return a 304 Not Modified. Currently this is impossible in Warehouse because the compression tween needs to read the response body to handle the ETag on compressed responses.

This should roughly match the behavior of the existing compression tween, with the following differences:

  • The existing tween only supports gzip, this supports gzip and brotli.
  • The existing tween has some logic in it to skip compressing if the compressed result is larger than the uncompressed result, where I can't find any information what Fastly would do in this case.
  • The ETags derived by the tween are likely going to be different then the ETags derived by Fastly.

This should work without code changes in Warehouse, because in vcl_miss and vcl_pass we modify the request that is going to be sent to the origin to remove the Accept-Encoding header, so Warehouse will only see requests that accept uncompressed content.

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

Successfully merging this pull request may close these issues.

1 participant