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

The in-process gRPC Client defaults to a direct executor #1372

Open
yuri-sergiichuk opened this issue Jul 19, 2021 · 0 comments
Open

The in-process gRPC Client defaults to a direct executor #1372

yuri-sergiichuk opened this issue Jul 19, 2021 · 0 comments
Milestone

Comments

@yuri-sergiichuk
Copy link
Contributor

yuri-sergiichuk commented Jul 19, 2021

If one uses the in-process gRPC Client e.g. like this:

Client.inProcess("Server Name").build()

The client is automatically created with a direct executor which is usually a bad choice in production environments. The reason for that is our in-process client setup:

private Builder(String processServerName) {
    this(channelForTesting(processServerName));
}

private static ManagedChannel channelForTesting(String serverName) {
    ManagedChannel result = InProcessChannelBuilder
            .forName(serverName)
            .directExecutor()
            .build();
    return result;
}

Without the directExecutor() call, the default executor is going to be a shard thread pool executor which a much better choice for non-test environments.

Workaround:

One may create a client with her own InProcessChannel and configure the executor manually:

ManagedChannel channel = InProcessChannelBuilder
        .forName(SERVER_NAME)
        .executor(<Some Executor>)
        .build();
return Client
        .usingChannel(channel)
        .build();
@alexander-yevsyukov alexander-yevsyukov added this to the M1 milestone Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants