Keep the taskBinary in Stage to avoid deserializing it multiple times, and send binary to executor instead of task.#43621
Keep the taskBinary in Stage to avoid deserializing it multiple times, and send binary to executor instead of task.#43621hui730 wants to merge 6 commits intoapache:masterfrom
Conversation
… for keeping the taskBinary in Stage instead of Task
… send binary to executor instead of task.
|
Mind filing a JIRA please? |
|
|
Each task has a reference to a broadcast'ed task binary Explicit use of broadcast variables is documented to be read only - but with task closures, I would be very reluctant to assume this behavior. If the instance is reused, task closures can start having side effects on other tasks in the same executor. |
Okay, I get what you mean. Especially in Hadoop. |
This is what is effectively happening currently, right ? I want to make sure I understand the proposal, and how it is different from what Spark is currently doing. |
Assuming that there are currently n tasks (same stage) running simultaneously in the executor. |
|
The broadcast variable is read once - not n times, and the deserialization n times prevents side effect between tasks, which would be a behavior change if we move away from it. On the performance aspect , as currently formulated, I would expect negligible (if any) difference - though would be happy to see numbers to the contrary to evaluate effectiveness ! |
What changes were proposed in this pull request?
My modification is a performance optimization, which keep the taskBinary in Stage to avoid deserializing it multiple times, and send binary to executor instead of task. Here are specific modifications:
a. Add stageID info to TaskDescription.
b. Add taskBinary info to taskSet. Remove taskBinary info to ShuffleMapTask and ResultTask.
c. add binary getter/setter of Task. Get binary will create a new copy of binary, do not use same binary of executor.
d. Store binary broadcast when submitTasks.
e. Add new Netty event message LaunchBinary, before executor run task, launch binary to new executor first.
Why are the changes needed?
the taskBinary for each task of the same stage is the same. The current situation is that each task will bring a copy of the taskBinary's broadcast variables to the executor, and my modification will send this taskBinary to each executor that has executed the corresponding stage, reducing the repetition of broadcast variables and avoid deserializing binary multiple times.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Because this modification is a modification of the Spark Core, and it also involves some parameter changes for unit testing, so I conducted all unit testing on all modules base on master branch.
Was this patch authored or co-authored using generative AI tooling?
No