Skip to content

Commit 251fa8b

Browse files
authored
outbound: Box HTTP endpoint stack (#1008)
This change ~halves compile-time and memory usage of release builds Before this change: Command being timed: "cargo build -p linkerd2-proxy --release" User time (seconds): 3233.32 System time (seconds): 49.02 Percent of CPU this job got: 583% Elapsed (wall clock) time (h:mm:ss or m:ss): 9:22.92 Maximum resident set size (kbytes): 57377268 With this change: Command being timed: "cargo build -p linkerd2-proxy --release" User time (seconds): 1935.21 System time (seconds): 32.59 Percent of CPU this job got: 594% Elapsed (wall clock) time (h:mm:ss or m:ss): 5:31.18 Maximum resident set size (kbytes): 23842208
1 parent dae07f4 commit 251fa8b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

linkerd/app/inbound/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ where
284284
.stack
285285
.instrument(|_: &_| debug_span!("direct"))
286286
.push_on_response(svc::BoxService::layer())
287-
.push(svc::BoxNewService::layer())
288287
.into_inner(),
289288
)
290289
.instrument(|a: &T| {
291290
let OrigDstAddr(target_addr) = a.param();
292291
info_span!("server", port = target_addr.port())
293292
})
293+
.push(svc::BoxNewService::layer())
294294
.into_inner()
295295
}
296296
}

linkerd/app/outbound/src/http/endpoint.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ impl<C> Outbound<C> {
7272
"host",
7373
CANONICAL_DST_HEADER,
7474
]))
75-
.push_on_response(http::BoxResponse::layer());
75+
.push_on_response(
76+
svc::layers()
77+
.push(http::BoxResponse::layer())
78+
.push(svc::BoxService::layer()),
79+
)
80+
.push(svc::BoxNewService::layer());
7681

7782
Outbound {
7883
config,

linkerd/app/outbound/src/http/logical.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ impl<E> Outbound<E> {
156156
.instrument(|l: &Logical| debug_span!("logical", dst = %l.logical_addr))
157157
// Boxing is necessary purely to limit the link-time overhead of
158158
// having enormous types.
159-
.push(svc::BoxNewService::layer())
160-
.push_on_response(svc::BoxService::layer());
159+
.push_on_response(svc::BoxService::layer())
160+
.push(svc::BoxNewService::layer());
161161

162162
Outbound {
163163
config,

0 commit comments

Comments
 (0)