我需要一些幫助來了解Spark如何決定分區的數量以及它們在執行器中的處理方式,我很抱歉這個問題,因爲我知道這是一個重複的問題,但即使在閱讀了很多文章之後,我仍然無法理解我正在將我現在正在使用的一個真實生活用例,以及我的spark submit config和cluster config。Apache Spark如何計算分區以及如何在執行器中處理分區
我的硬件配置:
3 Node machine with total Vcores=30 and Total Memory=320 GB.
spark-submit config:
spark-submit \
--verbose \
--master yarn \
--deploy-mode cluster \
--num-executors 1 \
--executor-memory 3g \
--executor-cores 2 \
--conf spark.yarn.maxAppAttempts=1 \
--conf spark.yarn.am.attemptFailuresValidityInterval=1h \
--conf spark.driver.memory=1000m \
--conf spark.speculation=true \
我從MySQL數據庫使用火花數據幀JDBC API閱讀:
val jdbcTable= sqlContext.read.format("jdbc").options(
Map(
"url" -> jdcbUrl,
"driver" -> "net.sourceforge.jtds.jdbc.Driver",
"dbtable" ->
s"(SELECT * FROM SOMETHING WHERE COLUMN > ${lastExtractUnixTime}) as t"))
.load
通過jdbcTable數據框創建的分區的總數爲200
問題:
火花是怎麼產生的
200
分區,這是默認設置嗎?因爲我只有1個執行程序嗎
200
分區是在單個執行程序中並行處理還是一次處理一個分區?executor-cores
是否用於處理每個分區中配置併發的任務,即2(在我的情況下)?