Commit b0cf2fb
authored
cache: Ensure that actively held services are not evicted (#768)
Cache eviction is currently triggered when a service has not processed
new requests for some idle timeout. This is fragile for caches that may
process a few long-lived requests. In practice, we would prefer to only
start tracking idleness when there are no *active* requests on a
service.
This change restructures the cache to return services that are wrapped
with tracking handles, rather than passing a tracking handle into the
inner service. When a returned service is dropped, it spawns a
background task that retains the handle for an idle timeout and, if no
new instances have acquire the handle have that timeout, removes the
service from the cache.
This change reduces latency as well as CPU and memory utilization in
load tests. Furthermore, it ultimately eliminates the need for a specialized
buffer implementation.
Fixes linkerd/linkerd2#53341 parent 7a2f2b2 commit b0cf2fb
File tree
14 files changed
+725
-257
lines changed- linkerd
- app
- core/src
- inbound/src
- outbound/src
- http
- test
- src
- cache
- src
14 files changed
+725
-257
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1011 | 1011 | | |
1012 | 1012 | | |
1013 | 1013 | | |
| 1014 | + | |
1014 | 1015 | | |
1015 | 1016 | | |
1016 | 1017 | | |
| |||
1044 | 1045 | | |
1045 | 1046 | | |
1046 | 1047 | | |
1047 | | - | |
| 1048 | + | |
1048 | 1049 | | |
1049 | 1050 | | |
| 1051 | + | |
| 1052 | + | |
1050 | 1053 | | |
1051 | 1054 | | |
1052 | 1055 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 81 | | |
94 | 82 | | |
95 | 83 | | |
| |||
239 | 227 | | |
240 | 228 | | |
241 | 229 | | |
242 | | - | |
| 230 | + | |
243 | 231 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
248 | 235 | | |
249 | | - | |
| 236 | + | |
250 | 237 | | |
251 | 238 | | |
252 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
286 | 290 | | |
287 | 291 | | |
288 | 292 | | |
| |||
358 | 362 | | |
359 | 363 | | |
360 | 364 | | |
| 365 | + | |
361 | 366 | | |
362 | 367 | | |
363 | | - | |
364 | 368 | | |
365 | 369 | | |
366 | 370 | | |
| |||
0 commit comments