GitHub user zsxwing opened a pull request: https://github.com/apache/spark/pull/18177
[SPARK-20955][Core]Intern "executorId" to reduce the memory usage ## What changes were proposed in this pull request? In [this line](https://github.com/apache/spark/blob/f7cf2096fdecb8edab61c8973c07c6fc877ee32d/core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala#L128), it uses the `executorId` string received from executors and finally it will go into `TaskUIData`. As deserializing the `executorId` string will always create a new instance, we have a lot of duplicated string instances. This PR does a String interning for TaskUIData to reduce the memory usage. ## How was this patch tested? Manually test. Test codes: ``` for (_ <- 1 to 10) { sc.makeRDD(1 to 1000, 1000).count() } Thread.sleep(2000) val l = sc.getClass.getMethod("jobProgressListener").invoke(sc).asInstanceOf[org.apache.spark.ui.jobs.JobProgressListener] org.apache.spark.util.SizeEstimator.estimate(l.stageIdToData) ``` This PR reduces the size of `stageIdToData` from 3487280 to 3009744 (86.3%) in the above case. You can merge this pull request into a Git repository by running: $ git pull https://github.com/zsxwing/spark SPARK-20955 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/18177.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #18177 ---- commit 38a4e31d6c9ed3d2b459737553144f0fae5b0934 Author: Shixiong Zhu <shixi...@databricks.com> Date: 2017-06-01T19:33:58Z Intern "executorId" to reduce the memory usage ---- --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org