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

Allow setting compression levels #2928

Open
bubelov opened this issue Nov 10, 2022 · 0 comments · May be fixed by #2948
Open

Allow setting compression levels #2928

bubelov opened this issue Nov 10, 2022 · 0 comments · May be fixed by #2948
Labels
A-http project: actix-http A-web project: actix-web C-improvement Category: an improvement to existing functionality

Comments

@bubelov
Copy link

bubelov commented Nov 10, 2022

Expected Behavior

Although the default compression levels are sane, some users might want to adjust it to better fit their needs. Being able to set the compression levels gives users more control and flexibility.

Current Behavior

.wrap(Compress::default())

That's super easy to add, but there are no ways to fine-tune the compression algos.

Possible Solution

I like the defaults, although the available compression algos aren't that transparent, in a sense that it's tricky to figure out which ones are going to be supported from looking at the init code alone. I think that keeping it that way is fine, but it would be nice to have an alternative way to configure compression, here is a pseudo-code:

.wrap(Compress::setup(
    vec![
        Gzip::Level_5,
        Brotli::Level_7,
    ]
))

I'm relatively new to Rust, so take it with a grain of salt, I'm sure there are some more convenient/idiomatic patterns which can be used to setup the compression levels.

Context

I'm fine with the current defaults but I have some spare CPU capacity so it wouldn't hurt to keep it busy. Also, I'm planning to add Tor support to one of the APIs I'm working on, so optimizing for bandwidth would certainly help to speed things up a bit.

@robjtede robjtede added C-improvement Category: an improvement to existing functionality A-http project: actix-http A-web project: actix-web labels Nov 10, 2022
@topenkoff topenkoff linked a pull request Jan 18, 2023 that will close this issue
5 tasks
@robjtede robjtede added this to the actix-web v4.4 milestone Feb 27, 2023
@robjtede robjtede modified the milestones: actix-web v4.4, actix-web v4.5 Aug 29, 2023
@robjtede robjtede removed this from the actix-web v4.5 milestone Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-http project: actix-http A-web project: actix-web C-improvement Category: an improvement to existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants