Github user satishd commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1199#discussion_r55857918
  
    --- Diff: storm-core/src/jvm/org/apache/storm/trident/Stream.java ---
    @@ -124,6 +124,31 @@ public Stream parallelismHint(int hint) {
         }
     
         /**
    +     * Sets the CPU Load resource for the current node
    +     */
    +    public Stream setCPULoad(Number load) {
    --- End diff --
    
    It is better to have these configs to be set at respective operation level 
in a stream with intuitive API than setting at topology level. Below API is 
suggested which may look more verbose than setXXXLoad method but it clearly 
conveys what it is for.   
    But we should not have API for this configuration at topology level as it 
requires to name these operations and use those names with load configs in 
topology looks to be clunky. 
    
    ``` java
    TridentTopology topo = new TridentTopology();
    TridentState wordCounts = 
        topology.newStream("spout1", spout)
            .withLoadConfig(new LoadConfigBuilder().
                            .withCPULoad(50)
                            .withMemoryLoad(1024).build())
            .each(new Fields("sentence"), new Split(), new Fields("word"))
             .withLoadConfig(new LoadConfigBuilder().
                            .withCPULoad(20)
                            .withMemoryLoad(256).build())
            .groupBy(new Fields("word"))
            .persistentAggregate(new MemorymapState.Factory(), new Count(), new 
Fields("count"))
            .parallelismHint(6);
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to