Uh oh!
There was an error while loading. Please reload this page.
[SPARK-53209][YARN] Add ActiveProcessorCount JVM option to YARN executor and AM - #51948
[SPARK-53209][YARN] Add ActiveProcessorCount JVM option to YARN executor and AM#51948jzhuge wants to merge 1 commit into
Conversation
pan3793
commented
Aug 9, 2025
what about the driver JVM options in YARN client mode? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jzhuge
commented
Aug 11, 2025
3 tests failed for the same error |
Uh oh!
There was an error while loading. Please reload this page.
WweiL
left a comment
There was a problem hiding this comment.
Thank you for picking this up!
Client mode is out of scope for this JIRA. Several things to consider for client mode:
|
pan3793
commented
Aug 11, 2025
Sounds reasonable. nit: maybe the title should be "... to YARN executor and AM" instead of "... to YARN executor and driver"? |
jzhuge
commented
Aug 11, 2025
How about "Add ActiveProcessorCount JVM option to Spark driver and executor in YARN mode" |
pan3793
commented
Aug 12, 2025
@jzhuge, my point is, "AM" is more consistent with your change than "driver" - in client mode, AM container |
HyukjinKwon
commented
Aug 13, 2025
Seems fine. cc @mridulm FYI |
jzhuge
commented
Aug 16, 2025
@mridulm@HyukjinKwon Just wanted to check in on the review for this, thanks! |
jzhuge
commented
Aug 24, 2025
Will add a flag after my vacation for 2 weeks. |
pan3793
commented
Sep 28, 2025
hi @jzhuge, do you have time to address the comment to move this PR forward? |
jzhuge
commented
Sep 28, 2025
Ah, it fell through the crack :-( |
jzhuge
commented
Sep 28, 2025
@pan3793@mridulm@HyukjinKwon Added a feature flag, default to false. Let me know whether I need to rebase or squash WIP commits. |
jzhuge
commented
Sep 28, 2025
Question: do we need separate flags for driver and executor? |
jzhuge
commented
Sep 29, 2025
Many tests failed, let me rebase. |
jzhuge
commented
Sep 30, 2025
Hmm, 2 unrelated test failures in these modules: kafkasparkr |
jzhuge
commented
Sep 30, 2025
Retest please |
63afcaf to
62839fbComparejzhuge
commented
Mar 23, 2026
Thanks @pan3793 for the review! Looking ... |
jzhuge
commented
Mar 23, 2026
Created SPARK-56157 for standalone and SPARK-56158 for local. |
8ffc12e to
f41dd72Compare@pan3793 Thanks for the feedback! The changes are cleaner. Please take another look. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jzhuge
commented
Mar 27, 2026
Sql test failure seem unrelated |
jzhuge
commented
Mar 27, 2026
Unrelated test failures in |
pan3793
commented
Mar 30, 2026
since the UT runs on your forked repo, you have permission to rerun the single failed job. |
pan3793
commented
Mar 30, 2026
I'm going to merge this if no further comments in 24 hours |
…tor and AM Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jzhuge
commented
Mar 30, 2026
This seems unrelated: |
pan3793
commented
Mar 31, 2026
merged to master, thank you, @jzhuge and all reviewers |
jzhuge
commented
Mar 31, 2026
Thanks @pan3793 for reviewing and merging the pr, @mridulm@HyukjinKwon@holdenk@WweiL for the review! |
What changes were proposed in this pull request?
When starting Spark driver and executors on YARN, the JVM process can discover all CPU cores on the node and set thread-pool or GC thread counts based on that value. We should limit what the JVM sees for the number of cores set by the user via
-XX:ActiveProcessorCount, which was introduced in Java 8u191.Adds three boolean config flags (default false):
spark.yarn.am.limitActiveProcessorCount.enabled: sets-XX:ActiveProcessorCount=<spark.yarn.am.cores>in the YARN AM JVM (client mode).spark.driver.limitActiveProcessorCount.enabled: sets-XX:ActiveProcessorCount=<spark.driver.cores>in the YARN AM JVM (cluster mode).spark.executor.limitActiveProcessorCount.enabled: sets-XX:ActiveProcessorCount=<spark.executor.cores>in executor JVMs on YARN.Why are the changes needed?
Without this change, the JVM discovers all CPU cores on the YARN node rather than the cores allocated to the container. Users have assigned driver and executors a number of cores and we should honor that. A simple test would be:
Runtime.getRuntime().availableProcessors()Does this PR introduce any user-facing change?
Yes — three new public configuration keys.
How was this patch tested?
New unit tests in
ClientSuiteandExecutorRunnableSuite.Co-authored-by: Shanyu Zhao shzhao@microsoft.com