Github user mjsax commented on a diff in the pull request: https://github.com/apache/storm/pull/694#discussion_r37800211 --- Diff: storm-core/src/clj/backtype/storm/daemon/executor.clj --- @@ -445,6 +445,32 @@ ret )) +(defn init-batching-buffer [worker-context component-id] + (let [batchSize (.get_batch_size (.getComponentCommon worker-context component-id))] + (if (> batchSize 1) + (let [consumer-ids (flatten (for [cids (vals (.getTargets worker-context component-id))] (keys cids))) + consumer-task-ids (flatten (for [cid consumer-ids :when (not (.startsWith cid "__"))] (into '() (.getComponentTasks worker-context cid))))] + (HashMap. (zipmap consumer-task-ids (repeatedly (count consumer-task-ids) #(Batch. batchSize))))) + (HashMap.) + ))) + +(defn emit-msg [out-task out-tuple overflow-buffer output-batch-buffer transfer-fn] + (let [out-batch (.get output-batch-buffer out-task)] + (if out-batch --- End diff -- Your observation is right for the current state of the code. However, I would like to extend it with the possibility to used different batch sizes for different output streams (including mixed-mode batching/non-batching). Nevertheless, we could have 3 functions: non-batching, batching, mixed-mode. Thus, we could choose the correct function at setup time. The branching overhead is avoided for the both main cases (most times there is only a single output stream).
--- 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. ---