This is the place where I share my ideas.You can also visit me on @CSDN or @oschina.
Give Chapter and Verse and Author for Transshipment, copy or other using. Thanks!
公司A:
1.讲讲你做的过的项目。 项目里有哪些 难点重点注意点呢?
2.讲讲多线程吧, 要是你,你怎么实现一个线程池呢?
3.讲一下Mapreduce或者hdfs的原理和机制。map读取数据分片。
4.shuffle 是什么? 怎么调优?
5.项目用什么语言写? Scala? Scala的特点? 和Java的区别?
6.理论基础怎么样,比如数据结构,里面的快速排序,或者,树? 讲一讲你了解的树的知识?
7.数学怎么样呢?
8.讲一下数据库,SQl ,左外连接, 原理,实现?
13.对调度怎么理解.? 用什么工具吗?
14.用kettle 这种工具还是 自己写程序? 你们公司是怎么做的?
二面。三个人。
1.讲讲你做的项目。
2.平时 对多线程 这方面是怎么处理呢? 异步 是怎么思考呢? 遇到的一些锁啊, 是怎么做的呢? 比如两个人同时操作一样东西。怎么做的呢?一些并发操作设计到一些变量怎么做的呢?
Spark方面:
5.spark开发分两个方面?哪两个方面呢?
公司B:
提交任务。
QQ图片20161019131411.png
用户提交一个任务。 入口是从sc开始的。 sc会去创建一个taskScheduler。根据不同的提交模式, 会根据相应的taskchedulerImpl进行任务调度。
同时会去创建Scheduler和DAGScheduler。DAGScheduler 会根据RDD的宽依赖或者窄依赖,进行阶段的划分。划分好后放入taskset中,交给taskscheduler 。
appclient会到master上注册。首先会去判断数据本地化,尽量选最好的本地化模式去执行。
打散 Executor选择相应的Executor去执行。ExecutorRunner会去创建CoarseGrainerExecutorBackend进程。 通过线程池的方式去执行任务。
反向:
Executor向 SchedulerBackend反向注册
Spark On Yarn模式下。 driver负责计算调度。appmaster 负责资源的申请。
2.Hbase的PUT的一个过程。
3.RDD算子里操作一个外部map比如往里面put数据。然后算子外再遍历map。有什么问题吗。
4.shuffle的过程。调优。
5.5个partition里面分布有12345678910.用算子求最大值或者和。不能用广播变量和累加器。或者sortbykey.
公司W:
http://blog.csdn.net/erfucun/article/details/52275369
/**
* Create an input stream that directly pulls messages from Kafka Brokers
* without using any receiver. This stream can guarantee that each message
* from Kafka is included in transformations exactly once (see points below).
*
* Points to note:
* - No receivers: This stream does not use any receiver. It directly queries Kafka
* - Offsets: This does not use Zookeeper to store offsets. The consumed offsets are tracked
* by the stream itself. For interoperability with Kafka monitoring tools that depend on
* Zookeeper, you have to update Kafka/Zookeeper yourself from the streaming application.
* You can access the offsets used in each batch from the generated RDDs (see
* [[org.apache.spark.streaming.kafka.HasOffsetRanges]]).
* - Failure Recovery: To recover from driver failures, you have to enable checkpointing
* in the [[StreamingContext]]. The information on consumed offset can be
* recovered from the checkpoint. See the programming guide for details (constraints, etc.).
* - End-to-end semantics: This stream ensures that every records is effectively received and
* transformed exactly once, but gives no guarantees on whether the transformed data are
* outputted exactly once. For end-to-end exactly-once semantics, you have to either ensure
* that the output operation is idempotent, or use transactions to output records atomically.
* See the programming guide for more details.
*
* @param ssc StreamingContext object
* @param kafkaParams Kafka <a href="http://kafka.apache.org/documentation.html#configuration">
* configuration parameters</a>. Requires "metadata.broker.list" or "bootstrap.servers"
* to be set with Kafka broker(s) (NOT zookeeper servers) specified in
* host1:port1,host2:port2 form.
* @param fromOffsets Per-topic/partition Kafka offsets defining the (inclusive)
* starting point of the stream
* @param messageHandler Function for translating each message and metadata into the desired type
*/
公司Q
[数澜 Spark]性能调优系列,返回目录请猛戳这里
「数澜·大数据」技术团队荣誉出品
本文目录:
[TOC]
Driver进程
其实就是我们写的Spark作业,打成jar运行起来的主进程。
比如一个1M的map(随机抽取的map) ,创建1000个副本,网络传输!分到1000个机器上,则占用了1G内存。
不必要的网络消耗
,和内存消耗
。
如果你是从哪个表里面读取了一些维度数据,比方说,所有商品的品类的信息,在某个算子函数中使用到100M。
1000个task 。100G的数据,要进行网络传输,集群瞬间性能下降。
如果说,task使用大变量(1M-100M),明知道会导致大量消耗。该怎么做呢?
使用广播变量
:
1.广播变量里面会在Driver有一份初始副本。一个executor 会对应一份blockManager!
2.task在运行的时候,想要使用 广播变量中的数据,此时会首先在本地的Executor对应的BlockManager上 获取,如果没有。 则: blockManager会Driver上拉取map(也有可能从距离比较近的其他节点的Executor的BlockManager上获取!这样效率更高)
ObjectOutputStream/ObjectInputStream 对象输入输入流机制,来进行序列化。
这种默认序列化机制,的好处在于,处理方便,不需要手动做什么事,只要在算子里面使用的变量,实现Serializable接口的,可序列化即可。
但是缺点在于,默认的序列化机制的效率不高,序列化的速度比较慢,序列化以后的数据,占用的内存空间相对还是比较大。
可以手动序列化格式的优化。
Spark支持Kryo序列化机制。Kryo序列化机制,比默认的Java序列化机制,速度要快,序列化的数据要更小。 大概是Java的1/10.
所以减少传输数据,减少内存消耗。
pom.xml报错:Missing artifact jdk.tools:jdk.tools:jar:1.6
添加:
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
Exception in thread "main" java.lang.NullPointerException
at java.lang.ProcessBuilder.start(Unknown Source)
at org.apache.hadoop.util.Shell.runCommand(Shell.java:482)
at org.apache.hadoop.util.Shell.run(Shell.java:455)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:702)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:791)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:774)
at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:646)
at org.apache.hadoop.fs.FilterFileSystem.setPermission(FilterFileSystem.java:472)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:460)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:426)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:906)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:887)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:784)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:365)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:338)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:289)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:1968)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:1937)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:1913)
at com.beifeng.TestCopy.myCopyToLocal(TestCopy.java:44)
at com.beifeng.TestCopy.main(TestCopy.java:15)
//fs.copyToLocalFile(new Path("/hadoop/put/111.txt"), new Path("e:/txt/copyFormHDFS.txt"));
fs.copyToLocalFile(false, new Path("/hadoop/put/111.txt"), new Path("e:/txt/copyFormHDFS.txt"),true);