storm记录--10- Storm消息机制

【Storm】四、Storm程序并发机制、任务提交过程、消息容错机制 大纲: Storm程序的并发机制 Storm任务提交的过程 Storm消息容错机制 1、Storm程序的并发机制 1.1、概念 Workers (JVMs): 在一个物理节点上可以运行一个或多个独立的JVM 进程。一个Topology可以包含一个或多个worker(并行的跑在不同的物理机上), 所以worker process就是执行一个topology的子集, 并且worker只... 阅读详情

这章讨论Storm's reliability capabilities, 如何保证从spout emit出来的所有tuple都被正确的执行(fully processed)?

What does it mean for a message to be "fully processed"?

首先的问题是, 什么叫tuple或message被fully processed? 因为tuple被emit出去后, 可能会被多级bolt处理, 并且bolt也有可能由该tuple生成多组tuples, 所以情况还是比较复杂的     
最终由一个tuple trigger(触发)的所有tuples会形成一个树或DAG(有向无环图)

只有当tuple tree上的所有节点都被成功处理的时候, storm才认为该tuple被fully processed     
如果tuple tree上任一节点失败或者超时, 都被看作该tuple fail, 失败的tuple会被重发      
Storm considers a tuple coming off a spout "fully processed" when the tuple tree has been exhausted and every message in the tree has been processed.     
A tuple is considered failed when its tree of messages fails to be fully processed within a specified timeout.     
This timeout can be configured on a topology-specific basis using the Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS configuration and defaults to 30 seconds.

What happens if a message is fully processed or fails to be fully processed?

该机制是如何实现的?     
首先, 所有tuple都有一个唯一标识msgId, 当tuple被emit的时候确定

_collector.emit(new Values("field1", "field2", 3) , msgId);

其次, 看看下面的ISpout接口, 除了获取tuple的nextTuple    
还有ack和fail, 当Storm detect到tuple被fully processed, 会调用ack, 如果超时或detect fail, 则调用fail    
此处需要注意的是, tuple只有在被产生的那个spout task上可以被ack或fail, 具体原因看后面的实现解释就理解了

a tuple will be acked or failed by the exact same Spout task that created it. So if a Spout is executing as many tasks across the cluster, a tuple won't be acked or failed by a different task than the one that created it.

 public interface ISpout extends Serializable {    void open(Map conf, TopologyContext context, SpoutOutputCollector collector);    void close();    void nextTuple();    void ack(Object msgId);    void fail(Object msgId);}

最后, 在spout怎么实现的, 其实比较简单.    
对于Spout queue, get message只是open而不是pop, 并且把tuple状态改为pending, 防止该tuple被多次发送.    
一直等到该tuple被ack, 才真正的pop该tuple, 当然该tuple如果fail, 就重新把状态改回初始状态    
这也解释, 为什么tuple只能在被emit的spout task被ack或fail, 因为只有这个task的queue里面有该tuple

When KestrelSpout takes a message off the Kestrel queue, it "opens" the message.     
This means the message is not actually taken off the queue yet, but instead placed in a "pending" state waiting for acknowledgement that the message is completed.     
While in the pending state, a message will not be sent to other consumers of the queue. Additionally, if a client disconnects all pending messages for that client are put back on the queue. 

What is Storm's reliability API?

前面一直没有说明的一个问题是, storm本身通过什么机制来判断tuple是否成功被fully processed?

要解决这个问题, 可以分为两个问题,    
1. 如何知道tuple tree的结构?    
2. 如何知道tuple tree上每个节点的运行情况, success或fail?

答案很简单, 你必须告诉它, 如何告诉它?    
1. 对于tuple tree的结构, 需要知道每个tuple由哪些tuple产生, 即tree节点间的link    
   tree节点间的link称为anchoring. 当每次emit新tuple的时候, 必须显式的通过API建立anchoring

Specifying a link in the tuple tree is called anchoring. Anchoring is done at the same time you emit a new tuple.    
Each word tuple is anchored by specifying the input tuple as the first argument to emit.

看下面的代码例子, 

_collector.emit(tuple, new Values(word));

emit的第一个参数是tuple, 这就是用于建anchoring    
当然你也可以直接调用unanchoring的emit版本, 如果不需要保证reliable的话, 这样效率会比较高

_collector.emit(new Values(word));

同时前面说了, 可能一个tuple依赖于多个输入, 

  

An output tuple can be anchored to more than one input tuple.    
This is useful when doing streaming joins or aggregations. A multi-anchored tuple failing to be processed will cause multiple tuples to be replayed from the spouts.

List<Tuple> anchors = new ArrayList<Tuple>();anchors.add(tuple1);anchors.add(tuple2);_collector.emit(anchors, new Values(1, 2, 3));

对于Multi-anchoring的情况会导致tuple tree变为tuple DGA, 当前storm的版本已经可以很好的支持DAG    
Multi-anchoring adds the output tuple into multiple tuple trees.   
Note that it's also possible for multi-anchoring to break the tree structure and create tuple DAGs,

image 

2. 对于tuple tree上每个节点的运行情况, 你需要在每个bolt的逻辑处理完后, 显式的调用OutputCollector的ack和fail来汇报      

This is done by using the ack and fail methods on the OutputCollector.      
You can use the fail method on the OutputCollector to immediately fail the spout tuple at the root of the tuple tree.

看下面的例子, 在execute函数的最后会调用,     
_collector.ack(tuple); 

我比较迷惑, 为啥ack是OutputCollector的function, 而不是tuple的function?    
而且就算ack也是应该对bolt的input进行ack, 为啥是output, 可能因为所有input都是其他bolt的output产生...这个设计的比较不合理

public class SplitSentence extends BaseRichBolt {        OutputCollector _collector;                public void prepare(Map conf, TopologyContext context, OutputCollector collector) {            _collector = collector;        }        public void execute(Tuple tuple) {            String sentence = tuple.getString(0);            for(String word: sentence.split(" ")) {                _collector.emit(tuple, new Values(word));            }            _collector.ack(tuple);        }        public void declareOutputFields(OutputFieldsDeclarer declarer) {            declarer.declare(new Fields("word"));        }            }

storm为了保证reliable, 必然是要牺牲效率的, 此处storm会在task memory里面去记录你汇报的tuple tree的结构和运行情况.     
而只有当某tuple节点被ack或fail后才会被从内存中删除, 所以如果你总是不去ack或fail, 那么会导致task的out of memory

Every tuple you process must be acked or failed. Storm uses memory to track each tuple, so if you don't ack/fail every tuple, the task will eventually run out of memory.

简单的版本, BasicBolt

上面的机制, 会给程序员造成负担, 尤其对于很多简单的case, 比如filter, 每次都要去显式的建立anchoring和ack…

所以storm提供简单的版本, 会自动的建立anchoring, 并在bolt执行完自动调用ack

A lot of bolts follow a common pattern of reading an input tuple, emitting tuples based on it, and then acking the tuple at the end of the execute method. These bolts fall into the categories of filters and simple functions. Storm has an interface called BasicBolt that encapsulates this pattern for you.

public class SplitSentence extends BaseBasicBolt {        public void execute(Tuple tuple, BasicOutputCollector collector) {            String sentence = tuple.getString(0);            for(String word: sentence.split(" ")) {                collector.emit(new Values(word));            }        }        public void declareOutputFields(OutputFieldsDeclarer declarer) {            declarer.declare(new Fields("word"));        }            }

How do I make my applications work correctly given that tuples can be replayed?

问题是如何保证"fully fault-tolerant exactly-once messaging semantics”, 因为replay会导致一个message在bolt上多次出现, 这样对类似计数这样的应用会有很大影响.    
从Storm0.7开始, 给出的transactional topologies功能就比较好的解决这个问题

As always in software design, the answer is "it depends." Storm 0.7.0 introduced the "transactional topologies" feature, which enables you to get fully fault-tolerant exactly-once messaging semantics for most computations. Read more about transactional topologies here. 

How does Storm implement reliability in an efficient way?

现在讨论的是Storm如何实现reliablility机制, Storm实现一组特殊的'acker’ task来track每一个spout tuple, 同时acker task的个数你可以根据tuple的数量来配置

A Storm topology has a set of special "acker" tasks that track the DAG of tuples for every spout tuple.   
When an acker sees that a DAG is complete, it sends a message to the spout task that created the spout tuple to ack the message.   
You can set the number of acker tasks for a topology in the topology configuration using Config.TOPOLOGY_ACKERS. Storm defaults TOPOLOGY_ACKERS to one task -- you will need to increase this number for topologies processing large amounts of messages. 

所有被产生的tuple都会有一个随机的64bit的id用于被track    
tuple之间通过emit时的anchor形成tuple tree, 并且每个tuple都知道产生它的spout tuple的id (通过不断的copy传递)

当任何tuple被acked的时候, 都会send message到相应的acker, 具体例子如下图

When a tuple is created in a topology, whether in a spout or a bolt, it is given a random 64 bit id. These ids are used by ackers to track the tuple DAG for every spout tuple.

Every tuple knows the ids of all the spout tuples for which it exists in their tuple trees. When you emit a new tuple in a bolt, the spout tuple ids from the tuple's anchors are copied into the new tuple. When a tuple is acked, it sends a message to the appropriate acker tasks with information about how the tuple tree changed. In particular it tells the acker "I am now completed within the tree for this spout tuple, and here are the new tuples in the tree that were anchored to me".

For example, if tuples "D" and "E" were created based on tuple "C", here's how the tuple tree changes when "C" is acked:

image 

当然storm具体怎样通过acker task来track所有的tuples, 还需要解决下面几个问题:

1. 当有多个acker的时候, 当一个tuple被acked的时候, 如果知道给哪一个acker发送message?    
因为每个tuple都知道产生它的spout tuple id, 所以使用mod hash(hash方法, m mod n)来分配spout tuple id, 以保证一个spout tuple id所产生的所有tuple tree都会被分配到一个acker上    
当某一个tuple被acked的时候, 只要通过hash找到相应的acker即可

You can have an arbitrary number of acker tasks in a topology. This leads to the following question: when a tuple is acked in the topology, how does it know to which acker task to send that information? Storm uses mod hashing to map a spout tuple id to an acker task. Since every tuple carries with it the spout tuple ids of all the trees they exist within, they know which acker tasks to communicate with. 

2. 如果有多个spout task的时候, storm在最终ack spout tuple的时候, 如何知道对应于哪个spout task, 因为必须在产生tuple的那个spout task进行ack?    
答案很简单, spout task在emit一个新的tuple的时候, 会发message告诉相应的acker它的task id, 所以acker是知道tupleid和taskid的map的

How the acker tasks track which spout tasks are responsible for each spout tuple they're tracking?

When a spout task emits a new tuple, it simply sends a message to the appropriate acker telling it that its task id is responsible for that spout tuple. Then when an acker sees a tree has been completed, it knows to which task id to send the completion message.

3. 如果Acker在内存里面显式的监控所有的tuple tree, 会有扩展问题, 当面对海量tuple或复杂workflow的时候, 很有可能会爆内存, 怎么解决这个问题?    
Storm这里采用了一个特别的方法, 这个是storm的主要的突破之一, 该方法的好处就是对于每个spout tuple, 所需要的内存是固定的无论多复杂, 并且只有about 20 bytes    
Acker只需要为每个spout tuple存储spout tuple id, task id, ack val    
这个ack val, 64 bit number, 用于表示整个tuple tree的状况, 产生方法是tuple tree中所有created和acked的tuple的id进行异或(同为0, 异为1)    
当ack val值为0的时候, 即表示tuple tree被完成

这个思路非常巧妙, 两个相同的数去异或为0, 而created和acked时, 会进行两次异或, 所以所有created的tuple都被acked时, 异或值最终为0    
我考虑到不同的tupleid之间的位有重叠时, 是否会有干扰, 简单的试一下, 没有干扰

具体acker工作原理参考, Twitter Storm源代码分析之acker工作流程

Acker tasks do not track the tree of tuples explicitly. For large tuple trees with tens of thousands of nodes (or more), tracking all the tuple trees could overwhelm the memory used by the ackers. Instead, the ackers take a different strategy that only requires a fixed amount of space per spout tuple (about 20 bytes). This tracking algorithm is the key to how Storm works and is one of its major breakthroughs. An acker task stores a map from a spout tuple id to a pair of values. The first value is the task id that created the spout tuple which is used later on to send completion messages. The second value is a 64 bit number called the "ack val". The ack val is a representation of the state of the entire tuple tree, no matter how big or how small. It is simply the xor of all tuple ids that have been created and/or acked in the tree. When an acker task sees that an "ack val" has become 0, then it knows that the tuple tree is completed.

最后, 考虑task fail的情况,     
一般task fail, 导致超时, spout会replay    
Acker task fail, 会导致它跟踪的所有tuple无法被ack, 所以会全部超时被spout重发    
Spout task fail, 如果spout本身fail, 那么需要源头来负责replay, 比如RabbitMQ或Kafka

Now that you understand the reliability algorithm, let's go over all the failure cases and see how in each case Storm avoids data loss:

  • Task dies: In this case the spout tuple ids at the root of the trees for the failed tuple will time out and be replayed. 

  • Acker task dies: In this case all the spout tuples the acker was tracking will time out and be replayed. 

  • Spout task dies: In this case the source that the spout talks to is responsible for replaying the messages. For example, queues like Kestrel and RabbitMQ will place all pending messages back on the queue when a client disconnects. 

As you have seen, Storm's reliability mechanisms are completely distributed, scalable, and fault-tolerant. 

Tuning reliability

当然reliability必然会给系统带来较大的overload, 比如number of messages就会翻倍, 由于和acker之间的通信    
所以如果不需要reliability, 可以通过下面的方法将其关闭

Acker tasks are lightweight, so you don't need very many of them in a topology. You can track their performance through the Storm UI (component id "__acker"). If the throughput doesn't look right, you'll need to add more acker tasks. 

If reliability isn't important to you -- that is, you don't care about losing tuples in failure situations -- then you can improve performance by not tracking the tuple tree for spout tuples. Not tracking a tuple tree halves the number of messages transferred since normally there's an ack message for every tuple in the tuple tree. Additionally, it requires less ids to be kept in each downstream tuple, reducing bandwidth usage.

There are three ways to remove reliability. 

1. The first is to set Config.TOPOLOGY_ACKERS to 0. In this case, Storm will call the ack method on the spout immediately after the spout emits a tuple. The tuple tree won't be tracked.

2. The second way is to omit a message id in the SpoutOutputCollector.emit method.

3. Finally, emit them as unanchored tuples

【淘宝讲解】

  • Storm记录级容错的基本原理

首先来看一下什么叫做记录级容错?storm允许用户在spout中发射一个新的源tuple时为其指定一个message id, 这个message id可以是任意的object对象。多个源tuple可以共用一个message id,表示这多个源 tuple对用户来说是同一个消息单元。storm中记录级容错的意思是说,storm会告知用户每一个消息单元是否在指定时间内被完全处理了。那什么叫做完全处理呢,就是该message id绑定的源tuple及由该源tuple后续生成的tuple经过了topology中每一个应该到达的bolt的处理。举个例子。在图4-1中,在spout由message 1绑定的tuple1和tuple2经过了bolt1和bolt2的处理生成两个新的tuple,并最终都流向了bolt3。当这个过程完成处理完时,称message 1被完全处理了。
消息传递
图4-1

在storm的topology中有一个系统级组件,叫做acker。这个acker的任务就是追踪从spout中流出来的每一个message id绑定的若干tuple的处理路径,如果在用户设置的最大超时时间内这些tuple没有被完全处理,那么acker就会告知spout该消息处理失败了,相反则会告知spout该消息处理成功了。在刚才的描述中,我们提到了”记录tuple的处理路径”,如果曾经尝试过这么做的同学可以仔细地思考一下这件事的复杂程度。但是storm中却是使用了一种非常巧妙的方法做到了。在说明这个方法之前,我们来复习一个数学定理。

A xor A = 0.

A xor B…xor B xor A = 0,其中每一个操作数出现且仅出现两次。

storm中使用的巧妙方法就是基于这个定理。具体过程是这样的:在spout中系统会为用户指定的message id生成一个对应的64位整数,作为一个root id。root id会传递给acker及后续的bolt作为该消息单元的唯一标识。同时无论是spout还是bolt每次新生成一个tuple的时候,都会赋予该tuple一个64位的整数的id。Spout发射完某个message id对应的源tuple之后,会告知acker自己发射的root id及生成的那些源tuple的id。而bolt呢,每次接受到一个输入tuple处理完之后,也会告知acker自己处理的输入tuple的id及新生成的那些tuple的id。Acker只需要对这些id做一个简单的异或运算,就能判断出该root id对应的消息单元是否处理完成了。下面通过一个图示来说明这个过程。

图4-1 spout中绑定message 1生成了两个源tuple,id分别是0010和1011.

图4-2 bolt1处理tuple 0010时生成了一个新的tuple,id为0110.

图4-3 bolt2处理tuple 1011时生成了一个新的tuple,id为0111.

图4-4 bolt3中接收到tuple 0110和tuple 0111,没有生成新的tuple.

可能有些细心的同学会发现,容错过程存在一个可能出错的地方,那就是,如果生成的tuple id并不是完全各异的,acker可能会在消息单元完全处理完成之前就错误的计算为0。这个错误在理论上的确是存在的,但是在实际中其概率是极低极低的,完全可以忽略。

【acker数量】

针对源码进行分析。


源自:http://www.51studyit.com/html/notes/20140329/46.html

Go-Storm-BoltDB的简单而强大ORM框架 Storm - BoltDB的简单而强大ORM框架 立即下载

相关推荐

深入解析report_timing:从基础参数到高级时序路径分析技巧

本文深入解析了静态时序分析(STA)中`report_timing`命令的核心用法与高级技巧。作为芯片设计的关键诊断工具,它能根据SDC约束精准定位时序路径问题。文章从基础参数过滤讲起,详细介绍了如何通过`-from`、`-through`、`-to`等选项定位关键路径,并深入讲解了`-input_pins`、`-nets`、`-transition_time`等高级选项如何揭示延迟细节,以及`-nworst`、`-slack_lesser_than`等过滤排序技巧,旨在帮助工程师高效解读时序报告,优化设计

h6i7j8的博客 1105

storm学习-Storm消息机制【转】

转自:http://www.51studyit.com/html/notes/20140329/46.html  messaging semantics for most computations. Read more about transactional topologies here.    How does Storm implement reliab

deyu1982的专栏 576

基于PLC的冲压件自动生产线电气系统设计【附数据】

考虑到生产线的高效运行和维护简便性,选择了三菱FX系列的可编程逻辑控制器(PLC)作为核心控制单元,该型号的PLC因其高可靠性和强大的功能集,在工业自动化领域有着广泛的应用。最后,在完成初步的软件开发后,进行了多轮次的模拟测试和现场调试,逐步修正了存在的问题,最终达到了预期的功能要求。例如,对于进料环节,选用了光电传感器以精确检测物料的位置;此外,为了适应不同尺寸的工件加工需求,还特别设计了一套可调节的夹具系统,不仅提高了生产线的灵活性,同时也降低了更换模具的成本。✅ 感恩科研路上每一位志同道合的伙伴!

lagougongzuoshi的博客 1290

Storm容错机制Acker

目录(1)基于tuple树的Acker详解(2)如何开启或者关闭Acker(1)如何开启Acker(2)如何关闭Acker(3)Acker机制的编程模型(4)Storm可靠性实现的设计思想(1)需要实现可靠性的场景(2)可靠性设计 — Acker失败重发编码实现思路(5)Storm可靠性及Acker失败重发编码实现 (1)基于tuple树的Acker详解 Storm中有个特殊的Executor叫acker,他们负责跟踪spout发出的每一个Tuple的Tuple树。当acker发现一个Tuple树 已经处理

蔡政洁的博客 807

【SAP PO】SAP PO 接口配置完整教程之二REST服务对接

SAP PO 接口配置完整教程之二REST服务对接

XLevon的博客 1万+

解决usbisp不识别无法烧录Atmega328P,Arduino不识别问题

如果使用Arduino IDE里面的烧录,可能会遇到一个问题,就是不识别国产这种廉价的USBISP 点击烧录引导程序,会遭遇到找不到USB设备的问题,选哪个都会提示找不到,比如选择USBasp could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp' 因此,我们需要使用到progisp这一个软件的1.72版本 选择好芯片的型号后,调用编译好的HEX文...

arenascat的博客 7436

java storm tick ack_Apache Storm 官方文档 —— Ack 框架的实现

Storm 的 acker 使用哈希校验和来跟踪每个 tuple 树的完成情况:每个 tuple 在被发送出的时候,它的值会与校验和进行异或运算,然后在 tuple 被 ack 的时候这个值又会再次与校验和进行异或运算。这样,一旦所有的 tuple 都被成功 ack,校验和就会变为 0(随机生成的校验和为 0 的概率极小,可以忽略不计)。你可以在 wiki 中了解更多关于可靠性机制的信息。acke...

weixin_39824020的博客 144

高斯泼溅(Gaussian Splatting):3D建模的颠覆性革命

高斯泼溅(Gaussian Splatting):3D建模的颠覆性革命

yingtu666的博客 5149

2021-07-14unity输出信息出现<message truncated>怎么办

unity输出信息出现怎么办 有时候编译Unity项目的时候有错误,查看错误的时候控制台输出,是因为输出信息过长显示不下,于是就被截断了的原因。 这时如果想看完整的错误信息,可以去查找Editor.log来查看日志。、 这个文件在每个系统上的路径不一致,具体如下: Mac osx: ~/Library/Logs/Unity/Editor.log Windows xp: C:\Documents and Settings\username\Local Settings\Application Data_\U

weixin_43322145的博客 3233

保姆级教程:手把手配置MAX9295/9296 GMSL2-CSI2链路,搞定4LAN/1LAN模式与常见调试

本文提供MAX9295/9296 GMSL2-CSI2链路的详细配置教程,涵盖4LAN和1LAN模式的硬件连接、寄存器配置及调试技巧。通过实战案例和代码示例,帮助开发者快速实现高带宽视频传输,解决常见问题如信号同步和功耗优化,适用于车载摄像头和机器人视觉系统开发。

weixin_42561143的博客 434

利用autojs制作抢购支付宝消费劵的手机脚本

前期准备工作 1.打开支付宝,点击中间的抢消费券的广告 2.点击左上角,将抢购页面添加到首页 3.查看支付宝首页是否出现消费劵 . autojs代码 "auto"; functiontaskstart(){ sleep(1000); launchApp('支付宝'); toast("正在打开支付宝应用"); sleep(1000); varxf=textContains("消费").findOne().bounds(); ...

洛阳泰山的博客 1万+

Storm消息可靠处理

        一个消息(tuple)从spout发送出来,可能导致成百上千消息基于此消息创建,这些消息构成一个树状结构,称之为“tuple tree”,如下图:              同时满足了下面两个条件,storm会认为消息被完整的处理了,如果在指定的时间内,一个消息衍生出来的tuple tree未被完全处理成功,则认为消息未被完整处理。这个超时时间可以通过任务参数Config....

专注互联网后端技术 250

RK3588上使用PCIE接口的国产千兆网卡YT6801

YT6801是裕太微电子开发的一款国产千兆PCIE以太网控制器芯片,可作为RK3588的PCIE外扩网口使用。

荻夜的博客 8202

Storm记录--10- Storm消息机制

这章讨论Storm'sreliabilitycapabilities,如何保证从spoutemit出来的所有tuple都被正确的执行(fullyprocessed)?Whatdoesitmeanforamessagetobe"fullyprocessed"?首先的问题是,什么叫tuple或message被fullyprocessed?因为t...

weixin_33751566的博客 128

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

storm消息容错机制

1、Storm 消息容错机制(掌握) 对于每个Spout Tuple保存一个ack-val的校验值,它的初始值为0,然后每发射一个tuple或者ack一个tuple,tuple的id都要跟这个校验值异或一下,并且把得到的值更新为ack-val的新值。   &lt;ROOTID,ACKVALUE&gt; 1.1、总体介绍 在storm中,可靠的信息处理机制是从spout开始的。 一个提供...

qq_25460227的博客 1100

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Storm 可靠性机制深度解析:如何保证消息不丢失

在分布式实时计算系统中,消息丢失是绝对不能接受的。无论是金融交易、电商订单,还是监控告警,数据丢失都可能导致严重的业务问题。Storm 作为实时流处理的鼻祖,设计了一套精巧的可靠性机制,确保在节点故障、网络抖动、处理异常等情况下,消息依然能够被完整处理。本文将深入剖析 Storm 的可靠性机制原理,讲解如何处理消息丢失的各种场景,并通过流程图和代码示例帮助读者构建可靠的实时计算应用。在 Storm 中,可靠性机制指的是系统能够保证从 Spout 发射的每条消息都被完整处理的能力。

✨ 欢迎来到【Seal ^_^ 的优快云博客】!✨ 2894

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Storm Anchoring 机制深度解析:构建可靠消息处理的血缘链

在分布式流处理系统中,一条消息可能会衍生出多条子消息,形成一个复杂的处理树。如何确保整棵"消息树"都被完整处理?Storm 通过Anchoring(锚定)机制,为消息建立了血缘关系,让每个 Tuple 都能追溯其来源,从而实现端到端的可靠性保障。如果把 Acker 比作消息追踪的"监督者",那么 Anchoring 就是建立消息间"父子关系"的血缘链。理解 Anchoring 机制,是掌握 Storm 可靠性设计的核心。Anchoring(锚定)是 Storm 中建立消息血缘关系的机制。

✨ 欢迎来到【Seal ^_^ 的优快云博客】!✨ 2866

Storm Acker 深度解析:消息可靠性保障的核心机制

在分布式实时计算系统中,数据可靠性是一个至关重要的课题。Storm 之所以能够在流处理领域长盛不衰,其强大的消息可靠性保障机制功不可没。而这一机制的核心,就是Acker。如果把 Storm 拓扑比作一个复杂的流水线,那么 Acker 就像是这条流水线上的“质量检查员”——它负责追踪每一个进入系统的消息,确保它们被完整、正确地处理完成。本文将深入剖析 Acker 的工作原理、实现机制以及在保证消息可靠性中的核心作用。Acker。

✨ 欢迎来到【Seal ^_^ 的优快云博客】!✨ 2834

125 Storm 消息容错机制

1.总体介绍 在storm中,可靠的信息处理机制是从spout开始的。 一个提供了可靠的处理机制的spout需要记录他发射出去的tuple,当下游bolt处理tuple或者子tuple失败时spout能够重新发射。 Storm通过调用Spout的nextTuple()发送一个tuple。为实现可靠的消息处理,首先要给每个发出的tuple带上唯一的ID,并且将ID作为参数传递给SoputOutpu...

阿甘兄 480

storm的容错机制

集群容错:1.Nimbus挂掉如果失去了Nimbus节点,Worker也会继续执行;如果workerye消亡,Supervisor会重启worker。但是如果没有Nimbus,worker不会被安排到其他主机节点,客户端也无法提交新的任务。2.zookeeper挂掉zookeeper有主从结构,挂掉无影响。3.Supervisor失败真正执行进程的是worker,所以Supervisor失败不会影...

Dream__Sky_的博客 1251

Storm Anchoring机制:分布式流处理的消息可靠性保障

在分布式流处理系统中,消息可靠性是确保数据处理完整性的关键技术。通过构建消息血缘关系(lineage)和实现精确的状态跟踪,系统能够在节点故障或网络异常时保证数据不丢失。Storm框架的Anchoring机制采用有向无环图(DAG)模型,结合Acker确认器和超时重发机制,形成了完整的可靠性保障体系。这种设计特别适用于金融交易、实时监控等对数据准确性要求高的场景。在实际工程中,合理配置topology.message.timeout.secs等参数,并监控ACK/Fail比例等关键指标,能够有效平衡系统可靠

weixin_30709061的博客 338

Storm消息的可靠性

什么是消息的完整性处理? 一个从 spout 中发送出的 tuple 会产生上千个基于它创建的 tuples。例如,有这样一个 word-count 拓扑:TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("sentences", new KestrelSpout("kestrel.backtype.com", 22

gongrui_59的博客 579

Storm学习笔记 - 消息容错机制

Storm学习笔记 - 消息容错机制 文章来自「随笔」 http://jsynk.cn/blog/articles/153.html 1. Storm消息容错机制概念 一个提供了可靠的处理机制的spout需要记录自己emit(发射)的tuple(消息元祖),当下游bolt处理tuple或者子tuple失败时spout能够重新发射。 Storm通过调用Spout的nextTuple(...

diaoyu6432的博客 110

Storm内部通信以及ack-fail机制

Storm集群架构中各模块进行外部通信,拓扑程序中各个Task进行内部通信。   Bolt跨服务器发送Tuple的时候,需要借助socketServer保持网络连接状态。每个executor都有一个都有一个缓存队列:executor—>nextTuple/execute;每个worker都有输入和输出的管理器,其中管理器要维持socket连接。     输出:Map<ip+port,s...

ThreeAspects的博客 1532

Storm 容错机制深度解析:从故障检测到自动恢复

在分布式系统中,故障是常态,而不是异常。网络抖动、节点宕机、进程崩溃、代码异常……这些故障随时可能发生。Storm 作为实时流处理系统,设计了一套完整的容错机制,确保在各种故障场景下,系统依然能够稳定运行,消息能够被可靠处理。本文将深入剖析 Storm 的容错机制原理,详细讲解当 Spout、Bolt、Worker、Supervisor、Nimbus 等组件失败时会发生什么,以及系统如何自动恢复。Storm 的容错机制覆盖了从进程到节点的多个层次:fill:#333;important;

✨ 欢迎来到【Seal ^_^ 的优快云博客】!✨ 2888
上一篇: storm记录--9- Storm Topology的并发度
下一篇: Java记录 -12- 方法重载与重写
架构师的清醒
博客等级 码龄14年 291粉丝 397原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值