You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/12/16 22:32:00 UTC

[jira] [Commented] (SPARK-24398) SQLAppStatusListener.aggregateMetrics() invocation is too slow

    [ https://issues.apache.org/jira/browse/SPARK-24398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16722599#comment-16722599 ] 

ASF GitHub Bot commented on SPARK-24398:
----------------------------------------

srowen closed pull request #21438: [SPARK-24398] [SQL] Improve SQLAppStatusListener.aggregateMetrics() too slow
URL: https://github.com/apache/spark/pull/21438
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListener.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListener.scala
index d254af400a7cf..1ef93abbccdff 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListener.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListener.scala
@@ -159,7 +159,7 @@ class SQLAppStatusListener(
   }
 
   private def aggregateMetrics(exec: LiveExecutionData): Map[Long, String] = {
-    val metricIds = exec.metrics.map(_.accumulatorId).sorted
+    val metricIds = exec.metrics.map(_.accumulatorId).toSet
     val metricTypes = exec.metrics.map { m => (m.accumulatorId, m.metricType) }.toMap
     val metrics = exec.stages.toSeq
       .flatMap { stageId => Option(stageMetrics.get(stageId)) }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> SQLAppStatusListener.aggregateMetrics()  invocation is too slow
> ---------------------------------------------------------------
>
>                 Key: SPARK-24398
>                 URL: https://issues.apache.org/jira/browse/SPARK-24398
>             Project: Spark
>          Issue Type: Improvement
>          Components: Web UI
>    Affects Versions: 2.3.0
>            Reporter: furongbin
>            Priority: Major
>
> RROR 18/05/24 14:08:25 AsyncEventQueue: Dropping event from queue appStatus. This likely means one of the listeners is too slow and cannot keep up with the rate at which tasks are being started by the scheduler. [dag-scheduler-event-loop]
> WARN 18/05/24 16:39:54 AsyncEventQueue: Dropped 208205 events from appStatus since Thu May 24 16:30:57 CST 2018. [dag-scheduler-event-loop] 
> WARN 18/05/24 16:40:19 SQLAppStatusListener: agregateMetrics  cost=18.6s, metricIds.size=775, metrics.size=5292940, aggregatedMetrics=615 [pool-22-thread-1]
> private def aggregateMetrics(exec: LiveExecutionData): Map[Long, String] = {
> val metricIds = exec.metrics.map(_.accumulatorId).sorted
> val metricTypes = exec.metrics.map 
> { m => (m.accumulatorId, m.metricType) }
> .toMap
>  val metrics = exec.stages.toSeq
>      .flatMap \{ stageId => Option(stageMetrics.get(stageId)) }
>      .flatMap(_.taskMetrics.values().asScala)
>      .flatMap \{ metrics => metrics.ids.zip(metrics.values) }
> {color:#ff0000}val aggregatedMetrics = (metrics ++ exec.driverAccumUpdates.toSeq){color}
>  {color:#ff0000} .filter \{ case (id, _) => metricIds.contains(id) }{color}
>  .groupBy(_._1)
>  .map
> { case (id, values) =>         id -> SQLMetrics.stringValue(metricTypes(id), values.map(_._2).toSeq) }
> if (exec.metricsValues != null)
> {       exec.metricsValues }
> else
> {     aggregatedMetrics   }
> }
> *Case:*
> when aggregatedMetrics.size=5000000, metrics.size=1000, then the execution({color:#ff0000}val aggregatedMetrics = (metrics ++ exec.driverAccumUpdates.toSeq){color}
>  {color:#ff0000}.filter \{ case (id, _) => metricIds.contains(id) }{color})  is very slow
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org