Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storm Bolts acking but spout is failing

I'm having an odd issue with Apache Storm. I have a KafkaSpout hooked up to a Kafka cluster with 10 messages in it.

The Bolts receive each message and process them correctly because in the Storm UI they are listed as 'acked'. However, the Spout listed under the storm UI says that all of the tuples failed.

I believe this causes the spout to re-emit all of the messages again... So I am seeing a Storm Bolt print out messages 1-10 and then print them out in the same order over and over and over.

I am calling .ack() and .fail() methods appropriately, I just don't know why the Spout would be listing them as failed.

Any thoughts?

like image 800
joshft91 Avatar asked Apr 13 '15 18:04

joshft91


People also ask

What is Storm spout and bolt?

Spout emits the data to one or more bolts. Bolt represents a node in the topology having the smallest processing logic and the output of a bolt can be emitted into another bolt as input. Storm keeps the topology always running, until you kill the topology.

What is spout in storm?

There are just three abstractions in Apache Storm: spouts, bolts, and topologies. A spout is a source of streams in a computation. Typically a spout reads from a queueing broker such as Kestrel, RabbitMQ, or Kafka, but a spout can also generate its own stream or read from somewhere like the Twitter streaming API.

Which of the following method of storm topology is used to emit the generated data through the collector?

nextTuple − Emits the generated data through the collector. close − This method is called when a spout is going to shutdown.


2 Answers

It turns out that a couple bolts downstream were not acking when they finished processing a tuple. This caused the spout tuple to fail and ultimately send the tuple again which resulted in a continuous loop.

like image 86
joshft91 Avatar answered Sep 30 '22 11:09

joshft91


When the spout reads a message, and passes it to the bolts, the message should complete full processing (all relevant bolts) within TOPOLOGY_MESSAGE_TIMEOUT_SECS / "topology.message.timeout.secs"

All relevant bolts must ack, and then the acker indicates to the spout that the message was processed (in case of kafka spout, the spout will then increment the offset).

If you see in the logs SPOUT Failing, perhaps:

  1. One of your bolts failed the message
  2. One of your bolts did not ack
  3. The bolts did not complete handling the message within topology.message.timeout.secs, so an ack was not sent on time.

Example of #3: if you have 5 bolts, each takes about 10 seconds due to db connection issues, so after bolt #3 you will pass the default 30sec storm timeout, and fail to process the message. The spout will then replay this message again.

So either you raise the timeout configuration, or fail faster (for example: shorter db connection timeout), or sometimes lowering the TOPOLOGY_MAX_SPOUT_PENDING can also help in case lots of messages are waiting to be processed, and earlier messages takes long time.

See apache - Guaranteeing Message Processing for more.

like image 42
drordk Avatar answered Sep 30 '22 13:09

drordk