-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-7795] [Core] Speed up task scheduling in standalone mode by reusing serializer #6323
Conversation
instead of creating a new one for each task.
@coolfrood have a look at https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark -- you missed a step or two. It's not 100% clear you can reuse the serializer but it is a good idea to float. |
Argh. Sorry. I'll create a JIRA for this and update the PR. |
Serializer instances aren't thread-safe, but it looks like this single-threaded use should be fine. I implemented some similar optimizations in #5606 and am in the process of fixing a rare corner-case related to serializer re-use with uncommon Kryo configurations (#6293). Based on discussion in those patches, this change looks good to me. We might actually be able to go a bit further and lift the serializer instance into a field of CoarseGrainedSchedulerBackend itself. That would be a bit riskier in terms of code review burden, since we'd have to double-check that CoarseGrainedSchedulerBackend is only ever used from a single thread (I think that this is actually the case, but would be good to double-check). |
Jenkins, this is ok to test. |
@JoshRosen: it looks like launchTasks() is only called from makeOffers(), which in turn is only called from the Actor's receive, so it should be safe to move the serializer into a member field. Also, both launchTasks() and makeOffers() can be made private. What do you think? |
Yep, looks like both My PR made a similar change to |
Test build #33263 has finished for PR 6323 at commit
|
Test build #33259 has finished for PR 6323 at commit
|
Test build #33266 has finished for PR 6323 at commit
|
LGTM |
Actually, one minor comment: |
Test build #33348 has finished for PR 6323 at commit
|
LGTM, so I'm going to merge this to master. Although I think this is probably safe for 1.4, I don't want to risk conflicting with any attempts to cut another RC tonight, so I'm not going to pick it there for now. Thanks! |
…using serializer My experiments with scheduling very short tasks in standalone cluster mode indicated that a significant amount of time was being spent in scheduling the tasks (>500ms for 256 tasks). I found that most of the time was being spent in creating a new instance of serializer for each task. Changing this to just one serializer brought down the scheduling time to 8ms. Author: Akshat Aranya <[email protected]> Closes apache#6323 from coolfrood/master and squashes the following commits: 12d8c9e [Akshat Aranya] Reduce visibility of serializer bd4a5dd [Akshat Aranya] Style fix 0b8ca93 [Akshat Aranya] Incorporate review comments fe530cd [Akshat Aranya] Speed up task scheduling in standalone mode by reusing serializer instead of creating a new one for each task.
…using serializer My experiments with scheduling very short tasks in standalone cluster mode indicated that a significant amount of time was being spent in scheduling the tasks (>500ms for 256 tasks). I found that most of the time was being spent in creating a new instance of serializer for each task. Changing this to just one serializer brought down the scheduling time to 8ms. Author: Akshat Aranya <[email protected]> Closes apache#6323 from coolfrood/master and squashes the following commits: 12d8c9e [Akshat Aranya] Reduce visibility of serializer bd4a5dd [Akshat Aranya] Style fix 0b8ca93 [Akshat Aranya] Incorporate review comments fe530cd [Akshat Aranya] Speed up task scheduling in standalone mode by reusing serializer instead of creating a new one for each task.
…using serializer My experiments with scheduling very short tasks in standalone cluster mode indicated that a significant amount of time was being spent in scheduling the tasks (>500ms for 256 tasks). I found that most of the time was being spent in creating a new instance of serializer for each task. Changing this to just one serializer brought down the scheduling time to 8ms. Author: Akshat Aranya <[email protected]> Closes apache#6323 from coolfrood/master and squashes the following commits: 12d8c9e [Akshat Aranya] Reduce visibility of serializer bd4a5dd [Akshat Aranya] Style fix 0b8ca93 [Akshat Aranya] Incorporate review comments fe530cd [Akshat Aranya] Speed up task scheduling in standalone mode by reusing serializer instead of creating a new one for each task.
My experiments with scheduling very short tasks in standalone cluster mode indicated that a significant amount of time was being spent in scheduling the tasks (>500ms for 256 tasks). I found that most of the time was being spent in creating a new instance of serializer for each task. Changing this to just one serializer brought down the scheduling time to 8ms.