Skip to content

gRPC direct executor best practices for non-blocking code #1140

@abdullahjamal1

Description

@abdullahjamal1

The context

I am trying to use direct executor for my spring webflux application, in place of fixed thread pool executor as it seems to be more performant according to posts as this one grpc/grpc-java#5185 .

   @Bean
    public GrpcChannelConfigurer grpcChannelConfigurer() {
        return (channelBuilder, name) -> {
            if (channelBuilder instanceof NettyChannelBuilder nettyChannelBuilder) {
                nettyChannelBuilder.directExecutor();
            }
        };
    }

The question

I just want to know what if there are any other best practices or config changes, which i need to do if i am using direct executor.
from https://stackoverflow.com/questions/47505022/does-grpc-server-spin-up-a-new-thread-for-each-request, i came to know that we should also modify some bossEventLoopGroup and workerEventLoopGroup, is that required if are using this library instead of just native one.

The application's environment

  • Spring (boot):
  • grpc-java: 1.65.1
  • grpc-spring-boot-starter: 3.1.0.RELEASE
  • java: 17

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionA question about this library or its usage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions