Skip to content

Commit

Permalink
inbound: Add a box layer to reduce compile times (#1317)
Browse files Browse the repository at this point in the history
The inbound proxy builds in 30-40 minutes on recent nightlies. This can
be reduced to 3-4 minutes with a boxing layer. This change adds such a
layer so that fuzzing builds can complete in a timely fashion.
  • Loading branch information
olix0r authored Oct 18, 2021
1 parent 504d8be commit 66f2f03
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions linkerd/app/inbound/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ http = "0.2"
linkerd-app-core = { path = "../../core" }
linkerd-app-inbound = { path = ".." }
linkerd-app-test = { path = "../../test" }
linkerd-proxy-identity = { path = "../../../proxy/identity", features = ["test-util"] }
linkerd-tracing = { path = "../../../tracing", features = ["ansi"] }
tracing = "0.1"

Expand Down
8 changes: 7 additions & 1 deletion linkerd/app/inbound/src/http/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ impl<C> Inbound<C> {
rt.span_sink.clone(),
super::trace_labels(),
))
.push_on_service(http::BoxResponse::layer());
.push_on_service(svc::layers()
.push(http::BoxResponse::layer())
// This box is needed to reduce compile times on recent (2021-10-17) nightlies,
// though this may be fixed by https://github.com/rust-lang/rust/pull/89831. It
// should be removed when possible.
.push(svc::BoxService::layer())
);

// Attempts to discover a service profile for each logical target (as
// informed by the request's headers). The stack is cached until a
Expand Down
3 changes: 2 additions & 1 deletion linkerd/app/inbound/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use linkerd_app_core::{
drain, exp_backoff, metrics,
proxy::{
http::{h1, h2},
identity::LocalCrtKey,
tap,
},
transport::{Keepalive, ListenAddr},
Expand Down Expand Up @@ -73,7 +74,7 @@ pub fn runtime() -> (ProxyRuntime, drain::Signal) {
let (tap, _) = tap::new();
let (metrics, _) = metrics::Metrics::new(std::time::Duration::from_secs(10));
let runtime = ProxyRuntime {
identity: linkerd_proxy_identity::LocalCrtKey::default_for_test(),
identity: LocalCrtKey::default_for_test(),
metrics: metrics.proxy,
tap,
span_sink: None,
Expand Down

0 comments on commit 66f2f03

Please sign in to comment.