当前位置:网站首页>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:&#
边栏推荐
- sqli-labs Basic Challenges Less11-22
- RuntimeError: CUDA out of memory(已解决)[通俗易懂]
- 【MySQL必知必会】触发器 | 权限管理
- Can the variable name be in Chinese? Directly fooled people
- Typora cannot open the prompt to install a new version solution
- Gameframework making games (I)
- 软件测试 -- 1 软件测试知识大纲梳理
- Mongodb source code deployment and configuration
- 机械制造业数字化新“引擎”供应链协同管理系统助力企业精细化管理迈上新台阶
- Educational Codeforces Round 132 (Rated for Div. 2) C,D+AC自动机
猜你喜欢

Comprehensive sorting and summary of maskrcnn code structure process of target detection and segmentation

Digital Twins - cognition

如何让一套代码完美适配各种屏幕?

Feiwo technology IPO meeting: annual revenue of 1.13 billion Hunan Cultural Tourism and Yuanli investment are shareholders

安防市场进入万亿时代,安防B2B网上商城平台精准对接深化企业发展路径

Realize a family security and environmental monitoring system (II)

Interpretation of featdepth self-monitoring model for monocular depth estimation (Part 2) -- use of openmmlab framework

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

Alibaba cloud installs mysql5.7

PS making and loading GIF pictures tutorial
随机推荐
Okaleido ecological core equity Oka, all in fusion mining mode
Pytorch training code writing skills, dataloader, Einstein logo
Throwing OutOfMemoryError “Could not allocate JNI Env“
Gateway reports an error service_ UNAVAILABLE
D2. picking carrots (hard version) (one question per day)
Interpretation of featdepth self-monitoring model for monocular depth estimation (Part 2) -- use of openmmlab framework
RuntimeError: CUDA out of memory(已解决)[通俗易懂]
变分(Calculus of variations)的概念及运算规则
Typora无法打开提示安装新版本解决办法
Software testing -- 1. Outline of software testing knowledge
PS制作加载GIF图片教程
Resource not found: rgbd_launch 解决方案
AI model risk assessment Part 1: motivation
结构体大小
基于浏览器的分屏阅读
软件测试 -- 1 软件测试知识大纲梳理
各种平台dpkg包下载地址(包括arm64)
Oka pass rights and interests analysis is the best choice to participate in okaleido ecological construction
【MySQL必知必会】触发器 | 权限管理
Easy entry natural language processing series 12 hidden Markov models