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参 ...
随机推荐
- Dedecms getip()的漏洞利用
flyh4t在非安全发布了dedecms getip()的注射漏洞,漏洞本身的成因没什么好说的老掉牙的X-Forwarded-For的问题,我想这个漏洞很多人都找到了,不过这个漏洞的利用有个地方还是可 ...
- XSS跨站脚本测试用例
'><script>alert(document.cookie)</script>='><script>alert(document.cookie)&l ...
- JAMon监控web工程方法的调用性能
JAMon简介 JAMon的全名是:Java Application Monitor.它是一个小巧的,免费的,高性能的,线程安全的性能监测工具. 它可以用来测定系统的性能瓶颈,也可以用来监视用户和应用 ...
- pip install py-stringsimjoin error: INCLUDE environment variable is empty
在用pip install py-stringsimjoin的时候报错error: INCLUDE environment variable is empty,后来在网上搜索下了说是需要下载安装VCF ...
- VScode格式化vue文件
使用vscode编写vue文件的时候, 发现不能格式化,手动格式化代码,太费劲, 还有可能会出错, 不格式化,有的时候代码编写的时候, 没有很好的管理格式,不美观. 但是我们是可以修改让VScode可 ...
- easyUI表头样式
easyUI表头样式 学习了:https://blog.csdn.net/lucasli2016/article/details/53606609 easyUI的样式定义在easyui.css中 表头 ...
- 一种大气简单的Web管理(陈列)版面设计
在页面的设计中,多版面是一种常见的设计样式.本文命名一种 这种样式.能够简单描写叙述为一行top,一列左文件夹,剩余的右下的空间为内容展示区.这种样式,便于高速定位到某项内容或功能. 在主要的HTML ...
- 程序员取悦女票的正确姿势---Tip1(iOS美容篇)
代码地址如下:http://www.demodashi.com/demo/11695.html 前言 女孩子都喜欢用美图工具进行图片美容,近来无事时,特意为某人写了个自定义图片滤镜生成器,安装到手机即 ...
- JSON——JavaScript 中的使用
由于JSON非常简单,很快就风靡Web世界,并且成为ECMA标准.几乎所有编程语言都有解析JSON的库,而在JavaScript中,我们可以直接使用JSON,因为JavaScript内置了JSON的解 ...
- lucene: IO/FileNotFoundException:(Too many open files) 查询异常解决
http://stackoverflow.com/questions/6210348/too-many-open-files-error-on-lucene baidu zone - 为什么Luc ...