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

HIVE-23745: Avoid copying userpayload in task communicator #3615

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

difin
Copy link
Contributor

@difin difin commented Sep 22, 2022

What changes were proposed in this pull request?

Copy of user payload take a few milliseconds sometimes. This delay adds up for all tasks of a single vertex in LlapTaskCommunicator as it processes tasks one by one. User payload never changes in this codepath. Copy used to be made because of limitations of Protobuf library. Protobuf added a UnsafeByteOperations class that avoid copying of ByteBuffers in 3.1 version. This can be resolved now since Protobuf has been upgraded.

Why are the changes needed?

To reduce query startup latency by removing unneeded copying of ByteBuffers.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit and integration tests

@sonarcloud
Copy link

sonarcloud bot commented Sep 22, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@abstractdog abstractdog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1
I believe if this patch was incorrect (changing payload somewhere on this codepath), it would fail immediately due to a corrupted ByteString

it would be interesting to capture a payload somewhere and write a https://github.com/apache/hive/tree/master/itests/hive-jmh test for comparing copyFrom <-> unsafeWrap, but I don't insist

@pudidic pudidic merged commit 1be7135 into apache:master Oct 4, 2022
@difin
Copy link
Contributor Author

difin commented Oct 5, 2022

Thanks, @abstractdog!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants