grpc-spring icon indicating copy to clipboard operation
grpc-spring copied to clipboard

Use FixedThreadPool as default executor

Open LeoBarykin opened this issue 5 years ago • 5 comments

The problem

When creating default GrpcServer or ManagedChannel the library uses CachedThreadPool as executor. Under load it may lead to running out of available threads and starvation.

The solution

Use a FixedThreadPool as an executor and make a configuration property for number of threads in it.

Alternatives considered

Now it is only possible via manual configuring ChannelConfigurer/ServerConfigurer

Additional context

Here https://stackoverflow.com/questions/42408634/what-is-the-exact-use-of-the-executor-in-grpc-java-s-serverbuilder-does-it-just grpc developer mentions that FixedThreadPool is more appropriate approach then default one/

BTW it is my 1st feature request ever, don't be mad if I did it wrong somehow...

LeoBarykin avatar Nov 05 '20 11:11 LeoBarykin

I'll probably add it along with: https://github.com/yidongnan/grpc-spring-boot-starter/issues/449

ST-DDT avatar Nov 06 '20 23:11 ST-DDT

Due to time constraints I move this to the next milestone

ST-DDT avatar Feb 07 '21 11:02 ST-DDT

this question can be resolved by GrpcServerConfigurer? @ST-DDT

bestpayAmes avatar Dec 21 '21 08:12 bestpayAmes

As a workaround yes. The actual implementation by this lib should probably be inside the related factories.

ST-DDT avatar Dec 21 '21 08:12 ST-DDT

@ST-DDT when is this going to merge any idea ? Also how does the workaround with GrpcServerConfigurer look like ?

pc-rshetty avatar Aug 05 '22 01:08 pc-rshetty