问题
My topology has a bottleneck or two. The capacity metric in the Storm UI is useful for identifying these, but I'd be much more interested in the size of Bolt's queues.
My understanding is that each bolt has two queues, one for tuples pending to be executed, and another for tuple pending to be emitted. Is it possible to monitor the size of these queues?
I found some stuff online about adding an ITaskHook implementation to Bolts, but it's not remotely clear how I can use this to monitor queue size. Can the methods in ITaskHook be used for to monitor this?
回答1:
You should be able to see the length of the queues for the components of your topology using the metrics mechanism. An easy way of doing is to add conf.registerMetricsConsumer(LoggingMetricsConsumer.class)
to the config of your topology.
Here is an example of what I get for one of my components
4:fetch __sendqueue {write_pos=12122, read_pos=12122, capacity=1024, population=0}
4:fetch __receive {write_pos=8588, read_pos=8587, capacity=1024, population=1}
来源:https://stackoverflow.com/questions/34162410/how-to-monitor-the-size-of-bolts-pending-queues