I know how to set executor memory beforehand that while spark submit through --executor-memory
and also to setup in config file using spark.executor.memory
. But my question how to set executor memory while executing a spark-scala application during run time.
Using the spark session getOrCreate like in this link => https://spark.apache.org/docs/2.4.0/api/scala/#org.apache.spark.sql.SparkSession
Ex :
SparkSession.builder
.master("...")
.appName("Word Count")
.config("spark.executor.memory", "2g")
.getOrCreate()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.