Commit d7779ac
committed
Fix high memory usage in ContextPropagationHelper
Prior to this commit, gh-1149 added support for cancellation detection
at the transport level and the propagation of the CANCEL signal to data
fetcher `Publisher`. `ContextPropagationHelper` stores in the context a
`Sink` that emits the cancel signal. All upstream publishers are then
subscribing to this and canceling themselves if they receive a signal.
In the case of high field count queries + high request/sec services,
this would create a significant memory overhead.
This commit reduces the support to the essential parts:
* avoid further calls to data fetchers if the request is canceled
* cancel subscription publishers
This means other in-flight data fetchers that are publisher-based are
not canceled anymore. This should be a good compromise for high RPS
See gh-12421 parent 7d1b5ce commit d7779ac
File tree
5 files changed
+38
-44
lines changed- spring-graphql/src
- main/java/org/springframework/graphql/execution
- test/java/org/springframework/graphql/execution
5 files changed
+38
-44
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
Lines changed: 22 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
123 | | - | |
124 | | - | |
| 127 | + | |
| 128 | + | |
125 | 129 | | |
126 | | - | |
| 130 | + | |
127 | 131 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
132 | 141 | | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
136 | | - | |
| 145 | + | |
137 | 146 | | |
138 | 147 | | |
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
142 | | - | |
143 | | - | |
144 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
145 | 154 | | |
146 | 155 | | |
147 | 156 | | |
148 | 157 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 158 | | |
168 | 159 | | |
169 | 160 | | |
| |||
175 | 166 | | |
176 | 167 | | |
177 | 168 | | |
178 | | - | |
| 169 | + | |
179 | 170 | | |
180 | 171 | | |
181 | 172 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
96 | | - | |
| 95 | + | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
102 | | - | |
| 101 | + | |
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
| |||
Lines changed: 11 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
| |||
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
306 | | - | |
| 307 | + | |
307 | 308 | | |
308 | 309 | | |
309 | | - | |
| 310 | + | |
310 | 311 | | |
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
| 315 | + | |
314 | 316 | | |
315 | 317 | | |
316 | 318 | | |
| |||
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
325 | | - | |
| 327 | + | |
326 | 328 | | |
327 | 329 | | |
328 | | - | |
| 330 | + | |
329 | 331 | | |
330 | 332 | | |
331 | 333 | | |
| |||
336 | 338 | | |
337 | 339 | | |
338 | 340 | | |
339 | | - | |
340 | | - | |
| 341 | + | |
| 342 | + | |
341 | 343 | | |
342 | 344 | | |
343 | 345 | | |
| |||
357 | 359 | | |
358 | 360 | | |
359 | 361 | | |
360 | | - | |
| 362 | + | |
361 | 363 | | |
362 | 364 | | |
363 | 365 | | |
364 | | - | |
| 366 | + | |
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| |||
0 commit comments