Uh oh!
There was an error while loading. Please reload this page.
[SPARK-24137][K8s] Mount local directories as empty dir volumes. - #21238
[SPARK-24137][K8s] Mount local directories as empty dir volumes.#21238mccheah wants to merge 5 commits into
Conversation
Dramatically improves performance and won't cause Spark applications to fail because they write too much data to the Docker image's specific file system. The file system's directories that back emptydir volumes are generally larger and more performant.
mccheah
commented
May 4, 2018
@foxish@liyinan926 please take a look, thanks! |
SparkQA
commented
May 4, 2018
Test build #90217 has finished for PR 21238 at commit
|
SparkQA
commented
May 4, 2018
Kubernetes integration test starting |
SparkQA
commented
May 4, 2018
Kubernetes integration test status success |
SparkQA
commented
May 5, 2018
Test build #90225 has finished for PR 21238 at commit
|
andrusha
commented
May 7, 2018
Seems like it addresses similar problem to #21095. It might be worth investigating how to unify both. |
mccheah
commented
May 9, 2018
@andrusha I don't think it's entirely analogous - for the simple reason that the hostPath volumes PR doesn't take into account |
mccheah
commented
May 9, 2018
Also #21260 currently only supports hostPath and PVCs but you definitely want emptyDir for isolation (though that looks like a trivial enough change). |
| if (contains("spark.local.dir")) { | ||
| val msg = "In Spark 1.0 and later spark.local.dir will be overridden by the value set by " + | ||
| "the cluster manager (via SPARK_LOCAL_DIRS in mesos/standalone and LOCAL_DIRS in YARN)." | ||
| "the cluster manager (via SPARK_LOCAL_DIRS in mesos/standalone/kubernetes and LOCAL_DIRS" + |
There was a problem hiding this comment.
oops, I deleted a comment here accidentally. @rxin said that we could remove this warning about Spark 1.0.
erikerlandson
commented
May 9, 2018
I agree with @mcheah that the potential code reuse is small. Keeping this as a separate pod construction step, decoupled from the user-exposed step, is cleaner. |
| val localDirVolumes = resolvedLocalDirs | ||
| .zipWithIndex | ||
| .map { | ||
| case (localDir, index) => |
There was a problem hiding this comment.
I think the convention is to put case on the same line as map {.
| .map { | ||
| case (localDir, index) => | ||
| new VolumeBuilder() | ||
| .withName(s"spark-local-dir-${index + 1}-${Paths.get(localDir).getFileName.toString}") |
There was a problem hiding this comment.
Do you really need to include the actual path in the volume name? I think spark-local-dir-${index + 1} is sufficient.
| val localDirVolumeMounts = localDirVolumes | ||
| .zip(resolvedLocalDirs) | ||
| .map { | ||
| case (localDirVolume, localDirPath) => |
mccheah
commented
May 10, 2018
@rxin@liyinan926@foxish addressed comments. |
SparkQA
commented
May 10, 2018
Kubernetes integration test starting |
SparkQA
commented
May 10, 2018
Kubernetes integration test status success |
SparkQA
commented
May 10, 2018
Test build #90431 has finished for PR 21238 at commit
|
SparkQA
commented
May 10, 2018
Test build #90432 has finished for PR 21238 at commit
|
mccheah
commented
May 10, 2018
Requesting sign off and merge from @foxish |
foxish
commented
May 10, 2018
LGTM. Merging to master. |
liyinan926
commented
May 10, 2018
Maintenance releases most often have fixes for stability. We could maybe backport this since it's not a new feature but an omission from before. If it is going to be some effort, thanks to all the refactors that went in so far, we should think twice about whether we need to. |
foxish
commented
May 10, 2018
@mccheah, wdyt? I just haven't heard from any users here of 2.3 - if you think it's useful for 2.3.1 and low risk, then please feel free to propose a cherrypick. |
mccheah
commented
May 10, 2018
I think we can afford to hold off here. |
mccheah
commented
May 10, 2018
What would make this difficult to backport is the fact that this patch was built on top of the big refactor PR that only went in after 2.3. So we'd need to rewrite this with the old architecture which is a non-trivial effort. |
foxish
commented
May 10, 2018
SG. @liyinan926, let's revisit this if we hear from 2.3 users. |
liyinan926
commented
May 10, 2018
Makes sense to me. |
Drastically improves performance and won't cause Spark applications to fail because they write too much data to the Docker image's specific file system. The file system's directories that back emptydir volumes are generally larger and more performant. Has been in use via the prototype version of Kubernetes support, but lost in the transition to here. Author: mcheah <mcheah@palantir.com> Closesapache#21238 from mccheah/mount-local-dirs.
This PR continues #21095 and intersects with #21238. I've added volume mounts as a separate step and added PersistantVolumeClaim support. There is a fundamental problem with how we pass the options through spark conf to fabric8. For each volume type and all possible volume options we would have to implement some custom code to map config values to fabric8 calls. This will result in big body of code we would have to support and means that Spark will always be somehow out of sync with k8s. I think there needs to be a discussion on how to proceed correctly (eg use PodPreset instead) ---- Due to the complications of provisioning and managing actual resources this PR addresses only volume mounting of already present resources. ---- - [x] emptyDir support - [x] Testing - [x] Documentation - [x] KubernetesVolumeUtils tests Author: Andrew Korzhuev <andrew.korzhuev@klarna.com> Author: madanadit <adit@alluxio.com> Closes#21260 from andrusha/k8s-vol.
What changes were proposed in this pull request?
Drastically improves performance and won't cause Spark applications to fail because they write too much data to the Docker image's specific file system. The file system's directories that back emptydir volumes are generally larger and more performant.
How was this patch tested?
Has been in use via the prototype version of Kubernetes support, but lost in the transition to here.