Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Response Packet Handler cleanup #4430

Merged

Conversation

pveentjer
Copy link
Contributor

Renamed BacicResponseHandler to BasicPacketResponseHandler to prevent name confusing since we already have ResponseHandler for different purpose.

BasicOperationScheduler ResponseThread is now explicitly making use of Packet; code was too generic for no reason. The queue was for packets, but there was still an unwanted check done for non packets from that queue.

… name confusing since we already have ResponseHandler for different purpose.

BasicOperationScheduler is now explicitly making use of Packet; code was too generic for no reason.
@pveentjer pveentjer added this to the 3.5 milestone Jan 18, 2015
@gurbuzali
Copy link
Contributor

👍

@sancar
Copy link
Contributor

sancar commented Jan 19, 2015

My comments are not related to this pr but rather more general concern.

This ResponseThread seems awkward. Its process method is called directly. The thread itself waiting on a workingQueue that nobody putting anything into. It seems that packet deserialization is done in IO thread. Are we ok with these?

@pveentjer
Copy link
Contributor Author

Hi Sancar.

I don't think that the the case. The IO thread takes a packet of the wire, checks if response+operation bit are set, and puts it on the queue of the response-thread. Then the response-thread takes it of the queue, deserializes it and then processes it.

So the IO thread is not doing any heavy lifting.

@pveentjer
Copy link
Contributor Author

PS: I'm still working on getting rid of the response thread. I have made several attempts but tilll so far have not been able to improve performance.

@sancar
Copy link
Contributor

sancar commented Jan 20, 2015

Yes, the scenario that you mentioned what should have been. But I am afraid it is not the case. Just take a close look of workQueue of ResponseThread. I checked usages of workqueue, there is "take" method called on it, but nothing is pushing into it.

@pveentjer
Copy link
Contributor Author

    public void execute(Packet packet) {
        try {
            if (packet.isHeaderSet(Packet.HEADER_RESPONSE)) {
                //it is an response packet.
                responseThread.process(packet);
            } else {
                //it is an must be an operation packet
                int partitionId = packet.getPartitionId();
                boolean hasPriority = packet.isUrgent();
                execute(packet, partitionId, hasPriority);
            }
        } catch (RejectedExecutionException e) {
            if (node.nodeEngine.isActive()) {
                throw e;
            }
        }
    }
``

@sancar
Copy link
Contributor

sancar commented Jan 20, 2015

Yes, the process is directly called, rather than putting into queue. Isnt that wrong? or am I missing something big? or You need coffee again?

@pveentjer
Copy link
Contributor Author

It is an optimization we have been playing with, but it should never have made it in the master. I see I'm the cause of this change. The only way to get rid of the response queue is to get rid of the response object because they are now being deserialized on the IO thread.

@pveentjer
Copy link
Contributor Author

Good spotting. I'll revert to changes in a different PR and see what the performance implications are. I'll do a bit more investigation what happened.

@pveentjer
Copy link
Contributor Author

#4453

@pveentjer
Copy link
Contributor Author

@gurbuzali @sancar can you have another look?

@sancar
Copy link
Contributor

sancar commented Jan 26, 2015

👍

gurbuzali pushed a commit that referenced this pull request Jan 26, 2015
…andler

Minor Response Packet Handler cleanup
@gurbuzali gurbuzali merged commit 711d7e4 into hazelcast:master Jan 26, 2015
@pveentjer pveentjer deleted the cleanup/3.x/packet-response-handler branch January 26, 2015 11:42
@mmedenjak mmedenjak added the Source: Internal PR or issue was opened by an employee label Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source: Internal PR or issue was opened by an employee Team: Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants