Commit 80ab19b
[SPARK-26329][CORE] Faster polling of executor memory metrics.
## What changes were proposed in this pull request?
Prior to this change, in an executor, on each heartbeat, memory metrics are polled and sent in the heartbeat. The heartbeat interval is 10s by default. With this change, in an executor, memory metrics can optionally be polled in a separate poller at a shorter interval.
For each executor, we use a map of (stageId, stageAttemptId) to (count of running tasks, executor metric peaks) to track what stages are active as well as the per-stage memory metric peaks. When polling the executor memory metrics, we attribute the memory to the active stage(s), and update the peaks. In a heartbeat, we send the per-stage peaks (for stages active at that time), and then reset the peaks. The semantics would be that the per-stage peaks sent in each heartbeat are the peaks since the last heartbeat.
We also keep a map of taskId to memory metric peaks. This tracks the metric peaks during the lifetime of the task. The polling thread updates this as well. At end of a task, we send the peak metric values in the task result. In case of task failure, we send the peak metric values in the `TaskFailedReason`.
We continue to do the stage-level aggregation in the EventLoggingListener.
For the driver, we still only poll on heartbeats. What the driver sends will be the current values of the metrics in the driver at the time of the heartbeat. This is semantically the same as before.
## How was this patch tested?
Unit tests. Manually tested applications on an actual system and checked the event logs; the metrics appear in the SparkListenerTaskEnd and SparkListenerStageExecutorMetrics events.
Closes #23767 from wypoon/wypoon_SPARK-26329.
Authored-by: Wing Yew Poon <[email protected]>
Signed-off-by: Imran Rashid <[email protected]>1 parent 26d03b6 commit 80ab19b
File tree
49 files changed
+1205
-1484
lines changed- core/src
- main/scala/org/apache/spark
- executor
- internal/config
- metrics
- scheduler
- status
- util
- test
- resources
- HistoryServerExpectations
- spark-events
- scala/org/apache/spark
- deploy/history
- executor
- scheduler
- dynalloc
- status
- ui
- util
- dev
- project
- sql/core/src/test/scala/org/apache/spark/sql/execution/ui
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+1205
-1484
lines changedLines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
123 | | - | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
130 | | - | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | | - | |
25 | | - | |
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
30 | 27 | | |
31 | 28 | | |
32 | | - | |
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
36 | 32 | | |
37 | 33 | | |
38 | | - | |
39 | 34 | | |
40 | 35 | | |
41 | 36 | | |
| |||
58 | 53 | | |
59 | 54 | | |
60 | 55 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | 56 | | |
78 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
516 | 517 | | |
517 | 518 | | |
518 | 519 | | |
519 | | - | |
| 520 | + | |
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
| |||
2425 | 2426 | | |
2426 | 2427 | | |
2427 | 2428 | | |
2428 | | - | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
2429 | 2433 | | |
2430 | 2434 | | |
2431 | | - | |
| 2435 | + | |
2432 | 2436 | | |
2433 | 2437 | | |
2434 | 2438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
156 | 162 | | |
157 | 163 | | |
158 | 164 | | |
| |||
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
218 | | - | |
| 224 | + | |
| 225 | + | |
219 | 226 | | |
220 | 227 | | |
221 | 228 | | |
| |||
Lines changed: 51 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
191 | 203 | | |
192 | 204 | | |
193 | | - | |
194 | 205 | | |
195 | 206 | | |
196 | 207 | | |
| |||
207 | 218 | | |
208 | 219 | | |
209 | 220 | | |
| 221 | + | |
| 222 | + | |
210 | 223 | | |
211 | 224 | | |
212 | 225 | | |
| |||
254 | 267 | | |
255 | 268 | | |
256 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
257 | 276 | | |
258 | 277 | | |
259 | 278 | | |
260 | 279 | | |
261 | 280 | | |
262 | | - | |
| 281 | + | |
263 | 282 | | |
264 | 283 | | |
265 | 284 | | |
| |||
380 | 399 | | |
381 | 400 | | |
382 | 401 | | |
| 402 | + | |
383 | 403 | | |
384 | 404 | | |
385 | 405 | | |
| |||
412 | 432 | | |
413 | 433 | | |
414 | 434 | | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
415 | 438 | | |
416 | 439 | | |
417 | 440 | | |
| |||
529 | 552 | | |
530 | 553 | | |
531 | 554 | | |
| 555 | + | |
532 | 556 | | |
533 | | - | |
| 557 | + | |
534 | 558 | | |
535 | 559 | | |
536 | 560 | | |
| |||
559 | 583 | | |
560 | 584 | | |
561 | 585 | | |
562 | | - | |
563 | 586 | | |
564 | 587 | | |
565 | 588 | | |
566 | 589 | | |
567 | 590 | | |
568 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
569 | 595 | | |
570 | 596 | | |
571 | 597 | | |
| |||
574 | 600 | | |
575 | 601 | | |
576 | 602 | | |
577 | | - | |
| 603 | + | |
| 604 | + | |
578 | 605 | | |
579 | 606 | | |
580 | 607 | | |
| |||
609 | 636 | | |
610 | 637 | | |
611 | 638 | | |
| 639 | + | |
612 | 640 | | |
613 | 641 | | |
614 | 642 | | |
615 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
616 | 646 | | |
617 | 647 | | |
618 | 648 | | |
619 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
620 | 652 | | |
621 | 653 | | |
622 | 654 | | |
| |||
632 | 664 | | |
633 | 665 | | |
634 | 666 | | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
635 | 672 | | |
636 | 673 | | |
637 | 674 | | |
| |||
848 | 885 | | |
849 | 886 | | |
850 | 887 | | |
851 | | - | |
852 | | - | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
853 | 893 | | |
854 | 894 | | |
855 | 895 | | |
| |||
Lines changed: 33 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
49 | 59 | | |
50 | | - | |
| 60 | + | |
51 | 61 | | |
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
56 | | - | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
| |||
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
0 commit comments