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

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

上一篇:Twitter 新一代流处理利器——Heron 论文笔记之Storm Limitations

$(function () {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('

    ').addClass('pre-numbering').hide();
    $(this).addClass('has-numbering').parent().append($numbering);
    for (i = 1; i ').text(i));
    };
    $numbering.fadeIn(1700);
    });
    });

Twitter 新一代流处理利器——Heron 论文笔记之Heron架构的更多相关文章

  1. Twitter 新一代流处理工具——Heron 该纸币Storm Limitations

    Twitter 新一代流处理工具--Heron 该纸币Storm Limitations (空格分隔): Streaming-Processing Storm Problems scalability ...

  2. TOP100summit:【分享实录】Twitter 新一代实时计算平台Heron

    本篇文章内容来自2016年TOP100summit Twitter technical lead for Heron Maosong Fu 的案例分享. 编辑:Cynthia Maosong Fu:T ...

  3. Twitter的流处理器系统Heron——升级的storm,可以利用mesos来进行资源调度

    2011年,Twitter发布了开源的分布式流计算系统Storm.四年后,随着用户数量的急剧增加,Twitter每天要处理的事件已经增加到十亿以上.Storm系统应对如此庞大而复杂多样的流数据变得十分 ...

  4. 仿async/await(一)and Gulp:新一代前端构建利器

    NET 4.5的async/await真是个神奇的东西,巧妙异常以致我不禁对其实现充满好奇,但一直难以窥探其门径.不意间读了此篇强文<Asynchronous Programming in C# ...

  5. Person Re-identification 系列论文笔记(一):Scalable Person Re-identification: A Benchmark

    打算整理一个关于Person Re-identification的系列论文笔记,主要记录近年CNN快速发展中的部分有亮点和借鉴意义的论文. 论文笔记流程采用contributions->algo ...

  6. Deep Learning论文笔记之(四)CNN卷积神经网络推导和实现(转)

    Deep Learning论文笔记之(四)CNN卷积神经网络推导和实现 zouxy09@qq.com http://blog.csdn.net/zouxy09          自己平时看了一些论文, ...

  7. 论文笔记之:Visual Tracking with Fully Convolutional Networks

    论文笔记之:Visual Tracking with Fully Convolutional Networks ICCV 2015  CUHK 本文利用 FCN 来做跟踪问题,但开篇就提到并非将其看做 ...

  8. Deep Learning论文笔记之(八)Deep Learning最新综述

    Deep Learning论文笔记之(八)Deep Learning最新综述 zouxy09@qq.com http://blog.csdn.net/zouxy09 自己平时看了一些论文,但老感觉看完 ...

  9. Deep Learning论文笔记之(六)Multi-Stage多级架构分析

    Deep Learning论文笔记之(六)Multi-Stage多级架构分析 zouxy09@qq.com http://blog.csdn.net/zouxy09          自己平时看了一些 ...

随机推荐

  1. 反思java web的发展

    本来网站都是一个个静态HTML的,但很快我们就不满足于这样了.动态网页应运而生.一开始是Servlet.其代码类似于下面这样.主要是Java代码,然后用out一点一点输出HTML代码.当然代码无比丑陋 ...

  2. android 读取txt文件内容

    Android的res文件夹是用来存储资源的,可以在res文件夹下建立一个raw文件夹,放置在raw文件夹下的内容会被原样打包,而不会被编译成二进制文件,并且可以通过R文件进行很方便地访问. 比如我们 ...

  3. mode(思维,注意内存)

    mode Time Limit:1000MS     Memory Limit:1024KB     64bit IO Format:%lld & %llu Submit Status Pra ...

  4. 最少步数(dfs + bfs +bfs优化)

    最少步数 时间限制:3000 ms  |  内存限制:65535 KB 难度:4   描述 这有一个迷宫,有0~8行和0~8列: 1,1,1,1,1,1,1,1,1 1,0,0,1,0,0,1,0,1 ...

  5. Hibernate + MySQL中文乱码问题

    如果持久化的类中有包括了汉字的String对象,那么对应到数据库中汉字的部分就会是乱码.这主要是由于MySQL数据表的字符集与我们当前使用的本地字符集不相同造成的. 如果是windows系统,那么系统 ...

  6. HttpWebResponse请求状态代码

    HttpWebResponse请求状态代码标识 成员名称 说明 Continue 等效于 HTTP 状态 100.Continue指示客户端可能继续其请求. SwitchingProtocols 等效 ...

  7. [caffe]深度学习之图像分类模型AlexNet解读

    在imagenet上的图像分类challenge上Alex提出的alexnet网络结构模型赢得了2012届的冠军.要研究CNN类型DL网络模型在图像分类上的应用,就逃不开研究alexnet.这是CNN ...

  8. barManager.Menu(barSubItem)

    DevExpress 的帮助文档是在太缺乏了,他自己的帮助只有简单描述,没有样例,而它的网站上的在线帮助只有利用它的设计器设计的ToolBar.PopupMenu ,没有利用代码开发的.虽然要利用代码 ...

  9. C#编程打字指法练习

    很惊讶昨晚写的第一篇学习笔记竟然有个评论了,只是今天还是对基础知识提不起精神,还是先看那三本书了解一下程序开发的大概流程吧. 今天不知道怎么闲逛就找到了这个网站,说是专门用于编程练习的,用google ...

  10. log4j是什么

    一.什么是log4jLog4j 是Apache的一个开放源代码项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台.文件.GUI组件.甚至是套接口服务器.NT的事 件记录器.UNIX S ...