- Mastering Apache Spark 2.x(Second Edition)
- Romeo Kienzler
- 226字
- 2021-07-02 18:55:26
Memory
In order to avoid OOM (Out of Memory) messages for the tasks on your Apache Spark cluster, please consider a number of questions for the tuning:
- Consider the level of physical memory available on your Spark worker nodes. Can it be increased? Check on the memory consumption of operating system processes during high workloads in order to get an idea of free memory. Make sure that the workers have enough memory.
- Consider data partitioning. Can you increase the number of partitions? As a rule of thumb, you should have at least as many partitions as you have available CPU cores on the cluster. Use the repartition function on the RDD API.
- Can you modify the storage fraction and the memory used by the JVM for storage and caching of RDDs? Workers are competing for memory against data storage. Use the Storage page on the Apache Spark user interface to see if this fraction is set to an optimal value. Then update the following properties:
- spark.memory.fraction
- spark.memory.storageFraction
- spark.memory.offHeap.enabled=true
- spark.memory.offHeap.size
In addition, the following two things can be done in order to improve performance:
- Consider using Parquet as a storage format, which is much more storage effective than CSV or JSON
- Consider using the DataFrame/Dataset API instead of the RDD API as it might resolve in more effective executions (more about this in the next three chapters)
推薦閱讀
- JSP網(wǎng)絡(luò)編程(學(xué)習(xí)筆記)
- PHP網(wǎng)絡(luò)編程學(xué)習(xí)筆記
- Mastering AndEngine Game Development
- Learning Selenium Testing Tools(Third Edition)
- C語言程序設(shè)計
- NetBeans IDE 8 Cookbook
- Python全棧數(shù)據(jù)工程師養(yǎng)成攻略(視頻講解版)
- Test-Driven Machine Learning
- Node.js開發(fā)指南
- Simulation for Data Science with R
- Raspberry Pi Blueprints
- 現(xiàn)代C++語言核心特性解析
- Getting Started with the Lazarus IDE
- Raspberry Pi開發(fā)實(shí)戰(zhàn)
- MySQL 5.7從入門到精通(視頻教學(xué)版)(第2版)