grpc-ecosystem / grpc-ecosystem/grpc-spring

GrpcServerConfigurer not configuring threads as expected

Open
#593 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
3.7k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

**The context**

I'm trying to understand how grpc server is handling thread creation and usage, so I can control it manually.

**The question**

I'm running a grpc server in my local, in which I'm customizing the threading forcing to have just 1 thread, like this:

```
@Bean
public GrpcServerConfigurer customServer() {
ExecutorService executor = Executors.newFixedThreadPool(1);

return serverBuilder -> {
if (serverBuilder instanceof NettyServerBuilder) {
System.out.println("Configured server executor!!!");
((NettyServerBuilder) serverBuilder)
.executor(executor)
.workerEventLoopGroup(new NioEventLoopGroup(1))
.bossEventLoopGroup(new NioEventLoopGroup(1))
.channelType(NioServerSocketChannel.class)
.permitKeepAliveWithoutCalls(true);
}
};
}
```
When I process several requests, I would expect to receive and process them all one by one, but I see how the grpc server process all them in parallel, so It seems I'm not configuring well the server.

**The application's environment**

Which versions do you use?
* Spring (boot): 2.2.6
* grpc-java: 1.37
* grpc-spring-boot-starter: 2.12
* java: version + architecture (64bit?) java 11 + 64bit

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.