Issue description
It seems like it should be possible to change the gRPC server executor from TaskExecutors.IO to something else (I'm specifically interested in getting it to use the VIRTUAL executor service), but it's not clear to me how to actually make that happen, and I'm wondering if this is perhaps a bug, missing feature, or documentation issue. Please let me be up front that this could all be a misunderstanding on my part and I hesitate to assert that it's a bug.
The "gRPC Server" section of the Micronaut gRPC docs says, in part:
…by default the server will be setup to use Micronaut’s I/O executor service.
That suggests to me that it should be possible to configure the server to use a non-default executor service. The configuration reference for Micronaut gRPC also identifies grpc.server.executor as a configurable property of GrpcServerConfiguration, but with a type of java.util.concurrent.Executor. Looking at the source code for GrpcServerConfiguration, it's not clear to me that the server executor can actually be changed, though.
The constructor accepts an executor, but calls out TaskExecutors.IO specifically, and I don't see any hooks to override that. GrpcServerConfiguration only calls NettyServerBuilder#executor from its constructor, and there are no public (or private) methods for changing it after construction. I recognize that GrpcServerConfiguration has a NettyServerBuilder as a @ConfigurationBuilder, but again, it's expecting a full Executor implementation and not a bean name. NettyServerBuilder is also not a Micronaut component, so it's not clear to me that it would know how to resolve an executor name to a bean, but I'm often surprised by features of Micronaut's configuration system.
I have tried the obvious thing of setting grpc.server.executor to "blocking"/"virtual", but gRPC calls continue to get sent to the IO executor all the same. I can imagine (but have not yet actually tried) ways to change the executor by injecting GrpcServerConfiguration, calling getServerBuilder(), and changing the executor there. Still, that seems pretty roundabout/complicated, and also a little beside the point of "it seems like the design intent is to do this at the configuration layer."
I should acknowledge that I also posted about this on Stack Overflow, but suspect the answers there are LLM-generated slop. I recognize that this might make more sense as a discussion topic, but the micronaut-grpc project does not have discussions enabled. I'm happy to take this elsewhere if another venue would be more appropriate.
Issue description
It seems like it should be possible to change the gRPC server executor from
TaskExecutors.IOto something else (I'm specifically interested in getting it to use the VIRTUAL executor service), but it's not clear to me how to actually make that happen, and I'm wondering if this is perhaps a bug, missing feature, or documentation issue. Please let me be up front that this could all be a misunderstanding on my part and I hesitate to assert that it's a bug.The "gRPC Server" section of the Micronaut gRPC docs says, in part:
That suggests to me that it should be possible to configure the server to use a non-default executor service. The configuration reference for Micronaut gRPC also identifies
grpc.server.executoras a configurable property of GrpcServerConfiguration, but with a type ofjava.util.concurrent.Executor. Looking at the source code forGrpcServerConfiguration, it's not clear to me that the server executor can actually be changed, though.The constructor accepts an executor, but calls out
TaskExecutors.IOspecifically, and I don't see any hooks to override that.GrpcServerConfigurationonly callsNettyServerBuilder#executorfrom its constructor, and there are no public (or private) methods for changing it after construction. I recognize thatGrpcServerConfigurationhas aNettyServerBuilderas a@ConfigurationBuilder, but again, it's expecting a fullExecutorimplementation and not a bean name.NettyServerBuilderis also not a Micronaut component, so it's not clear to me that it would know how to resolve an executor name to a bean, but I'm often surprised by features of Micronaut's configuration system.I have tried the obvious thing of setting
grpc.server.executorto"blocking"/"virtual", but gRPC calls continue to get sent to the IO executor all the same. I can imagine (but have not yet actually tried) ways to change the executor by injectingGrpcServerConfiguration, callinggetServerBuilder(), and changing the executor there. Still, that seems pretty roundabout/complicated, and also a little beside the point of "it seems like the design intent is to do this at the configuration layer."I should acknowledge that I also posted about this on Stack Overflow, but suspect the answers there are LLM-generated slop. I recognize that this might make more sense as a discussion topic, but the
micronaut-grpcproject does not have discussions enabled. I'm happy to take this elsewhere if another venue would be more appropriate.