
- #Install apache spark require how much space code#
- #Install apache spark require how much space free#
#Install apache spark require how much space free#
INFO Block rdd_1_3 stored as values in memory (estimated size 16.0 B, free 474.5 MB) (.memory.MemoryStore:54)
#Install apache spark require how much space code#
TextRdd.persist(StorageLevel.MEMORY_ONLY)Īfter the code execution we can find some memory use indicators in the logs: Val fileName = "generated_file_500_mb.txt"įiles.createDirectory(new File(testDirectory).toPath)įpy(getClass.getResourceAsStream(s"/memory_impact/$") Val testDirectory = "/tmp/spark-memory-illustration" appName("Spark memory types").master("local") To generate tested files, go to /src/test/resources/memory_impactĭef sequentialProcessingSession = SparkSession.builder() Let's execute now a small example to see what happens in the log and hence observe which Apache Spark components use memory: A pretty clear example for that is the code doing some extra caching of enrichment data. It's also important to keep in mind that user-defined processing logic also impacts the memory. Hence if a partition is too big to be kept in memory it can lead to Out of memory problems.

We can find it in the log entries similar to:ĭEBUG .TaskMemoryManager Task 6 acquired 5.4 MB for DEBUG or

In this post we'll focus on memory and memory + disk storage. Each of these levels can either be serialized or serialized, and replicated or not. Among the native choices we can find: memory, disk or memory + disk. The storage for cache is defined by the storage level ( .StorageLevel). cache - if given data is reused in different places often it's worth caching it to avoid time consuming recomputation.Apache Spark is not an exception since it requires also some space to run the code and execute some other memory-impacting components as: Every time there is an extra memory overhead because of the framework code and the data processing logic. Very often we think that only dataset size does matter in this operation but it's not true. Apache Spark and memoryĬapacity prevision is one of hardest task in data processing preparation. The sections contain some examples showing Apache Spark behavior given some specific "size" conditions which are files with few very long lines (100MB each). The last section talks about cache feature and its impact on memory.

The second part focuses on one of its use cases - files data processing. The first part of this post gives a general insight about memory use in Apache Spark. It focuses on low-level RDD abstraction and only one of next posts will try to do the same exercises for Dataset and streaming data sources ( DataFrame and file bigger than available memory). This post tends to give some points about Apache Spark behavior when files to process and data to cache are bigger than the available memory.
