We use actix for a webserver that runs behind nginx. As such, we dont use any of the compression features of actix. It would be nice if we could exclude brotli from the compile, because it is quite slow (about 30s). Besides, we are trying to remove native dependencies to make cross compilation easier.
brotli is already optional, just disable the compress feature on actix-web
Thanks, I misunderstood the cargo.toml then.
But in that case, the problem seems to be that we use the actix and actix-files crates, both of which depend on actix-http. And while actix has a feature for http that can be disabled, actix-files doesnt have any feature flags.
Here is our cargo.toml for reference/Cargo.toml
cargo tree -i brotli2 will show you exactly where it's coming from
brotli2 v0.3.2
โโโ actix-http v1.0.1
โโโ actix v0.9.0
โ โโโ actix-web-actors v2.0.0
โ โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โโโ actix-files v0.2.1
โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โโโ actix-web v2.0.0
โ โโโ actix-files v0.2.1 (*)
โ โโโ actix-web-actors v2.0.0 (*)
โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โโโ actix-web-actors v2.0.0 (*)
โโโ awc v1.0.1
โโโ actix-web v2.0.0 (*)
Ahh so the issue is that transitive dependencies of actix-web (like -actors and -files) don't tend to add default-features = false. PR is welcome for this.
This isnt completely solved yet, because actix-files and actix-web-actors still depend on actix-http = "2.0.0-beta.1" with default features. actix-web also depends on it via its awc dependency.
brotli2 v0.3.2
โโโ actix-http v2.0.0-beta.1
โโโ actix-files v0.3.0-beta.1
โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โโโ actix-web v3.0.0-beta.1
โ โโโ actix-files v0.3.0-beta.1 (*)
โ โโโ actix-web-actors v3.0.0-beta.1
โ โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โ โโโ http-signature-normalization-actix v0.4.0-alpha.2
โ โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โโโ actix-web-actors v3.0.0-beta.1 (*)
โโโ awc v2.0.0-beta.1
โ โโโ actix-web v3.0.0-beta.1 (*)
โ โโโ lemmy_server v0.0.1 (/home/felix/workspace/lemmy/server)
โโโ http-signature-normalization-actix v0.4.0-alpha.2 (*)
Ignore the deps from http-signature-normalization-actix and lemmy_server, those we will have to adjust ourselves.
Edit: I also dont see why actix-http depends on another HTTP client, h2. Brotli and h2 each add about 20 seconds to my build which seems excessive.
Lemmy server currently uses this line in server:
actix-web = { version = "3.0.0-alpha.3", features = ["rustls"] }
which includes the "compress" feature by default.
What you probably want is:
actix-web = { version = "3.0.0-alpha.3", default-features = false, features = ["rustls"] }
Edit: BTW, i'm more than happy to help with the upgrade to v3 for Lemmy if you'd like any.
Sorry, forgot to mention that I added default-features = false to all actix dependencies before checking it. I looked at the cargo.toml for the mentioned crates and all of them seem to depend on other actix crates with default features.
Edit: BTW, i'm more than happy to help with the upgrade to v3 for Lemmy if you'd like any.
Thanks that would be very helpful, and give us more time to focus on ActivityPub and other things.
Tell you what then, lemme figure this out and I'll make the PRs in the necessary places.
Thanks a lot :)
And to be clear, this is not a very important issue, it just would be nice to reduce our compilation time a bit, from currently 3m 40s on a Ryzen 5 2600. Almost half of that is just Diesel, but actix also compiles a lot of things that arent really needed. We would also have to switch our HTTP client again, so far we used like 3 or 4 different ones.
You mentioned h2 earlier but that's the basis for our http/2 server implementation. Is it that you only use http/1.1 behind a reverse proxy and do not want http/2 support?
Ah I misread the crates.io entry, apparently its an HTTP client and server, I thought it was only a client. Sorry for the confusion!
In general I just want to reduce the amount of deps we have, its over 400 already.