grpc-java
grpc-java copied to clipboard
Any plans to add KQueue to default channelType and EventLoopGroup?
Any plans to add KQueue in the default detection here: https://github.com/grpc/grpc-java/blob/master/netty/src/main/java/io/grpc/netty/Utils.java#L113-L133
Thanks
Why are you interested?
We have a product where we use this and we have Linux/Epoll on our clusters and we have Macs to work on. Hence it helps with easier local testing on unix domain socket. We can currently put our own "if" conditions to achieve it but we were hoping to simplify the code.
From
if (Epoll.isAvailable()){
ServerBuilder serverBuilder = NettyServerBuilder
.forAddress(domainSocketAddress)
.channelType(EpollServerDomainSocketChannel.class)
.workerEventLoopGroup(new EpollEventLoopGroup())
.bossEventLoopGroup(new EpollEventLoopGroup());
} else if (KQueue.isAvailable()){
ServerBuilder serverBuilder = NettyServerBuilder
.forAddress(domainSocketAddress)
.channelType(KqueueServerDomainSocketChannel.class)
.workerEventLoopGroup(new KqueueEventLoopGroup())
.bossEventLoopGroup(new KqueueEventLoopGroup());
}
to
ServerBuilder serverBuilder = NettyServerBuilder
.forAddress(domainSocketAddress);
I know for Epoll you couldn't simplify things because you must specify EpollServerDomainSocketChannel and if you specify that you need to specify the worker/boss. That issue is really a mundane Netty issue and wouldn't be that hard to resolve with a new channel type that supports inet and unix.
On client-side we have UdsNameResolver and UdsNettyChannelProvider such that you can use unix: targets when creating a channel and have it use epoll. That could be taught to use kqueue as well and then we'd probably need grpc-netty-shaded to include the kqueue binaries. But that's client-side and not server-side.
I think for you to get what you need you'd really need the Netty API to be fixed so there is a channel type that handles both inet and unix.
Looks like the main things here are really for Netty. gRPC's done about as much as it can do right now. Annoying, but also the state of things.