Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tune memory for Spark Application running in local mode

Tags:

apache-spark

Running Spark Application with local mode, I used the command, such as:

spark-submit --master local[*] my_spark_application.py

In this case, dose which mean that my application used all memory of my local computer? Are the other parameters, like driver-memory and executor-memory still working?

like image 587
Ivan Lee Avatar asked May 15 '17 03:05

Ivan Lee


People also ask

What happens when Spark code is executed in local mode?

Local Mode is also known as Spark in-process is the default mode of spark. It does not require any resource manager. It runs everything on the same machine. Because of local mode, we are able to simply download spark and run without having to install any resource manager.


2 Answers

Setting driver memory is the only way to increase memory in a local spark application.

"Since you are running Spark in local mode, setting spark.executor.memory won't have any effect, as you have noticed. The reason for this is that the Worker "lives" within the driver JVM process that you start when you start spark-shell and the default memory used for that is 512M. You can increase that by setting spark.driver.memory to something higher, for example 5g" from How to set Apache Spark Executor memory

like image 183
Garren S Avatar answered Oct 21 '22 04:10

Garren S


It depends on which virtual environment tool is used , if you install just spark without virtual environment (like docker) it takes your full your local memory , So , I recommend to use spark inside docker container which it takes about 220MB (default)

First install docker ;

then , Create container ;

install spark into container .

like image 34
Alex Avatar answered Oct 21 '22 04:10

Alex