Storm Field Grouping

I had the following situation:

  • There are several bolts that calculate different values
  • These values ​​are sent to the render screw.
  • A visual screw opens a web socket and sends values ​​that need to be visualized somehow

The fact is that the visualization bolt is always the same, but it sends a message with a different header for each type of bolt, which may be its input. For example:

  • BoltSum calculates the amount
  • BoltDif calculates the difference
  • BoltMul calculates several

  • All these bolts use VisualizationBolt to render

  • In this case, there are 3 instances of VisualizationBolt

My question is: should I create 3 independent instances where each instance will have one thread, for example.

builder.setBolt("forSum", new VisualizationBolt(),1).globalGrouping("bolt-sum");
builder.setBolt("forDif", new VisualizationBolt(),1).globalGrouping("bolt-dif");
builder.setBolt("forMul", new VisualizationBolt(),1).globalGrouping("bolt-mul");

Or should I do the following

builder.setBolt("forAll", new VisualizationBolt(),3)
.fieldsGrouping("forSum", new Fields("type"))
.fieldsGrouping("forDif", new Fields("type"))
.fieldsGrouping("forMul", new Fields("type"));

, ?

?

, , - , - , - ? ?

, , , , - ?

+3
2

- . fieldsGrouping, , , "sum" "Sum-Visualization-Bolt", sum/diff/mul (.. ).

fieldGrouping : , , .. , .

+3

, (partialKeyGrouping). Storm :

: , , , , . , , , .

, , Graphite fieldsGrouping. .

topologyBuilder.setBolt(MqttSensors.BOLT_SENSOR_TYPE.getValue(), new SensorAggregateValuesWindowBolt().withTumblingWindow(Duration.seconds(5)), 2)
        // .fieldsGrouping(MqttSensors.SPOUT_STATION_01.getValue(), new Fields(MqttSensors.FIELD_SENSOR_TYPE.getValue()))
        // .fieldsGrouping(MqttSensors.SPOUT_STATION_02.getValue(), new Fields(MqttSensors.FIELD_SENSOR_TYPE.getValue()))
        .partialKeyGrouping(MqttSensors.SPOUT_STATION_01.getValue(), new Fields(MqttSensors.FIELD_SENSOR_TYPE.getValue()))
        .partialKeyGrouping(MqttSensors.SPOUT_STATION_02.getValue(), new Fields(MqttSensors.FIELD_SENSOR_TYPE.getValue()))
        .setNumTasks(4) // This will create 4 Bolt instances 
        .addConfiguration(TagSite.SITE.getValue(), TagSite.EDGE.getValue())
        ;

enter image description here

0

Source: https://habr.com/ru/post/1611093/


All Articles