Github user jerryshao commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5064#discussion_r26638830
  
    --- Diff: core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala 
---
    @@ -212,10 +213,26 @@ class TaskMetrics extends Serializable {
       private[spark] def updateInputMetrics(): Unit = synchronized {
         inputMetrics.foreach(_.updateBytesRead())
       }
    +
    +  @throws(classOf[IOException])
    +  private def readObject(in: ObjectInputStream): Unit = 
Utils.tryOrIOException {
    +    in.defaultReadObject()
    +    // Get the hostname from cached data, since hostname is the order of 
number of nodes in
    +    // cluster, so using cached hostname will decrease the object number 
and alleviate the GC
    +    // overhead.
    +    _hostname = TaskMetrics.getCachedHostName(_hostname)
    +  }
     }
     
     private[spark] object TaskMetrics {
    +  private val hostNameCache = new ConcurrentHashMap[String, String]()
    --- End diff --
    
    I think the size of the cache will at most be as large as the cluster size, 
so weak ref map may not be so necessary from my understanding.


---
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]

Reply via email to