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

Small nginx tweaks #45659

Merged
merged 2 commits into from Aug 28, 2018
Merged

Small nginx tweaks #45659

merged 2 commits into from Aug 28, 2018

Conversation

vincentbernat
Copy link
Member

Motivation for this change
  • reduce gzip compression in recommended settings (see commit message for details)
  • add 2 additional MIME types to be compressed (SVG and atom feeds)

These two changes are independent but I thought it would be silly to have two PR for such small changes. If one of these changes only is rejected, I'll rebase the PR to remove it.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

While there is little gain of space to use a compression level of 9,
the CPU usage is significant. Many experiments point to use something
between 4 and 6. For example:

 - https://mjanja.ch/2015/03/finding-the-nginx-gzip_comp_level-sweet-spot/
 - https://github.com/h5bp/server-configs-nginx/blob/3bda5b93edba147d51760e900c2079828a7dc274/nginx.conf#L93
The additions are:

 - image/svg+xml for SVG images
 - application/atom+xml for Atom feeds

These types are also present in mime.types. For better readability,
the list is sorted and formatted with one type per line.
Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

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

Both changes seems reasonable.

@Mic92
Copy link
Member

Mic92 commented Aug 27, 2018

@GrahamcOfBorg test nginx

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tests.nginx

Partial log (click to expand)

webserver: exit status 1
syncing
webserver: running command: sync
webserver: exit status 0
test script finished in 140.68s
cleaning up
killing webserver (pid 600)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/3lp9304pacdgqs6nnlnq75swgx54p2wj-vm-test-run-nginx

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: tests.nginx

Partial log (click to expand)

webserver: exit status 1
syncing
webserver: running command: sync
webserver: exit status 0
test script finished in 21.00s
cleaning up
killing webserver (pid 631)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/0289cmzq7dvqawqlqdicyr7w8dp8pcmv-vm-test-run-nginx

@Mic92 Mic92 merged commit 6a0a12a into NixOS:master Aug 28, 2018
@nh2
Copy link
Contributor

nh2 commented Aug 28, 2018

reduce gzip compression in recommended settings (see commit message for details)

In my opinion, the justification should be in a comment instead of a commit message.

After the code has moved around a lot, it's difficult to find out the original reason why some value was set to some default if it's in commit messages.

@Mic92
Copy link
Member

Mic92 commented Aug 28, 2018

Feel free to add the urls to the gzip compression value.

@globin
Copy link
Member

globin commented Aug 28, 2018

Thanks @vincentbernat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants