Skip to content

Conversation

@veblush
Copy link
Collaborator

@veblush veblush commented May 18, 2021

gRPC client benchmark added an option to use the zero-copy marshaller based on the recent protobuf optimization which has been available from protobuf-java 1.36.0 and the new gRPC feature (grpc/grpc-java#8102) which will be available from grpc-java 1.39.0. This is expected to reduce two memory copies involved in protobuf-message deserialization step.

@veblush
Copy link
Collaborator Author

veblush commented May 18, 2021

This optimization turns out to be able to reduce the user cpu time by ~20% from the benchmark to download 1GiB file 30 times through Directpath.

# Without a zero-copy marshaller
$ time taskset -c 0 java -Xmx4096m -jar $JAR --client=grpc --bkt=gcs-grpc-team-veblush1 --obj=1GB.bin --calls=30 --method=read --size=1048576 --dp=true
real    0m59.133s
user    0m44.767s
sys     0m7.977s

# With a zero-copy marshaller
$ time taskset -c 0 java -Xmx4096m -jar $JAR --client=grpc --bkt=gcs-grpc-team-veblush1 --obj=1GB.bin --calls=30 --method=read --size=1048576 --dp=true --zeroCopy=true
real    0m57.722s
user    0m34.180s
sys     0m8.128s

Flamegraphs w/ and w/o the zero-copy also shows that it removes the cpu-cost of copying buffers. Note that right three pillars shrinked into 1 pillar with the zero-copy marshaller.

Without a zero-copy marshaller

Without zero-copy

With a zero-copy marshaller

With zero-copy

Code to be optimized by this change (in the red box)

Screen Shot 2021-05-18 at 4 17 42 PM

@veblush
Copy link
Collaborator Author

veblush commented May 18, 2021

@voidzcy Could you take a quick look at the change to make sure if new features are used as intended?

@voidzcy
Copy link

voidzcy commented May 19, 2021

LGTM

@veblush veblush requested a review from mohanli-ml July 3, 2021 00:04
@veblush veblush marked this pull request as ready for review July 3, 2021 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants