Uh oh!
There was an error while loading. Please reload this page.
[SPARK-2713] Executors of same application in same host should only download files & jars once - #1616
[SPARK-2713] Executors of same application in same host should only download files & jars once#1616li-zhihui wants to merge 13 commits into
Conversation
AmplabJenkins
commented
Jul 28, 2014
Can one of the admins verify this patch? |
There was a problem hiding this comment.
If the move throws some exception, the lock may never be released. You should wrap the release call in a finally block.
JoshRosen
commented
Jul 29, 2014
Jenkins, this is ok to test. |
SparkQA
commented
Jul 29, 2014
QA tests have started for PR 1616. This patch merges cleanly. |
SparkQA
commented
Jul 30, 2014
QA results for PR 1616: |
li-zhihui
commented
Aug 4, 2014
@JoshRosen more comments? |
JoshRosen
commented
Aug 4, 2014
This uses FileLock as its locking mechanism. According to those docs (emphasis mine),
Can you comment on whether this approach is safe if we're using advisory locks, and maybe add that comment to the source code? |
SparkQA
commented
Aug 4, 2014
QA tests have started for PR 1616. This patch merges cleanly. |
SparkQA
commented
Aug 4, 2014
QA results for PR 1616: |
li-zhihui
commented
Aug 4, 2014
@JoshRosen added comment. |
JoshRosen
commented
Aug 4, 2014
Thanks for commenting. I now realize that my concern about advisory locking was a little misguided, since only cooperating Spark processes will be coordinating through the lock file. |
JoshRosen
commented
Aug 4, 2014
This seems like an alright fix and I'd like to get it into a release, but I'm concerned that this doesn't correctly handle every possible feature of For example, there's some code in We could try to special-case fix this by moving the decompression logic into Also, do you think we should just replace |
SparkQA
commented
Aug 5, 2014
QA tests have started for PR 1616. This patch merges cleanly. |
SparkQA
commented
Aug 5, 2014
QA results for PR 1616: |
li-zhihui
commented
Aug 5, 2014
Thaks @JoshRosen sorry I missed the important operation (and I missed I add a new commit. |
li-zhihui
commented
Aug 21, 2014
@JoshRosen any more comments? |
JoshRosen
commented
Aug 21, 2014
Thanks a bunch for updating this; this seems like an important fix and I'd like to try to get it included soon in a release. I'll try my best to review this tomorrow and merge it if it looks good. |
li-zhihui
commented
Aug 27, 2014
@JoshRosen do you have time to review it? |
pwendell
commented
Aug 27, 2014
@JoshRosen if you do merge this please only into master and not 1.1... we are only fixing major regressions in 1.1 right now. |
There was a problem hiding this comment.
Minor nitpick on naming, but I think it's confusing to have a method named fetchCachedFile with an option that has to be explicitly set in order to use the cache. I'd prefer to name this fetchFile, and rename the other method to something like doFetchFile or _fetchFile.
When fixing the merge conflict, do you mind moving the comment from the old fetchFile to here? I think the most comprehensive documentation should be on the public function, not the private one. I'd say something like
/** * Download a file requested by the executor . Supports fetching the file in a variety of ways, * including HTTP, HDFS and files on a standard filesystem, based on the URL parameter. * * If `useCache` is true, first attempts to fetch the file from a local cache that's shared across * executors running the same application. * * Throws SparkException if the target file already exists and has different contents than * the requested file.*/JoshRosen
commented
Sep 3, 2014
Hey, sorry to drop the ball on this review. Things got really busy during the 1.1.0 QA process, but I'm slowly getting back to my reviews now. Do you think there's any potential for conflicts between multiple applications that attempt to add files with the same name but different contents? Different applications will share the same local directory. Maybe the /cc @andrewor14, do you have any thoughts on this? |
JoshRosen
commented
Sep 3, 2014
Actually, I don't think the timestamp will help us here: If app A and B simultaneously add files named |
There was a problem hiding this comment.
style should be
def fetchCachedFile(
url: String,
targetDir: File,
...
useCache: Boolean) {
...
}
andrewor14
commented
Sep 3, 2014
Yes, it does seem like a problem if multiple simultaneous applications share the same files. Do we handle that even before this patch? I haven't dug deep into this, but should we have some kind application-specific directory for fetching files? |
JoshRosen
commented
Sep 3, 2014
@andrewor14 I don't think that it was a problem before, but the reason is perhaps a little subtle: The old This PR uses that same code path to perform the actual download. The potential conflict occurs because |
li-zhihui
commented
Sep 4, 2014
I test the patch in yarn mode, and the BTW: The |
SparkQA
commented
Oct 8, 2014
QA tests have started for PR 1616 at commit
|
SparkQA
commented
Oct 8, 2014
QA tests have finished for PR 1616 at commit
|
AmplabJenkins
commented
Oct 8, 2014
Test PASSed. |
li-zhihui
commented
Oct 22, 2014
@andrewor14 more comments? |
There was a problem hiding this comment.
I just noticed, if this isn't meant to be used in local mode, shouldn't this be useCache = !isLocal?
There was a problem hiding this comment.
If so, it would be good if you could add a small comment to explain here that the cache is not needed for local mode because there is no fetching involved.
andrewor14
commented
Oct 22, 2014
Hey yeah @li-zhihui sorry this slipped on our end. This LGTM except for the one comment I made just now. I think the intention is that executors running in local mode shouldn't have to use the cache, as expressed in your javadoc for |
SparkQA
commented
Oct 24, 2014
QA tests have started for PR 1616 at commit
|
SparkQA
commented
Oct 24, 2014
Tests timed out for PR 1616 at commit |
AmplabJenkins
commented
Oct 24, 2014
Test FAILed. |
andrewor14
commented
Oct 24, 2014
retest this please |
SparkQA
commented
Oct 24, 2014
QA tests have started for PR 1616 at commit
|
SparkQA
commented
Oct 24, 2014
QA tests have finished for PR 1616 at commit
|
AmplabJenkins
commented
Oct 24, 2014
Test FAILed. |
li-zhihui
commented
Oct 24, 2014
@andrewor14 I guess the failure is non-interrelated with the patch. But I don't know why failed again, can you give me some advice? |
andrewor14
commented
Oct 24, 2014
retest this please |
andrewor14
commented
Oct 24, 2014
Yeah pyspark tests are kinda flaky. There's no way this patch could have caused it. |
SparkQA
commented
Oct 24, 2014
Test build #22147 has started for PR 1616 at commit
|
SparkQA
commented
Oct 24, 2014
Test build #22147 has finished for PR 1616 at commit
|
AmplabJenkins
commented
Oct 24, 2014
Test PASSed. |
andrewor14
commented
Oct 24, 2014
Ok cool I'm merging this. Thanks @li-zhihui |
If Spark lunched multiple executors in one host for one application, every executor would download it dependent files and jars (if not using local: url) independently. It maybe result in huge latency. In my case, it result in 20 seconds latency to download dependent jars(size about 17M) when I lunched 32 executors in every host(total 4 hosts).
This patch will cache downloaded files and jars for executors to reduce network throughput and download latency. In my case, the latency was reduced from 20 seconds to less than 1 second.