SlideShare a Scribd company logo
1 of 22
Storm




             张侃
          数据部BI
        2012/8/13
目录


•   流式计算
•   Storm构架
•   Storm核心概念
•   实时计算搜索关键词TOPN的例子
什么是流式计算




  计算由数据流推动;计算任务的持续性;公交车PK大火车
Storm结构




• Nimbus和Supervisor通过一个 Zookeeper 集群进行联系
  ,所有的状态信息保存在Zookeeper或者本地磁盘。这意
  味着你能kill -9 Nimbus或者Supervisors,然后它们能像
  什么也没发生一样再次启动起来。这个设计保证了Storm
  集群令人难以置信的稳定。
Why Storm is important

• Extremely broad set of use cases(适用广
  泛)
  storm可以流式地处理消息,更新数据库,
  持续的并行的读,处理,写数据流
• Scalable(可扩展性)
  storm可以处理海量数据,你所需要的只是
  添加机器和增加并行配置。
Why Storm is important

• Guarantees no data loss(保证数据无丢失
  )
  storm可以保证每条消息都被处理,这是
  storm与其他系统(比如S4)最直接的区别。
• Extremely robust(非常健壮)
  尽量减少用户管理storm集群的痛苦,是
  storm项目的目标之一。
Why Storm is important

• Fault-tolerant(容错)
  运算过程中如果出错,storm会从新指派任
  务,除非你杀掉它,运算会一直进行。
• Programming language agnostic(编程语
  言无关)
  storm topology和运算能用任何语言编写。
Storm核心概念

•   Topologies
•   Streams
•   Spouts
•   Bolts
•   Stream groupings
•   Reliability
•   Tasks
•   Workers
Storm核心概念

• Topologies
 实时应用的逻辑是被打包到一个Storm topology
 里的。一个Storm topology和一个MapReduce
 job类似。一个关键的不同点是MapReduce job终
 究是会完成的,而topology会永远运行下去(直
 到你杀掉它)。topology是一个用stream
 groupings联系以来的spouts和bolts图谱。
Storm核心概念

• Streams
 stream是Storm的核心抽象概念。一个stream是一个tuples序列,这
 些tuples被处理和创造与并行分布式的方式。Streams由schema定义
 ,这个schema命名stream的tuples的域。默认的,tuples可以包括
 integers,longs,shorts,bytes,strings,doubles,floats,
 booleans和byte arrays。为了自定义类型可以原生的在tuples里使用
 ,你可以定义你自己的序列化器。
Storm核心概念

• Spouts
 spout是topology数据流的源头。一般来说spouts会从外部
 源读取tuples,并发射它们进入topology.
• Bolts
 topologies的所有处理流程都是在bolts完成的。Bolts可以
 做任何事情,比如过滤,函数实现,聚合,关联,数据库
 交互等等。
Storm核心概念

• Stream groupings
 stream grouping定义了数据流如何划分在不同的bolt任务间。
 Shuffle grouping:tuples随机分发给bolt的tasks,这样每个bolt 确保
 得到均等数量的tuples。
 Fields grouping: 数据流通过grouping里的特定域来划分。
 Global grouping: 整个数据流进入一个单一的bolt task。
Storm核心概念

• Reliability
  Storm保证每个spout的tuple会被topology完全处
  理。它通过跟踪tuples树来实现,每个spout tuple
  都会触发一个树形结构,判断什么时候tuples树
  成功完成。每个topology有一个“消息超时”概念。
  如果Storm失败于检测一个spout tuple在超时时间
  内已经完成,然后它会标记这个tuple失败并稍后
  重试。
Storm核心概念

• Tasks
 每个spout或bolt执行很多tasks在集群上。每个task对应一
 个执行中的线程,stream groupings定义了如何发送从一
 组tasks发送tuples到另一组tasks。你通过
 TopologyBuilder的 setSpout and setBolt方法设置每个
 spout或者bolt的并行数。
• Workers
 Topologies执行一个或者多个worker进程。每个worker进
 程是一个物理的JVM,执行topology所有tasks的一个子集
 。例如,如果topology的合计并行数是300,分配了50个
 workers,每个work将会执行6个tasks(在worker线程内
 )。Storm会尝试平均的传播所有的workers。
实时计算搜索关键词TOPN

         spout    task               emit log




                                Split log,
           task   bolt   task   shuffleGrouping




                                Count keywords,
           task   bolt   task   fieldsGrouping




                                topn keywords,
          bolt    task          globalGrouping
Topology代码




构建整个topology的流程,定义spout和bolt
,bolt和bolt之间数据流的传递方式,每个
component的并行数
SplitLog代码




非Java语言的调用方式:Java通过执行shell命令的
方式起子进程执行Python,需要声明输出域
KeywordCount代码




输出域每个tuple有两个值:keyword,count
KeywordTopN
目前应用

• 移动日志实时PV
参考文档

• Storm git wiki
  https://github.com/nathanmarz/storm/wiki
• My blog
  http://www.coderzhang.com/blog/category/
  big-data/storm/
Q&A




      • 谢谢 

More Related Content

What's hot

互联网分布式系统架构分享-Qcon2011
互联网分布式系统架构分享-Qcon2011互联网分布式系统架构分享-Qcon2011
互联网分布式系统架构分享-Qcon2011Yiwei Ma
 
Jvm那些事
Jvm那些事Jvm那些事
Jvm那些事dynamiclu
 
Jvm内存问题最佳实践
Jvm内存问题最佳实践Jvm内存问题最佳实践
Jvm内存问题最佳实践lovingprince58
 
FtnApp 的缩略图实践
FtnApp 的缩略图实践FtnApp 的缩略图实践
FtnApp 的缩略图实践Frank Xu
 
UC奇趣百科性能优化分享
UC奇趣百科性能优化分享UC奇趣百科性能优化分享
UC奇趣百科性能优化分享linx4200
 
可用空間的管理
可用空間的管理可用空間的管理
可用空間的管理倩怡 賴
 
线程与并发
线程与并发线程与并发
线程与并发Tony Deng
 
Ian .net async programming
Ian .net async programmingIan .net async programming
Ian .net async programmingLearningTech
 
SACC2015 ”互联网+“任重而道远-白金&高春辉
SACC2015 ”互联网+“任重而道远-白金&高春辉SACC2015 ”互联网+“任重而道远-白金&高春辉
SACC2015 ”互联网+“任重而道远-白金&高春辉ptcracker
 
Introduction to storm
Introduction to stormIntroduction to storm
Introduction to stormjulyfirewb
 
Clojure
ClojureClojure
ClojureDi Xu
 
From Java Stream to Java DataFrame
From Java Stream to Java DataFrameFrom Java Stream to Java DataFrame
From Java Stream to Java DataFrameChen-en Lu
 
Golangintro
GolangintroGolangintro
Golangintro理 傅
 
淘宝分布式数据处理实践
淘宝分布式数据处理实践淘宝分布式数据处理实践
淘宝分布式数据处理实践isnull
 

What's hot (14)

互联网分布式系统架构分享-Qcon2011
互联网分布式系统架构分享-Qcon2011互联网分布式系统架构分享-Qcon2011
互联网分布式系统架构分享-Qcon2011
 
Jvm那些事
Jvm那些事Jvm那些事
Jvm那些事
 
Jvm内存问题最佳实践
Jvm内存问题最佳实践Jvm内存问题最佳实践
Jvm内存问题最佳实践
 
FtnApp 的缩略图实践
FtnApp 的缩略图实践FtnApp 的缩略图实践
FtnApp 的缩略图实践
 
UC奇趣百科性能优化分享
UC奇趣百科性能优化分享UC奇趣百科性能优化分享
UC奇趣百科性能优化分享
 
可用空間的管理
可用空間的管理可用空間的管理
可用空間的管理
 
线程与并发
线程与并发线程与并发
线程与并发
 
Ian .net async programming
Ian .net async programmingIan .net async programming
Ian .net async programming
 
SACC2015 ”互联网+“任重而道远-白金&高春辉
SACC2015 ”互联网+“任重而道远-白金&高春辉SACC2015 ”互联网+“任重而道远-白金&高春辉
SACC2015 ”互联网+“任重而道远-白金&高春辉
 
Introduction to storm
Introduction to stormIntroduction to storm
Introduction to storm
 
Clojure
ClojureClojure
Clojure
 
From Java Stream to Java DataFrame
From Java Stream to Java DataFrameFrom Java Stream to Java DataFrame
From Java Stream to Java DataFrame
 
Golangintro
GolangintroGolangintro
Golangintro
 
淘宝分布式数据处理实践
淘宝分布式数据处理实践淘宝分布式数据处理实践
淘宝分布式数据处理实践
 

Viewers also liked

Condensation 4
Condensation 4Condensation 4
Condensation 4MPS
 
Condensation & exchanger industrail temp control
Condensation & exchanger industrail temp controlCondensation & exchanger industrail temp control
Condensation & exchanger industrail temp controlwisdomvalley
 
Boiling heat transfer
Boiling heat transfer Boiling heat transfer
Boiling heat transfer wisdomvalley
 
Condensation (fogs and clouds)
Condensation (fogs and clouds)Condensation (fogs and clouds)
Condensation (fogs and clouds)Geronimo Rosario
 
Boiling & condensation
Boiling & condensationBoiling & condensation
Boiling & condensationziad zohdy
 
Etht grp 13 (140080125017,18,19,20)
Etht grp 13 (140080125017,18,19,20)Etht grp 13 (140080125017,18,19,20)
Etht grp 13 (140080125017,18,19,20)Yash Dobariya
 
Presentation of Refrigeration Simulation
Presentation of Refrigeration SimulationPresentation of Refrigeration Simulation
Presentation of Refrigeration SimulationShafiul Munir
 
Refluxing Condensation Systems (Dephlegmators)
Refluxing Condensation Systems (Dephlegmators)Refluxing Condensation Systems (Dephlegmators)
Refluxing Condensation Systems (Dephlegmators)Gerard B. Hawkins
 
Mathcad Functions for Condensation heat transfer
Mathcad Functions for Condensation heat transferMathcad Functions for Condensation heat transfer
Mathcad Functions for Condensation heat transfertmuliya
 
Boiling and Condensation heat transfer -- EES Functions and Procedures
Boiling and Condensation heat transfer -- EES Functions and ProceduresBoiling and Condensation heat transfer -- EES Functions and Procedures
Boiling and Condensation heat transfer -- EES Functions and Procedurestmuliya
 
Water cycle (worksheet(s))
Water cycle  (worksheet(s))Water cycle  (worksheet(s))
Water cycle (worksheet(s))Moira Whitehouse
 
Forms of Condensation and Precipitation
Forms of Condensation and PrecipitationForms of Condensation and Precipitation
Forms of Condensation and PrecipitationZBTHS
 

Viewers also liked (20)

Condensation 4
Condensation 4Condensation 4
Condensation 4
 
Condensation
CondensationCondensation
Condensation
 
Condensation
CondensationCondensation
Condensation
 
Condensation
CondensationCondensation
Condensation
 
Condensation & exchanger industrail temp control
Condensation & exchanger industrail temp controlCondensation & exchanger industrail temp control
Condensation & exchanger industrail temp control
 
Boiling heat transfer
Boiling heat transfer Boiling heat transfer
Boiling heat transfer
 
condensation
condensationcondensation
condensation
 
Condensation (fogs and clouds)
Condensation (fogs and clouds)Condensation (fogs and clouds)
Condensation (fogs and clouds)
 
Boiling & condensation
Boiling & condensationBoiling & condensation
Boiling & condensation
 
Science 1
Science 1Science 1
Science 1
 
Condensation
CondensationCondensation
Condensation
 
Etht grp 13 (140080125017,18,19,20)
Etht grp 13 (140080125017,18,19,20)Etht grp 13 (140080125017,18,19,20)
Etht grp 13 (140080125017,18,19,20)
 
Water cycle
Water cycleWater cycle
Water cycle
 
Hydrological cycle
Hydrological cycleHydrological cycle
Hydrological cycle
 
Presentation of Refrigeration Simulation
Presentation of Refrigeration SimulationPresentation of Refrigeration Simulation
Presentation of Refrigeration Simulation
 
Refluxing Condensation Systems (Dephlegmators)
Refluxing Condensation Systems (Dephlegmators)Refluxing Condensation Systems (Dephlegmators)
Refluxing Condensation Systems (Dephlegmators)
 
Mathcad Functions for Condensation heat transfer
Mathcad Functions for Condensation heat transferMathcad Functions for Condensation heat transfer
Mathcad Functions for Condensation heat transfer
 
Boiling and Condensation heat transfer -- EES Functions and Procedures
Boiling and Condensation heat transfer -- EES Functions and ProceduresBoiling and Condensation heat transfer -- EES Functions and Procedures
Boiling and Condensation heat transfer -- EES Functions and Procedures
 
Water cycle (worksheet(s))
Water cycle  (worksheet(s))Water cycle  (worksheet(s))
Water cycle (worksheet(s))
 
Forms of Condensation and Precipitation
Forms of Condensation and PrecipitationForms of Condensation and Precipitation
Forms of Condensation and Precipitation
 

Similar to Storm

Random 120515080039-phpapp02
Random 120515080039-phpapp02Random 120515080039-phpapp02
Random 120515080039-phpapp02baiyangfu
 
Times Ten Training
Times Ten TrainingTimes Ten Training
Times Ten TrainingLi Chen
 
IOS入门分享
IOS入门分享IOS入门分享
IOS入门分享zenyuhao
 
Cassandra运维之道(office2003)
Cassandra运维之道(office2003)Cassandra运维之道(office2003)
Cassandra运维之道(office2003)haiyuan ning
 
MySQL自动切换设计与实现
MySQL自动切换设计与实现MySQL自动切换设计与实现
MySQL自动切换设计与实现orczhou
 
主库自动切换 V2.0
主库自动切换 V2.0主库自动切换 V2.0
主库自动切换 V2.0jinqing zhu
 
網站設計100步
網站設計100步網站設計100步
網站設計100步evercislide
 
Java并发编程实践
Java并发编程实践Java并发编程实践
Java并发编程实践sharewind
 
3小时 快速了解postgre sql
3小时 快速了解postgre sql3小时 快速了解postgre sql
3小时 快速了解postgre sqlMichael Fan
 
1, OCP - architecture intro
1, OCP - architecture intro1, OCP - architecture intro
1, OCP - architecture introted-xu
 
4.2第四章 swarm代码剖析 可选补充课程
4.2第四章 swarm代码剖析 可选补充课程4.2第四章 swarm代码剖析 可选补充课程
4.2第四章 swarm代码剖析 可选补充课程zhang shuren
 
高性能队列Fqueue的设计和使用实践
高性能队列Fqueue的设计和使用实践高性能队列Fqueue的设计和使用实践
高性能队列Fqueue的设计和使用实践孙立
 
Node cluster
Node clusterNode cluster
Node clusteraleafs
 
AI/ML-driven closed-loop automation using ONAP - Kate Hsuan
AI/ML-driven closed-loop automation using ONAP - Kate HsuanAI/ML-driven closed-loop automation using ONAP - Kate Hsuan
AI/ML-driven closed-loop automation using ONAP - Kate HsuanHanLing Shen
 
Erlang高级原理和应用
Erlang高级原理和应用Erlang高级原理和应用
Erlang高级原理和应用Feng Yu
 
淘宝主备数据库自动切换
淘宝主备数据库自动切换淘宝主备数据库自动切换
淘宝主备数据库自动切换mysqlops
 
Hadoop学习总结
Hadoop学习总结Hadoop学习总结
Hadoop学习总结ordinary2012
 

Similar to Storm (20)

Random 120515080039-phpapp02
Random 120515080039-phpapp02Random 120515080039-phpapp02
Random 120515080039-phpapp02
 
Storm基础
Storm基础Storm基础
Storm基础
 
Times Ten Training
Times Ten TrainingTimes Ten Training
Times Ten Training
 
IOS入门分享
IOS入门分享IOS入门分享
IOS入门分享
 
Cassandra运维之道(office2003)
Cassandra运维之道(office2003)Cassandra运维之道(office2003)
Cassandra运维之道(office2003)
 
Hadoop ecosystem
Hadoop ecosystemHadoop ecosystem
Hadoop ecosystem
 
MySQL自动切换设计与实现
MySQL自动切换设计与实现MySQL自动切换设计与实现
MySQL自动切换设计与实现
 
主库自动切换 V2.0
主库自动切换 V2.0主库自动切换 V2.0
主库自动切换 V2.0
 
網站設計100步
網站設計100步網站設計100步
網站設計100步
 
Java并发编程实践
Java并发编程实践Java并发编程实践
Java并发编程实践
 
3小时 快速了解postgre sql
3小时 快速了解postgre sql3小时 快速了解postgre sql
3小时 快速了解postgre sql
 
1, OCP - architecture intro
1, OCP - architecture intro1, OCP - architecture intro
1, OCP - architecture intro
 
Tcfsh bootcamp day2
 Tcfsh bootcamp day2 Tcfsh bootcamp day2
Tcfsh bootcamp day2
 
4.2第四章 swarm代码剖析 可选补充课程
4.2第四章 swarm代码剖析 可选补充课程4.2第四章 swarm代码剖析 可选补充课程
4.2第四章 swarm代码剖析 可选补充课程
 
高性能队列Fqueue的设计和使用实践
高性能队列Fqueue的设计和使用实践高性能队列Fqueue的设计和使用实践
高性能队列Fqueue的设计和使用实践
 
Node cluster
Node clusterNode cluster
Node cluster
 
AI/ML-driven closed-loop automation using ONAP - Kate Hsuan
AI/ML-driven closed-loop automation using ONAP - Kate HsuanAI/ML-driven closed-loop automation using ONAP - Kate Hsuan
AI/ML-driven closed-loop automation using ONAP - Kate Hsuan
 
Erlang高级原理和应用
Erlang高级原理和应用Erlang高级原理和应用
Erlang高级原理和应用
 
淘宝主备数据库自动切换
淘宝主备数据库自动切换淘宝主备数据库自动切换
淘宝主备数据库自动切换
 
Hadoop学习总结
Hadoop学习总结Hadoop学习总结
Hadoop学习总结
 

Storm