Skip to content

Performance Concern in grpc-java: Unnecessary Stack Trace Computation #12134

@MarcGuiot

Description

@MarcGuiot

Hi,

In the following code snippet:
InternalSubchannel.java the log message string is built even if it is not ultimately used.

The toString() method of ConnectivityStateInfo calls toString() on the Status object. If the Status contains an exception, its stack trace is computed via getStackTrace().

In our usage of gRPC—where we enforce retries to many servers, some of which may be down—this stack trace computation shows up in our profiler and accounts for a few percent of CPU usage.

Thank you,
Marc Guiot

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions