spark通过合理设置spark.default.parallelism参数提高执行效率
spark中有partition的概念(和slice是同一个概念,在spark1.2中官网已经做出了说明),一般每个partition对应一个task。在我的测试过程中,如果没有设置spark.default.parallelism参数,spark计算出来的partition非常巨大,与我的cores非常不搭。我在两台机器上(8cores *2 +6g * 2)上,spark计算出来的partition达到2.8万个,也就是2.9万个tasks,每个task完成时间都是几毫秒或者零点几毫秒,执行起来非常缓慢。在我尝试设置了 spark.default.parallelism 后,任务数减少到10,执行一次计算过程从minute降到20second。
参数可以通过spark_home/conf/spark-default.conf配置文件设置。
eg.
spark.master spark://master:7077
spark.default.parallelism
spark.driver.memory 2g
spark.serializer org.apache.spark.serializer.KryoSerializer
spark.sql.shuffle.partitions
下面是官网的相关描述:
from:http://spark.apache.org/docs/latest/configuration.html
| Property Name | Default | Meaning |
|---|---|---|
spark.default.parallelism |
For distributed shuffle operations like reduceByKey and join, the largest number of partitions in a parent RDD. For operations likeparallelize with no parent RDDs, it depends on the cluster manager:
|
Default number of partitions in RDDs returned by transformations like join, reduceByKey, and parallelize when not set by user. |
from:http://spark.apache.org/docs/latest/tuning.html
Level of Parallelism
Clusters will not be fully utilized unless you set the level of parallelism for each operation high enough. Spark automatically sets the number of “map” tasks to run on each file according to its size (though you can control it through optional parameters to SparkContext.textFile, etc), and for distributed “reduce” operations, such as groupByKey and reduceByKey, it uses the largest parent RDD’s number of partitions. You can pass the level of parallelism as a second argument (see the spark.PairRDDFunctions documentation), or set the config propertyspark.default.parallelism to change the default. In general, we recommend 2-3 tasks per CPU core in your cluster.
spark通过合理设置spark.default.parallelism参数提高执行效率的更多相关文章
- Eclipse:设置自动补全,提高编程效率
一.设置自动补全 1.进入eclipse的window里的perferences页面 2.找到java->Editor->Content Assist设置界面 3.在Auto activa ...
- spark系列-7、spark调优
官网说明:http://spark.apache.org/docs/2.1.1/tuning.html#data-serialization 一.JVM调优 1.1.Java虚拟机垃圾回收调优的背景 ...
- spark提交命令 spark-submit 的参数 executor-memory、executor-cores、num-executors、spark.default.parallelism分析
转载:https://blog.csdn.net/zimiao552147572/article/details/96482120 nohup spark-submit --master yarn - ...
- spark.sql.shuffle.partitions和spark.default.parallelism的区别
在关于spark任务并行度的设置中,有两个参数我们会经常遇到,spark.sql.shuffle.partitions 和 spark.default.parallelism, 那么这两个参数到底有什 ...
- [Spark]What's the difference between spark.sql.shuffle.partitions and spark.default.parallelism?
From the answer here, spark.sql.shuffle.partitions configures the number of partitions that are used ...
- streaming优化:spark.default.parallelism调整处理并行度
官方是这么说的: Cluster resources can be under-utilized if the number of parallel tasks used in any stage o ...
- 【Spark调优】提交job资源参数调优
[场景] Spark提交作业job的时候要指定该job可以使用的CPU.内存等资源参数,生产环境中,任务资源分配不足会导致该job执行中断.失败等问题,所以对Spark的job资源参数分配调优非常重要 ...
- 【Spark调优】内存模型与参数调优
[Spark内存模型] Spark在一个executor中的内存分为3块:storage内存.execution内存.other内存. 1. storage内存:存储broadcast,cache,p ...
- [spark]-Spark2.x集群搭建与参数详解
在前面的Spark发展历程和基本概念中介绍了Spark的一些基本概念,熟悉了这些基本概念对于集群的搭建是很有必要的.我们可以了解到每个参数配置的作用是什么.这里将详细介绍Spark集群搭建以及xml参 ...
随机推荐
- iOS:二维码的扫描
iOS 中二维码的扫描借用#import <AVFoundation/AVFoundation.h> 实现,会用到<AVCaptureMetadataOutputObjectsDel ...
- 快速打开IIS的方法
方法一: 在运行(win+r)输入inetmgr 方法二: 控制面板\所有控制面板项\管理工具\IIS 建议使用第一种方法
- 利用github和git命令,将本地项目共享到服务器上
一.步骤 1. 创建项目根目录 mkdir 文件夹名 2. 初始化文件夹 git init 3. 配置用户名和邮箱(第一次配置后,不需要再登录) git config user.name 名字 git ...
- springboot集成mybatis-generator
首先上下成功后的效果: 配置非常简单,我们是通过maven插件来进行的,一共只需要3步: 第一步添加mysql依赖和mysql的maven插件: 由于是非常简单的spring+mysql的原始项目,我 ...
- 使用Python发送电子邮件
使用python发送邮件并不难,这里使用的是SMTP协议. Python标准库中内置了smtplib,使用它发送邮件只需提供邮件内容与发送者的凭证即可. 代码如下: # coding:utf-8 im ...
- 再次学习mysql优化
再次学习mysql优化 表的设计规范化(三范式) 添加索引(普通索引.主键索引.唯一索引.全文索引) 分表(水平分割.垂直分割) 读写分离(写add.update.delete) 存储过程 对mysq ...
- selenium从入门到应用 - 7,testNG的DataProvider
本系列所有代码 https://github.com/zhangting85/simpleWebtest 本文将介绍一个Java+TestNG+Maven+Selenium的web自动化测试脚本环境下 ...
- iOS学习笔记23-音效与音乐
一.音频 在iOS中,音频播放从形式上能够分为音效播放和音乐播放. * 音效: * 主要指一些短音频的播放,这类音频一般不须要进行进度.循环等控制. * 在iOS中.音效我们是使用AudioToolb ...
- Docker 方式运行 jenkins
原文地址:https://testerhome.com/topics/5798 简介说明 docker 是官方推荐的一种 jenkins 启动方式. 打开 jenkins 的官网,点击进入的是: ht ...
- jQuery 实现观察者模式
github: https://github.com/mmikowski/jquery.event.gevent demo: $('body').append( "<div id='s ...