当前位置:网站首页>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:&#
边栏推荐
- The security market has entered a trillion era, and the security B2B online mall platform has been accurately connected to deepen the enterprise development path
- D2. Chopping Carrots (Hard Version) (每日一题)
- 知名手写笔记软件 招 CTO·坐标深圳
- 河源市区推出消防安全主题奶茶 助推夏季火灾防控
- idea正则表达式替换(idea正则搜索)
- 变分(Calculus of variations)的概念及运算规则
- Gateway 网关报错 SERVICE_UNAVAILABLE
- 安防市场进入万亿时代,安防B2B网上商城平台精准对接深化企业发展路径
- 元器件采购系统的主要功能,数字化采购助力元器件企业飞速发展
- [eloquence] negotiation persuasion skills and Strategies
猜你喜欢

That day, I installed a database for my sister... Just help her sort out another shortcut

Products on Apple's official website can save 600 yuan by buying iPhone 13 Pro max at a discount
![[eloquence] negotiation persuasion skills and Strategies](/img/01/0fcbbfcf35a6d166c14ba4215eacac.jpg)
[eloquence] negotiation persuasion skills and Strategies

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 2)

The security market has entered a trillion era, and the security B2B online mall platform has been accurately connected to deepen the enterprise development path

Digital Twins - cognition

基于redis的keys、scan删除ttl为-1的key

Doris learning notes integration with other systems

基于PaddleOCR开发uni-app离线身份证识别插件

Realize a family security and environmental monitoring system (I)
随机推荐
关于ROS2安装connext RMW的进度条卡在13%问题的解决办法
Niuke multi school E G J L
That day, I installed a database for my sister... Just help her sort out another shortcut
bond0脚本
sqli-labs Basic Challenges Less11-22
PHP website design ideas
Thymeleaf setting disabled
软件测试 -- 1 软件测试知识大纲梳理
Initial flask and simple application
Xintang nuc980 set DHCP or static IP
pt100测温电路图(ad590典型的测温电路)
如何让一套代码完美适配各种屏幕?
D2. Chopping Carrots (Hard Version) (每日一题)
Oka pass rights and interests analysis is the best choice to participate in okaleido ecological construction
轻松入门自然语言处理系列 12 隐马尔可夫模型
Jqgrid select all cancel single line click cancel event
国联证券买股票开户安全吗?
Typora无法打开提示安装新版本解决办法
How to make a set of code fit all kinds of screens perfectly?
[cartographer_ros] VIII: Official demo parameter configuration and effect