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

    https://github.com/apache/storm/pull/2241#discussion_r129479281
  
    --- 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 --
    
    Since you are optimizing the critical path, you might want to use an 
ArrayList or array for indexed based lookups than a Map.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to