Skip to content

Increase gzip level and types#1329

Merged
matthew-white merged 1 commit intogetodk:nextfrom
yanokwa:gzip
Sep 16, 2025
Merged

Increase gzip level and types#1329
matthew-white merged 1 commit intogetodk:nextfrom
yanokwa:gzip

Conversation

@yanokwa
Copy link
Member

@yanokwa yanokwa commented Sep 2, 2025

gzip_comp_level of 4-6 seems to be the sweet spot for compression and CPU usage. We don't often see huge CPU usage on servers so 5 seems pretty safe.

gzip_proxied makes sure to gzip anything coming from upstream (reverse proxy mode)

gzip_min_length 1024 is a common default. 1280 suggests we've profiled the responses and we are making a sensible choice, but we haven't. Might as well use the common default.

I've added geojson and svg because we'll be serving those in the future.

@yanokwa yanokwa changed the title Tweak gzip settings Increase gzip level and types Sep 2, 2025
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml text/csv;
gzip_types text/plain text/css application/json application/geo+json application/x-javascript application/javascript text/xml text/csv image/svg+xml;
gzip_proxied any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this change? Requests from central seem to already be gzipped.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure if data coming from service and enketo were gzipped. This seemed like a no-cost way to guarantee that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something in front of test.getodk.cloud which could be zipping things?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I thought this was downstream. Upstream, if you are running a proxy or load-balanced in front of Central that might zip things? I'm happy to drop gzip_proxied. I agree it's not necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's potentially a good addition, I'm just trying to understand why it doesn't appear to be necessary. Potentially all zipping could be deferred to whatever is zipping downstream...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why it shouldn't be added? Seems like the only risk seems to be double-compression (unlikely because most modern proxies respect Content-Encoding: gzip) and maybe minor increase in nginx CPU.

@matthew-white
Copy link
Member

I'm going to add this PR to the project, since I'll probably mention it in the detailed release notes.

@github-project-automation github-project-automation bot moved this to 🕒 backlog in ODK Central Sep 3, 2025
@matthew-white matthew-white moved this from 🕒 backlog to ✏️ in progress in ODK Central Sep 3, 2025
@matthew-white
Copy link
Member

Just wanted to check about the status of this PR. @yanokwa, is this PR ready to be merged, or are you still waiting for feedback?

@yanokwa
Copy link
Member Author

yanokwa commented Sep 15, 2025

Please merge!

@matthew-white matthew-white merged commit 6cd6f5b into getodk:next Sep 16, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from ✏️ in progress to ✅ done in ODK Central Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ done

Development

Successfully merging this pull request may close these issues.

3 participants