grpc-ecosystem / grpc-ecosystem/grpc-spring
GrpcServerConfigurer not configuring threads as expected
- 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
Assessment
This issue has not been assessed yet.