Twitter 新一代流处理利器——Heron 论文笔记之Heron架构

简介:

Twitter 新一代流处理利器——Heron 论文笔记之Heron架构

标签(空格分隔): Streaming-process realtime-process


Heron Architecture

Heron 架构例如以下图: 
这里写图片描写叙述

用户编写公布topoloy到Aurora调度器。每个topology都作为一个Aurora的job在执行。每个job包含几个container,这些container由Aurora来分配和调度。第一个container作为Topology Master。其它的Container作为Stream Manager。全部的元数据信息包含谁提交的job,job的执行信息,启动时间等等都会保存在Zookeeper中。 
每个Heron Instance都是用java写的,且都是JVM进程。Heron进程之间用protocol buffers进行通信。

Heron Instance

值得一提的是每个HI都是仅仅跑一个task。即要么是spout要么是bolt。

这样有利于debug。 
这样的设计也为以后数据的复杂性考虑。当以后数据复杂性变高的时候,我们还能够考虑用其它语言来实现HI。

HI的设计有下面两种:

  • 单线程
  • 双线程

Single-threaded approach

主线程有一个TCP channel与本地的SM通信,等待tuple的到来,一旦tuple来了,就会调用用户的逻辑代码来执行,假设须要输出,该线程就会缓存数据,直到达到阈值,然后输出到downstream的SM。

这样的设计简单。可是也有一些缺点,因为某些原因。用户的逻辑可能被block:

  • Invoking the sleep system call for a finite duration of time
  • Using read/write system calls for file or socket I/O
  • Calling thread synchronization primitives

Two-threaded approach

顾名思义。两个thread:Gateway thread 和Task Execution thread,例如以下图:

这里写图片描写叙述

Gateway thread负责数据的输入输出和通信 
Task Execution thread则负责执行用户逻辑代码

Gateway thread要和Task Execution thread要进行数据通信,他们之间通过如上图的三种queue来通信。Gateway thread用data-in往Task Execution thread输入数据。Task Execution thread用data-out往Gateway thread,metrics-out是用Task Execution thread用来收集metric然后往Gateway thread发送。

Toplogy Master

TM(Topology Master)主要负责topology的throughout。在startup的时候,TM把信息存放在Zookeeper上,以便其它进程能够发现TM。所以TM有例如以下两个目的:

  • 阻止多个TM的产生
  • 同意其它属于该topology的进程发现该TM

Topology Backpressure

Heron提供一种背压机制来动态调整数据流动的速率。

这样的机制能够让topology中的各个components以不同speed来跑。也能够动态更改它的speed。

TCP Backpressure

这个策略利用TCP窗体的机制来梳理HI(Heron Instance)和其它Componet的背压。全部的消息都是通过TCP sockets来做通信。假设某个HI处理缓慢。那么它的本地接收buffer就会被装满。在这个HI上游和数据通信的SM也会发现这个然后填满发送的buffer,这样该HI的处理速度就加快了。

Spout backpressure

这个背压策略是和TCP背压策略协同使用的。当SM发现它本地的HI执行慢时。SM就会通知本地的SPout停止读取数据,那么往该Spout发送数据的SM的buffer就会堵塞以致fill up。这是受影响的SM就会发送一条start backpressure的msg到其它与之相连的SM。当其它SM收到该msg时就会告诉他们本地的Spout不再读取数据。当上游缓慢的HI速度赶上来之后,SM再发一个stop backpressure的msg到下游。然后停止backpressure。

当topoloy处于backpressure模式时,它的执行速度取决于最慢的那个HI。

Architecture Features: Summary

  1. First, the provisioning of resources (e.g. for containers and even the Topology Master) is cleanly abstracted from the duties of the cluster manager, thereby allowing Heron to “play nice” with the rest of the (shared) infrastructure.
  2. Second, since each Heron Instance is executing only a single task (e.g. running a spout or bolt), it is easy to debug that instance by simply using tools like jstack and heap dump with that process.
  3. Third, the design makes it transparent as to which component of the topology is failing or slowing down, as the metrics collection is granular, and lets us easily map an issue unambiguously to a specific process in the system.
  4. Fourth, by allowing component-level resource allocation, Heron allows a topology writer to specify exactly the resources for each component, thereby avoiding unnecessary over-provisioning.
  5. Fifth, having a Topology Master per topology allows each topology to be managed independently of each other (and other systems in the underlying cluster). In additional, failure of one topology (which can happen as user-defined code often gets run in the bolts) does not impact the other topologies.
  6. Sixth, the backpressure mechanism allows us to achieve a consistent rate of delivering results, and a precise way to reason about the system. It is also a key mechanism that allows migrating topologies from one set of containers to another (e.g. to an upgraded set of machines).
  7. Finally, we now do not have any single point of failure.

Performance

直接看图吧 
这里写图片描写叙述

这里写图片描写叙述

这里写图片描写叙述

Reference

Twitter Heron: Stream Processing at Scale

如有错误地方还请指正,不胜感激~~






本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/5220868.html,如需转载请自行联系原作者

相关文章
|
2月前
|
监控 负载均衡 Dubbo
|
4月前
|
前端开发 JavaScript 数据库
Flask狼书笔记 | 09_图片社交网站 - 大型项目的架构与需求(2)
9.8 收藏图片 前面已经学习过如何使用关联表来表示多对多关系,缺点是只能表示关系,不能存储数据(如我还想记录下收藏图片的时间戳)。这种情况下,我们可以使用关联模型来表示多对多关系。 在关联模型中,我们将Photo模型与User模型的多对多关系,分离成了User模型和Collect模型的一对多关系,和Photo模型与Collect模型的一对多关系。
66 0
|
2月前
|
存储 传感器 网络协议
《物联网技术》课程笔记——第二章 物联网技术架构
《物联网技术》课程笔记——第二章 物联网技术架构
|
3月前
|
人工智能 自然语言处理 大数据
大模型+知识图谱双驱架构:新一代《知识语义框架SPG》白皮书
白皮书展望了SPG与LLM双向驱动的技术架构。通过基于SPG构建统一的图谱技术框架,可以屏蔽复杂的技术细节以支持新业务的快速部署,真正实现知识图谱技术的框架化、平民化、普惠化。
|
3月前
|
达摩院 Java Apache
惊动“达摩院”的分布式架构笔记:火于互联网,据说来自于清华
一个星期前,一本Java架构笔记突然在互联网上爆火。因为内容的深度和广度,甚至连阿里最牛的研发中心都被惊动了,而且作者一周后直接被阿里挖走后定级P8,据说作者来自于清华。
|
3月前
|
安全 数据挖掘 定位技术
笔记 - 《业务架构解构与实践》
《业务架构解构与实践》的笔记
|
3月前
|
运维 Cloud Native 安全
笔记 - 《阿里云云原生架构实践》
《阿里云云原生架构实践》的笔记
|
3月前
|
NoSQL Java 程序员
阿里开发人员献礼“Java架构成长笔记”,深入内核,拒绝蒙圈
提起阿里,行外人联想到的关键词无非是“交易”、“淘宝”、“支付宝”,但对于程序员来说,阿里庞大的技术体系才是最吸引人的。实际上阿里作为国内一线互联网公司的头把交椅,内部的技术体系和发展都是备受关注的,对于程序员来说,能够进到阿里工作,就是对自己的技术水平进行一个提升和学习。
阿里开发人员献礼“Java架构成长笔记”,深入内核,拒绝蒙圈
|
3月前
|
NoSQL Java 关系型数据库
基于java Swing 和 mysql实现的飞机订票系统(源码+数据库+ppt+ER图+流程图+架构说明+论文+运行视频指导)
基于java Swing 和 mysql实现的飞机订票系统(源码+数据库+ppt+ER图+流程图+架构说明+论文+运行视频指导)
235 0
|
3月前
|
消息中间件 架构师 Java
Java架构速成笔记:七大专题,1425页考点,挑战P8岗
我们都知道,在程序员的职业生涯中,有多个发展方向,不过就数据表明,近年来选择架构师方向的开发人员也越来越多。