Spark 中的 executorRunTime 由啥组成?

Posted

技术标签:

【中文标题】Spark 中的 executorRunTime 由啥组成?【英文标题】:What does executorRunTime consist of in Spark?Spark 中的 executorRunTime 由什么组成? 【发布时间】:2019-03-12 14:27:26 【问题描述】:

目前正在研究 Spark,我通过自定义 Spark 侦听器 API 收集了一些性能指标用于分析目的。我试图制作一个堆积条形图,显示执行器通过执行任务、洗牌或垃圾收集暂停的时间百分比,用于三种不同的机器学习算法。 这是我发现的截图:

情节出现后立即引起我注意的是利率是错误的。可以看到,kmeans 算法的值超过 1,感知器的值小于 0.8。

这是我计算费率的方法:

execution['cpuRate'] = execution['executorCpuTime'] / execution['executorRunTime']
execution['serRate'] = execution['resultSerializationTime'] / execution['executorRunTime']
execution['gcRate'] = execution['jvmGCTime'] / execution['executorRunTime']
execution['shuffleFetchRate'] = execution['shuffleFetchWaitTime'] / execution['executorRunTime']
execution['shuffleWriteRate'] = execution['shuffleWriteTime'] / execution['executorRunTime']

execution = execution[['cpuRate', 'serRate', 'gcRate', 'shuffleFetchRate', 'shuffleWriteRate']]

execution.plot.bar(stacked=True)

我使用 Pandas 库,执行是包含平均指标的数据框。 当然,我的假设是 executorRunTime 是底层其他指标的总和,但事实证明它是错误的。

这些时间的含义是什么,它们之间的关系如何?我的意思是:如果不是上面指定的所有其他指标,那么 executorRunTime 包含什么?

谢谢

【问题讨论】:

【参考方案1】:

根据TaskMetrics.scala:

  * Time the executor spends actually running the task (including fetching shuffle data).
  */
def executorRunTime: Long = _executorRunTime.sum

以毫秒为单位。

【讨论】:

以上是关于Spark 中的 executorRunTime 由啥组成?的主要内容,如果未能解决你的问题,请参考以下文章

Spark 2.0:绝对 URI 中的相对路径(spark-warehouse)

python [Spark中的简单时间戳聚合] #spark

使用 Spark 中的共享变量

Spark RDD在Spark中的地位和作用如何?

Spark RDD在Spark中的地位和作用如何?

Spark 中的任务是啥? Spark worker 是如何执行 jar 文件的?