Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/6361#discussion_r31401808
--- Diff: core/src/main/scala/org/apache/spark/scheduler/Task.scala ---
@@ -126,6 +129,21 @@ private[spark] abstract class Task[T](val stageId:
Int, var partitionId: Int) ex
taskThread.interrupt()
}
}
+
+ /**
+ * Deserializes the task from the broadcast variable.
+ * If Kryo serialization is being sed, a copy of the buffer is made
because Kryo deserialization
+ * is not thread-safe w.r.t. the deserialization buffer (see SPARK-7708)
+ */
+ protected[this] def deserialize[T: ClassTag](taskBinary:
Broadcast[Array[Byte]]): T = {
+ val ser = SparkEnv.get.closureSerializer.newInstance()
--- End diff --
It's actually pretty expensive to construct KryoSerializer instances, so
this might become a significant bottleneck for short tasks (JavaSerializer
instances are cheap, on the other hand). We'll still need to ensure that the
KryoSerializerInstance is only used in one thread at a time, though. Maybe we
can pool instances inside of `Executor` and loan them to tasks by passing them
in via `runTask`. Alternatively, we could expose the serializer instance via
TaskContext.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]