Parallelism , Partitioner
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.default.parallelism 10
spark.driver.memory 2g
spark.serializer org.apache.spark.serializer.KryoSerializer
spark.sql.shuffle.partitions 50
下面是官网的相关描述:
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.
原文地址:http://www.cnblogs.com/wrencai/p/4231966.html
Parallelism , Partitioner的更多相关文章
- Concurrency != Parallelism
前段时间在公司给大家分享GO语言的一些特性,然后讲到了并发概念,大家表示很迷茫,然后分享过程中我拿来了Rob Pike大神的Slides <Concurrency is not Parallel ...
- Hadoop学习笔记—9.Partitioner与自定义Partitioner
一.初步探索Partitioner 1.1 再次回顾Map阶段五大步骤 在第四篇博文<初识MapReduce>中,我们认识了MapReduce的八大步凑,其中在Map阶段总共五个步骤,如下 ...
- parallelism
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION Traditionally, the co ...
- Concurrency vs. Parallelism
http://getakka.net/docs/concepts/terminology Terminology and Concepts In this chapter we attempt to ...
- Max Degree of Parallelism最大并行度配置
由于公司的业务在急速增长中,发现数据库服务器已经基本撑不住这么多并发.一方面,要求开发人员调整并发架构,利用缓存减少查询.一方面从数据库方面改善并发.数据库的并行度可设置如下: 1)cost thre ...
- MapReduce中的分区方法Partitioner
在进行MapReduce计算时,有时候需要把最终的输出数据分到不同的文件中,比如按照省份划分的话,需要把同一省份的数据放到一个文件中:按照性别划分的话,需要把同一性别的数据放到一个文件中.我们知道最终 ...
- Spark自定义分区(Partitioner)
我们都知道Spark内部提供了HashPartitioner和RangePartitioner两种分区策略,这两种分区策略在很多情况下都适合我们的场景.但是有些情况下,Spark内部不能符合咱们的需求 ...
- MapReduce框架Partitioner分区方法
前言:对于二次排序相信大家也是似懂非懂,我也是一样,对其中的很多方法都不理解诶,所有只有暂时放在一边,当你接触到其他的函数,你知道的越多时你对二次排序的理解也就更深入了,同时建议大家对wordcoun ...
- Partitioner没有被调用的情况
map的输出,通过分区函数决定要发往哪个reducer. 有2种情况,我们自定义的Partitioner不会被调用 1) reducer个数为0 这种情况,没有reducer,不需要分区 2) red ...
随机推荐
- Android -- Messenger与Service
如果你需要你的service和其他进程通信,那么你可以使用一个Messenger来提供这个接口. 这种方法允许你在不使用 AIDL的情况下,进行跨进程通信IPC. 实现步骤 下面是一个如何使用 Mes ...
- 使用Intellij加载Spark源代码
如何使用Intellij加载Spark源代码 转载注明原文http://www.cnblogs.com/shenh062326/p/6189643.html 查看Spark源代码或修改Spark源代码 ...
- windows 7 64bit安装apche php
http://windows.php.net/download#php-5.6-ts-VC11-x64http://www.apachehaus.com/cgi-bin/download.plx 下载 ...
- (回溯法)数组中和为S的N个数
Given a list of numbers, find the number of tuples of size N that add to S. for example in the list ...
- CSS中:before和:after选择器的用法
在线演示这次给大家带来的是对话气泡效果,主要是演示了 :before / :after 和 border 的用法,赶快来围观吧. 阅读原文:CSS中:before和:after选择器的用法
- xcode的svn和git使用方法
1.创建版本库:(参考:http://blog.csdn.net/itianyi/article/details/8601183) 方法:直接在windows服务器安装VisualSVN Server ...
- Asp.Net Web Api 图片上传
public string UploadFile() { if (Request.Content.IsMimeMultipartContent()) ...
- SQLSERVER中的 CEILING函数和 FLOOR函数
SQLSERVER中的 CEILING函数和 FLOOR函数 --SQLSERVER中的 CEILING函数和 FLOOR函数 --ceiling函数返回大于或等于所给数字表达式的最小整数. --fl ...
- Docker实战(五)编写Dockerfile
一.创建Dockerfile文件 首先,需要创建一个目录来存放 Dockerfile 文件,目录名称可以任意,在目录里创建Dockerfile文件: 二.Dockerfile 基本框架 Dockerf ...
- C#DirectX播放视频
文章地址:http://www.cnblogs.com/zhangjun1130/archive/2009/09/15/1566814.html 很多人第一次接触到DirectX大都是通过游戏,至于安 ...