如何测量 Spark 上查询的执行时间 [英] How to measure the execution time of a query on Spark
问题描述
我需要在 Apache spark (Bluemix) 上测量查询的执行时间.我试过的:
I need to measure the execution time of query on Apache spark (Bluemix). What I tried:
import time
startTimeQuery = time.clock()
df = sqlContext.sql(query)
df.show()
endTimeQuery = time.clock()
runTimeQuery = endTimeQuery - startTimeQuery
这是一个好方法吗?相对于我看到桌子的时间,我得到的时间看起来太小了.
Is it a good way? The time that I get looks too small relative to when I see the table.
推荐答案
更新:不,使用 time
包不是衡量 Spark 作业执行时间的最佳方法.我所知道的最方便和准确的方法是使用 Spark History Server.
Update:
No, using time
package is not the best way to measure execution time of Spark jobs. The most convenient and exact way I know of is to use the Spark History Server.
在 Bluemix 上,在您的笔记本中,转到右侧的Paelette".选择环境"面板,您将看到一个指向 Spark 历史服务器的链接,您可以在其中调查执行的 Spark 作业,包括计算时间.
On Bluemix, in your notebooks go to the "Paelette" on the right side. Choose the "Evironment" Panel and you will see a link to the Spark History Server, where you can investigate the performed Spark jobs including computation times.
这篇关于如何测量 Spark 上查询的执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!