Return-Path: X-Original-To: apmail-storm-user-archive@minotaur.apache.org Delivered-To: apmail-storm-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DE91210F2D for ; Tue, 11 Feb 2014 22:04:22 +0000 (UTC) Received: (qmail 19604 invoked by uid 500); 11 Feb 2014 22:04:21 -0000 Delivered-To: apmail-storm-user-archive@storm.apache.org Received: (qmail 19576 invoked by uid 500); 11 Feb 2014 22:04:21 -0000 Mailing-List: contact user-help@storm.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@storm.incubator.apache.org Delivered-To: mailing list user@storm.incubator.apache.org Received: (qmail 19568 invoked by uid 99); 11 Feb 2014 22:04:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Feb 2014 22:04:21 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of amocanu@verticalscope.com designates 207.46.163.182 as permitted sender) Received: from [207.46.163.182] (HELO na01-bn1-obe.outbound.protection.outlook.com) (207.46.163.182) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Feb 2014 22:04:17 +0000 Received: from CO2PR07MB522.namprd07.prod.outlook.com (10.141.198.144) by CO2PR07MB524.namprd07.prod.outlook.com (10.141.198.154) with Microsoft SMTP Server (TLS) id 15.0.868.8; Tue, 11 Feb 2014 22:03:52 +0000 Received: from CO2PR07MB522.namprd07.prod.outlook.com ([10.141.198.144]) by CO2PR07MB522.namprd07.prod.outlook.com ([10.141.198.144]) with mapi id 15.00.0868.013; Tue, 11 Feb 2014 22:03:53 +0000 From: Adrian Mocanu To: "user@storm.incubator.apache.org" Subject: RE: How to efficiently store the intermediate result of a bolt, and so it can be replayed after the crashes? Thread-Topic: How to efficiently store the intermediate result of a bolt, and so it can be replayed after the crashes? Thread-Index: AQHPIcpf5ZjUY7ZrFkyhLwzAikAfXpqokTWAgACtOICAAKD2YIAGv76AgAAFygCAAAEg4A== Date: Tue, 11 Feb 2014 22:03:52 +0000 Message-ID: <1279108c9d714c22ae0618126081ef72@CO2PR07MB522.namprd07.prod.outlook.com> References: <545c18be1c664d35877e30423de74118@CO2PR07MB522.namprd07.prod.outlook.com> In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [74.213.184.33] x-forefront-prvs: 0119DC3B5E x-forefront-antispam-report: SFV:NSPM;SFS:(10009001)(189002)(377454003)(129404003)(469094003)(53484002)(53754006)(52044002)(199002)(24454002)(87936001)(76796001)(59766001)(33646001)(77982001)(83322001)(94316002)(95416001)(56816005)(76576001)(2656002)(90146001)(15975445006)(81542001)(16236675002)(80976001)(92566001)(19580405001)(81686001)(19580395003)(83072002)(81816001)(85852003)(76786001)(80022001)(74502001)(19300405004)(94946001)(79102001)(74876001)(63696002)(93136001)(54356001)(56776001)(31966008)(15202345003)(47446002)(66066001)(69226001)(65816001)(74662001)(53806001)(46102001)(76482001)(74316001)(74366001)(51856001)(54316002)(93516002)(85306002)(86362001)(81342001)(87266001)(74706001)(50986001)(95666001)(4396001)(47976001)(49866001)(47736001)(24736002);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB524;H:CO2PR07MB522.namprd07.prod.outlook.com;CLIP:74.213.184.33;FPR:AE0FF215.A0FAD7E1.B7D35DB3.4AE9C98D.206AD;InfoNoRecordsMX:1;A:1;LANG:en; Content-Type: multipart/alternative; boundary="_000_1279108c9d714c22ae0618126081ef72CO2PR07MB522namprd07pro_" MIME-Version: 1.0 X-OriginatorOrg: verticalscope.com X-Virus-Checked: Checked by ClamAV on apache.org --_000_1279108c9d714c22ae0618126081ef72CO2PR07MB522namprd07pro_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable You can have acks from bolt to bolt. Spout: //ties in tuple to this UID _collector.emit(new Values(queue.dequeue(), *uniqueID*) Then Bolt1 will ack the tuple only after it emits it to Bolt2 so that the a= ck can be tied to the tuple Bolt1: //emit first then ack _collector.emit(tuple, new Values("stuff")) //**anchoring** - read below to= see what it means _collector.ack(tuple) At this point tuple from Spout has been acked in Bolt1, but at the same tim= e the newly emitted tuple "stuff" to Bolt2 is "anchored" to the tuple from = Spout. What this means is that it still needs to be acked later on otherwis= e on timeout it will be resent by spout. Bolt2: _collector.ack(tuple) Bolt2 needs to ack the tuple received from Bolt1 which will send in the las= t ack that Spout was waiting for. If at this point Bolt2 emits tuple, then = there must be a Bolt3 which will get it and ack it. If the tuple is not ack= ed at the last point, Spout will time it out and resend it. Each time anchoring is done on an emit statement from bolt to bolt, a new n= ode in a "tree" structure is built... well more like a list in my case sinc= e I never send the same tuple to 2 or more tuples, I have a 1 to 1 relation= ship. All nodes in the tree need to be acked, and only then the tuple is marked a= s fully arrived. If the tuple is not acked and it is sent with a UID and an= chored later on then it will be kept in memory forever (until acked). Hope this helps. From: Tom Brown [mailto:tombrown52@gmail.com] Sent: February-11-14 4:57 PM To: user@storm.incubator.apache.org Subject: Re: How to efficiently store the intermediate result of a bolt, an= d so it can be replayed after the crashes? We use 2 storm topologies, with kafka in between: Kafka --> TopologyA --> = Kafka --> TopologyB --> Final output This allows the two halves of computation to be scaled and maintained indep= endently. --Tom On Tue, Feb 11, 2014 at 2:36 PM, Cheng-Kang Hsieh (Andy) > wrote: Hi Aniket & Andrian, Thank you guys so much for the kind reply! Although the replies don't direc= tly solve my problem, it has been very rewarding following the code of redi= s-storm and Trident. I guess storing the intermediate data in an external db (like Cassandra, as= suggested by Andrian) would work, but what if the Bolt that is supposed to= receive the intermediate data fails? In this case, the emitter is also a B= olt, and does not have the nice ACK mechanism to rely on, so the emitting B= olt might never know when it should resend the data to the receiving Bolt. In other framework like Samza, or Spark Streaming, all the emitted data, no= matter, by a Spout or Bolt is treated as the same way and so benefits from= the same fault tolerance mechanism (they are not as easy to use as Storm t= hough). For example, in Samza, all the data output of a component are push = to a Kafka queue with the receiving components as the listeners (see here). Conceptually maybe a more general solution for Storm is to make a Bolt also= a Spout which can receive ACKs from the receiving Bolts; however it seems = to violate the assumption of Storm? Again I appreciate any advice or suggestion. Thank you! Best, Andy On Fri, Feb 7, 2014 at 9:37 AM, Adrian Mocanu > wrote: Hi Andy, I think you can use Trident to persist the results at any point in your str= eam processing. I believe the way you do that is by using STREAM.persistentAggregate(...) Here's an example from https://github.com/nathanmarz/storm/wiki/Trident-tut= orial TridentTopology topology =3D new TridentTopology(); TridentState wordCounts =3D topology.newStream("spout1", spout) .each(new Fields("sentence"), new Split(), new Fields("word")) .groupBy(new Fields("word")) .persistentAggregate(new MemoryMapState.Factory(), new Count(), new = Fields("count")) .parallelismHint(6); In this case the counts (re[place counts with whatever operations you are d= oing) are stored in a memory map, but you can make another class that saves= this intermediate result to a db... at least that's my understanding... I = am currently also learning these things. I'm currently working on a similar problem and I'm attempting to store into= Cassandra. Feel free to watch my conversation threads (with Svend and Tayl= or Goetz) -A From: Aniket Alhat [mailto:aniket.alhat@gmail.com] Sent: February-06-14 11:57 PM To: user@storm.incubator.apache.org Subject: Re: How to efficiently store the intermediate result of a bolt, an= d so it can be replayed after the crashes? I hope this helps https://github.com/pict2014/storm-redis On Feb 7, 2014 12:07 AM, "Cheng-Kang Hsieh (Andy)" > wrote: Sorry, I realized that question was badly written. Simply put, my question = is that is there a recommended way to store the tuples emitted by a BOLT so= that the tuples can be replayed after crash without repeating the process = all the way up from the source spout? any advice would be appreciated. Than= k you! Best, Andy On Tue, Feb 4, 2014 at 11:58 AM, Cheng-Kang Hsieh (Andy) > wrote: Hi all, First of all, Thank Nathan and all the contributors for pulling out such a great framework! I am learning a lot, even just reading the discussion threads. I am building a topology that contains one spout along with a chain of bolts. (e.g. S -> A -> B, where S is the spout, A, B are bolts.) When S emits a tuple, the next bolt A will buffer the tuple in a DFS, and compute some aggregated values when it has received a sufficient amount of data and then emit the aggregation results to the next bolt B. Here comes my question, is there a recommended way to store the intermediate results emitted by a bolt, so that when machine crashes, the results can be replayed to the downstreaming bolts (i.e. bolt B)? One possible solution could be that: Don't keep any intermediate results, but resort to the storm's ack framework, so that the raw data will be replay from spout S when crash happened. However, this approach might not be appropriate in my case, as it might take pretty long time (like a couple of hours) before bolt A has received all the required data and emit the aggregated results, so that it will be very expensive for ack framework to keep tracking that many tuples for that long. An alternative solution could be: *making bolt A also a spout* and keep the emitted data in a DFS queue. When a result has been acked, the bolt A removes it from the queue. I am wondering if it is reasonable to make a task both bolt and spout at the same time? or if there is any better approach to do so. Thank you! -- Cheng-Kang Hsieh UCLA Computer Science PhD Student M: (310) 990-4297 A: 3770 Keystone Ave. Apt 402, Los Angeles, CA 90034 -- Cheng-Kang Hsieh UCLA Computer Science PhD Student M: (310) 990-4297 A: 3770 Keystone Ave. Apt 402, Los Angeles, CA 90034 -- Cheng-Kang Hsieh UCLA Computer Science PhD Student M: (310) 990-4297 A: 3770 Keystone Ave. Apt 402, Los Angeles, CA 90034 --_000_1279108c9d714c22ae0618126081ef72CO2PR07MB522namprd07pro_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

You can have acks from bo= lt to bolt.

 <= /p>

Spout:

 //ties in tuple to this UID

_collector.emit(new Values(queue.dequeue(), *uniqueID*)

 <= /p>

Then Bolt1 will ack the tuple only after it emits it to Bolt2 so t= hat the ack can be tied to the tuple

Bolt1:

 //emit first then ack

_collector.emit(tuple, new Values("stuff")) //**= anchoring** - read below to see what it means

_collector.ack(tuple)

 <= /p>

At this point tuple from Spout has been acked in Bolt1, but at the= same time the newly emitted tuple "stuff" to Bolt2 is "anch= ored" to the tuple from Spout. What this means is that it still needs to be acked later on otherwise on timeout it will be resent= by spout.

Bolt2:

_collector.ack(tuple)

Bolt2 needs to ack the tuple received from Bolt1 which will send i= n the last ack that Spout was waiting for. If at this point Bolt2 emits tup= le, then there must be a Bolt3 which will get it and ack it. If the tuple is not acked at the last point, Spout= will time it out and resend it.

Each time anchoring is done on an emit statement from bolt to bolt, a new node in a "tree" structu= re is built... well more like a list in my case since I never send the same= tuple to 2 or more tuples, I have a 1 to 1 relationship.

All nodes in the tree need to be acked, and only then the tuple is= marked as fully arrived. If the tuple is not acked and it is sent with a U= ID and anchored later on then it will be kept in memory forever (until acked).

Hope this helps.

 <= /p>

From: Tom Brown [mailto:tombrown52@gmail.com]
Sent: February-11-14 4:57 PM
To: user@storm.incubator.apache.org
Subject: Re: How to efficiently store the intermediate result of a b= olt, and so it can be replayed after the crashes?

 

We use 2 storm topologies, with kafka in between: &n= bsp;Kafka --> TopologyA --> Kafka --> TopologyB --> Final outpu= t

 

This allows the two halves of computation to be scal= ed and maintained independently.

 

--Tom

 

On Tue, Feb 11, 2014 at 2:36 PM, Cheng-Kang Hsieh (A= ndy) <changun@c= s.ucla.edu> wrote:

Hi Aniket & Andrian,

 

Thank you guys so much for the kind reply! Although = the replies don't directly solve my problem, it has been very rewarding fol= lowing the code of redis-storm and Trident. 

 

I guess storing the intermediate data in an external= db (like Cassandra, as suggested by Andrian) would work, but what if the B= olt that is supposed to receive the intermediate data fails? In this case, = the emitter is also a Bolt, and does not have the nice ACK mechanism to rely on, so the emitting Bolt might nev= er know when it should resend the data to the receiving Bolt.

 

In other framework like Samza, or Spark Streaming, a= ll the emitted data, no matter, by a Spout or Bolt is treated as the same w= ay and so benefits from the same fault tolerance mechanism (they are not as= easy to use as Storm though). For example, in Samza, all the data output of a component are push to a Kafka = queue with the receiving components as the listeners (see here). 

 

Conceptually maybe a more general solution for Storm= is to make a Bolt also a Spout which can receive ACKs from the receiving B= olts; however it seems to violate the assumption of Storm?

 

Again I appreciate any advice or suggestion. Thank y= ou!

 

Best,

Andy

 

On Fri, Feb 7, 2014 at 9:37 AM, Adrian Mocanu <amocanu@vertic= alscope.com> wrote:

Hi Andy,

I think you can use Trident to persist = the results at any point in your stream processing.

I believe the way you do that is by usi= ng STREAM.persistentAggregate(…)

 

Here’s an example from https://github.com/nathanmarz/storm/wiki/Trident-tutorial

 

TridentTopology topology =3D new TridentTopology();   &nb= sp;   

TridentState wordCounts =3D

     topology.newStream("spout1", spout)

       .each(new Fields("sentence&quo= t;), new Split(), new Fields("word"))

       .groupBy(new Fields("word"= ;))

       .persistentAggregate(new MemoryMapS= tate.Factory(), new Count(), new Fields("count"))  &nbs= p;            

       .parallelismHint(6);

 

In this case the counts (re[place count= s with whatever operations you are doing) are stored in a memory map, but you can make another class that saves this intermediate re= sult to a db… at least that’s my understanding… I am curr= ently also learning these things.

I’m currently working on a simila= r problem and I’m attempting to store into Cassandra. Feel free to watch my conversation threads (with Svend and Taylor Goetz)=

 

-A

 

From: Aniket Alhat [mailto:aniket.alhat@gmail.com]
Sent: February-06-14 11:57 PM
To: user@storm.incubator.apache.org
Subject: Re: How to efficiently store the intermediate result of a b= olt, and so it can be replayed after the crashes?

 

I hope this helps

ht= tps://github.com/pict2014/storm-redis

On Feb 7, 2014 12:07 AM, "Cheng-Kang Hsieh (Andy)" <<= a href=3D"mailto:changun@cs.ucla.edu" target=3D"_blank">changun@cs.ucla.edu= > wrote:

Sorry, I realized that question was badly written. Simply put, my = question is that is there a recommended way to store the tuples emitted by = a BOLT so that the tuples can be replayed after crash without repeating the process all the way up from the source s= pout? any advice would be appreciated. Thank you!

 

Best,

Andy

 

On Tue, Feb 4, 2014 at 11:58 AM, Cheng-Kang Hsieh (Andy) <changun@cs.ucla.edu= > wrote:

Hi all,

First of all, Thank Nathan and all the contributors for pulling out such a<= br> great framework! I am learning a lot, even just reading the discussion
threads.

I am building a topology that contains one spout along with a chain of
bolts. (e.g. S -> A  -> B, where S is the spout, A, B are bolts.= )

When S emits a tuple, the next bolt A  will buffer the tuple in a DFS,= and
compute some aggregated values when it has received a sufficient amount of<= br> data and then emit the aggregation results to the next bolt B.

Here comes my question, is there a recommended way to store the
intermediate results emitted by a bolt, so that when machine crashes, the results can be replayed to the downstreaming bolts (i.e. bolt B)?

One possible solution could be that: Don't keep any intermediate results, but resort to the storm's ack framework, so that the raw data will be
replay from spout S when crash happened.

However, this approach might not be appropriate in my case, as it might
take pretty long time (like a couple of hours) before bolt A has received all the required data and emit the aggregated results, so that it will be very expensive for ack framework to keep tracking that many tuples for that=
long.

An alternative solution could be: *making bolt A also a spout* and keep the=
emitted data in a DFS queue. When a result has been acked, the bolt A
removes it from the queue.

I am wondering if it is reasonable to make a task both bolt and spout at the same time? or if there is any better approach to do so.

Thank you!

--
Cheng-Kang Hsieh
UCLA Computer Science PhD Student
M: (310) 990-4297
A: 3770 Keystone Ave. Apt 402,
     Los Angeles, CA 90034



 

--
Cheng-Kang Hsieh
UCLA Computer Science PhD Student
M:
(310) 990-4297
A: 3770 Keystone Ave. Apt 402,
     Los Angeles, CA 90034



 

--
Cheng-Kang Hsieh
UCLA Computer Science PhD Student
M:
(310) 990-4297
A: 3770 Keystone Ave. Apt 402,
     Los Angeles, CA 90034

 

--_000_1279108c9d714c22ae0618126081ef72CO2PR07MB522namprd07pro_--