当前位置:网站首页>Spark 参数配置的几种方法
Spark 参数配置的几种方法
2022-07-25 14:30:00 【格格巫 MMQ!!】
1.Spark 属性
Spark应用程序的运行是通过外部参数来控制的,参数的设置正确与否,好与坏会直接影响应用程序的性能,也就影响我们整个集群的性能。参数控制有以下方式:
(1)直接设置在SparkConf,通过参数的形式传递给SparkContext,达到控制目的。(通过set()方法传入key-value对)比如:
val conf = new SparkConf()
.setMaster(”local[2]“) #注意1
.setAppName(”test“)
.set(“spark.cores.max”, “10”) ######set()方法传入属性参数
val sc = new SparkContext(conf)
#注意1 本地开启2个线程来工作,注意了,本地工作方式除了集合生成RDD、读取本地文件和hdfs文件能开启一个线程就可以工作外,其他情况都开启至少两条线程才能正常工作。这是由于除以上情况,Spark会开启一个reciver来接受数据,若只有一条线程,reciver就占用唯一线程的资源,而数据处理等操作将没有资源可执行。
(2)动态加载Spark属性。为了应用程序名字和集群方式等属性不硬编码,灵活应用。可以这样处理:val sc = new SparkContext(new SparkConf())。通过 spark-submit 时添加必要的参数。如:
./bin/spark-submit --name “My app” --master local[4] --conf spark.eventLog.enabled=false
–conf “spark.executor.extraJavaOptions=-XX:&#
边栏推荐
- QObject source code analysis -d pointer and Q pointer
- Gateway 网关报错 SERVICE_UNAVAILABLE
- 实现一个家庭安防与环境监测系统(二)
- Software testing -- 1. Outline of software testing knowledge
- Two Sum
- 基于redis的keys、scan删除ttl为-1的key
- 河源市区推出消防安全主题奶茶 助推夏季火灾防控
- Matplotlib data visualization three minutes entry, half an hour enchanted?
- Doris学习笔记之与其他系统集成
- How to make a set of code fit all kinds of screens perfectly?
猜你喜欢
随机推荐
Paddlenlp's UIE relationship extraction model [executive relationship extraction as an example]
SSM framework integration, simple case
Gateway 网关报错 SERVICE_UNAVAILABLE
OverTheWire-Natas
Pytorch training code writing skills, dataloader, Einstein logo
That day, I installed a database for my sister... Just help her sort out another shortcut
Matplotlib data visualization three minutes entry, half an hour enchanted?
如何让一套代码完美适配各种屏幕?
Idea error failed to determine a suitable driver class
C language and SQL Server database technology
河源市区推出消防安全主题奶茶 助推夏季火灾防控
The main function of component procurement system, digital procurement helps component enterprises develop rapidly
Ten common application scenarios of redis
thymeleaf通过样式控制display是否显示
RuntimeError: CUDA out of memory(已解决)[通俗易懂]
如何设计一个高并发系统?
IDEA设置提交SVN时忽略文件配置
Typora cannot open the prompt to install a new version solution
From fish eye to look around to multi task King bombing -- a review of Valeo's classic articles on visual depth estimation (from fisheyedistancenet to omnidet) (Part I)
jqgrid全选取消单行点击取消事件









