use available cores in k8s cluster local mode #610
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upstream SPARK-XXXXX ticket and PR link (if not applicable, explain)
k8s cluster local mode is currently only on our fork
What changes were proposed in this pull request?
use all available cores from
Runtime.getRuntime.availableCores
in local k8s submission. This will make the cluster local submission to k8s behave the same as k8s cluster submission.Background:
Currently even when k8s cpu limits are set, java 8 spark applications will fail to derive the correct number of limits (https://bugs.openjdk.java.net/browse/JDK-6515172).
On k8s cluster submission, spark driver cpu overrides will only change the cpu requests, and optionally there is a spark override to set cpu limits, but these will only take effect when running with java 9+
When running with java 9+, with this PR, cpu limits set in k8s will make
availableCores
return the limit, and the local backend will use the correct number of threads.