Thread pool for Netty Threads [Question]
See original GitHub issueI’m setting up a gRPC server based on Netty (netty-4.1.38). According to all docs/papers I’ve found, Netty has 3 types of threads: Boss, Worker, and Application Executor. I’ve set up a server with thread pools for all of them (thread number = 1 just for test).
NettyServerBuilder.forPort(port)
.executor(Executors.newFixedThreadPool(1) {
Thread(it)
.apply {
name = "Executor thread $id"
}
})
.workerEventLoopGroup(
NioEventLoopGroup(1, ThreadFactory {
Thread(it)
.apply {
name = "Worker thread $id"
}
})
)
.bossEventLoopGroup(NioEventLoopGroup(1, ThreadFactory {
Thread(it)
.apply {
name = "Boss thread $id"
}
}))
But when I run the server and connect with the client, I see some extra “Netty Threads” apart from those 3 expected (Boss, Worker, and Executor are present there too).
The call stack for such thread looks like this:
So it seems to be doing exactly the same thing as Worker threads do.
Also, more of these threads are spawning as the load increases. And my question is, what are those and why I can’t control them via any thread pool? I’ve searched through both Netty and gRPC repos and didn’t find any Thread factory that spawns threads with “Netty Thread” name.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (2 by maintainers)
Top GitHub Comments
Alright, mystery solved 😃 Thank you guys for help! So in my case it was a Lightstreamer library, totally forgot about it, and actually had no idea it uses Netty.
@ninja- ah yes you’re right of course! But my client question still applies 😃