Spark学习笔记(19)Spark Streaming架构设计和运行机制大总结
来源:互联网 发布:永久免费顶级域名 编辑:程序博客网 时间:2024/06/05 15:46
本期内容:
1. Spark Streaming中的架构设计和运行机制
2. Spark Streaming的深度思考
1. Spark Streaming中的架构设计和运行机制
前面讨论过,Spark Streaming就是RDD加上了时间维度。RDD模板是DStream,DAG的模板是DStreamGraph。
但实际上DStream上的操作和RDD上的操作并不是一一对应的。RDD中的一些操作,在DStream里没有。
DStream、DStreamGraph是幻象,只是在时间维度下为RDD的时间周期管理提供方便而已。
这个时间维度,说到底,就是用到了定时器。生成Block,生成Job,都用了定时器。
BlockGenerator中的RecurringTimer是成员blockIntervalTimer 。定时产生Block。
BlockGenerator:
private val blockIntervalTimer =
new RecurringTimer(clock, blockIntervalMs, updateCurrentBuffer, "BlockGenerator")
BlockGenerator.updateCurrentBuffer:
/** Change the buffer to which single records are added to. */
private def updateCurrentBuffer(time: Long): Unit = {
try {
var newBlock: Block = null
synchronized {
if (currentBuffer.nonEmpty) {
val newBlockBuffer = currentBuffer
currentBuffer = new ArrayBuffer[Any]
val blockId = StreamBlockId(receiverId, time - blockIntervalMs)
listener.onGenerateBlock(blockId)
newBlock = new Block(blockId, newBlockBuffer)
}
}
if (newBlock != null) {
blocksForPushing.put(newBlock) // put is blocking when queue is full
}
} catch {
case ie: InterruptedException =>
logInfo("Block updating timer thread was interrupted")
case e: Exception =>
reportError("Error in block updating thread", e)
}
}
定期产生Block。具体流程参考第10课。
JobGenerator中的RecurringTimer是成员timer。
JobGenerator:
private val timer = new RecurringTimer(clock, ssc.graph.batchDuration.milliseconds,
longTime => eventLoop.post(GenerateJobs(new Time(longTime))), "JobGenerator")
定期的发送生成Job的消息。具体流程参考第7课。
2. Spark Streaming的深度思考
Spark Streaming的本质,就是在RRD的基础上,增加了Timer,Timer不断触发,周而复始的产生Block,产生Job,处理数据。
阅读全文
0 0
- Spark学习笔记(19)Spark Streaming架构设计和运行机制大总结
- Spark定制班第19课:Spark Streaming架构设计和运行机制大总结
- 第19课:Spark Streaming架构设计和运行机制大总结
- 第19课:Spark Streaming架构设计和运行机制大总结
- Spark学习笔记(2)解密Spark Streaming运行机制和架构
- Spark学习笔记(22)Spark Streaming架构源码图解
- spark-streaming学习笔记总结
- Spark架构设计和运行机制简述
- spark学习笔记:Spark Streaming
- spark大数据处理技术读书笔记:spark streaming学习笔记
- 大数据Spark企业级实战版【学习笔记】----Spark Streaming
- 大数据Spark企业级实战版【学习笔记】----Spark Streaming
- Spark Streaming学习笔记
- Spark Streaming 学习笔记
- Spark Streaming学习笔记
- Spark学习笔记(一)--Spark架构
- Spark学习笔记(18)Spark Streaming中空RDD处理
- spark学习笔记六:Spark Streaming
- 鸟类链路上的数据报传输标准(A Standard for the Transmission of IP Datagrams on Avian Carriers,IPoAC)
- 模拟键盘自动输入VBS
- 和女友谈谈快餐文化
- Windows DOS builtin命令
- 【leetcode】104,110,111总结
- Spark学习笔记(19)Spark Streaming架构设计和运行机制大总结
- STL中algorithm
- HDU 1247 Hat’s Words(字典树Trie)
- Spark学习笔记(20)Spark Streaming中动态Batch Size实现初探
- 矩阵基础(三)
- 字典树Trie
- Objective-C 和 Swift 语言,哪个更容易学习?
- 51单片机的PWM应用
- BZOJ 1787 & 1832 [Ahoi2008]Meet 紧急集合