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

    https://github.com/apache/storm/pull/2241#discussion_r129500194
  
    --- Diff: 
storm-client/src/jvm/org/apache/storm/daemon/worker/WorkerState.java ---
    @@ -488,84 +476,55 @@ public void registerCallbacks() {
             LOG.info("Registering IConnectionCallbacks for {}:{}", 
assignmentId, port);
             receiver.registerRecv(new 
DeserializingConnectionCallback(topologyConf,
                 getWorkerTopologyContext(),
    -            this::transferLocal));
    +            this::transferLocalBatch));
         }
     
    -    public void transferLocal(List<AddressedTuple> tupleBatch) {
    -        Map<Integer, List<AddressedTuple>> grouped = new HashMap<>();
    -        for (AddressedTuple tuple : tupleBatch) {
    -            Integer executor = taskToShortExecutor.get(tuple.dest);
    -            if (null == executor) {
    -                LOG.warn("Received invalid messages for unknown tasks. 
Dropping... ");
    -                continue;
    -            }
    -            List<AddressedTuple> current = grouped.get(executor);
    -            if (null == current) {
    -                current = new ArrayList<>();
    -                grouped.put(executor, current);
    -            }
    -            current.add(tuple);
    -        }
     
    -        for (Map.Entry<Integer, List<AddressedTuple>> entry : 
grouped.entrySet()) {
    -            DisruptorQueue queue = 
shortExecutorReceiveQueueMap.get(entry.getKey());
    -            if (null != queue) {
    -                queue.publish(entry.getValue());
    -            } else {
    -                LOG.warn("Received invalid messages for unknown tasks. 
Dropping... ");
    +    private void transferLocalBatch(List<AddressedTuple> tupleBatch) {
    +        try {
    +            for (int i = 0; i < tupleBatch.size(); i++) {
    +                AddressedTuple tuple = tupleBatch.get(i);
    +                JCQueue queue = 
shortExecutorReceiveQueueMap.get(tuple.dest);
    --- End diff --
    
    yes  it did show up as a bottleneck during profiling. I recall trying to 
replace it with an ArrayList... and then backing out as it started getting a 
bit complicated... i think it had something to do with this map getting 
periodically refreshed. Let me take a look at it again.


---
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