Skip to content

CompositeReadableBuffer and GC overhead #3278

@Gordiychuk

Description

@Gordiychuk

What version of gRPC are you using?

master branch

What JVM are you using (java -version)?

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

What the problem?

Small messages send and receive via gRPC lead to many memory allocation via CompositeReadableBuffer. It's top by allocation in benchmark that send 32 bytes request and receive 16 bytes response.

screenshot from 2017-07-26 19 30 32

I think we can reduce allocation if change logic of this line https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/MessageDeframer.java#L303 because in this place creates temp CompositeReadableBuffer that uncessary https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/CompositeReadableBuffer.java#L51 instead of it we can write at once in target buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions