-
Notifications
You must be signed in to change notification settings - Fork 104
Add netty epoll dependency, and set keepalive timeout for directpath #729
Conversation
Codecov Report
@@ Coverage Diff @@
## master #729 +/- ##
============================================
+ Coverage 77.43% 77.45% +0.01%
Complexity 1081 1081
============================================
Files 196 196
Lines 4707 4710 +3
Branches 369 369
============================================
+ Hits 3645 3648 +3
Misses 895 895
Partials 167 167
Continue to review full report at Codecov.
|
| } | ||
|
|
||
| @Test | ||
| public void testEpollAvailable() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is testing that epoll is available when gax runs tests. Should this be a runtime check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's a runtime checker. So you mean this test is not helping? I just want to make sure when channel gets created, it will be using the epoll channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is testing that epoll channel is available when gax runs it's tests. If it's a transitive dependency of gax then this might help but it's not guaranteed. It's possible that the dependency is being pulled in by a test dependency.
What happens if epoll is not available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I'll just remove this test. AFAICT, since gax already depends on grpc-netty-shaded, as long as the client library uses gax to create channel, they will most likely be using epoll.
If epoll is not available, say some client libraries use their own channel builder, or for a non-linux machine, then this keepAliveTimout value will not be used to set the TCP_USER_TIMEOUT socket option, because that socket option is only supported by epoll. https://github.com/grpc/grpc-java/blob/master/netty/src/main/java/io/grpc/netty/NettyClientTransport.java#L230-L233
To set TCP_USER_TIMEOUT socket option, we would need to use netty epoll channel, and set the keepAliveTimeout parameter:
https://github.com/grpc/grpc-java/blob/master/netty/src/main/java/io/grpc/netty/NettyClientTransport.java#L228-L234
This PR is to add the dependency of netty epoll in gax, and set the keepAliveTime and keepAliveTimeout when direct path is enabled. In this way, when the first grpc call starts, it will set the TCP_USER_TIMEOUT socket option to the value of keepAliveTimeout.
related: b/130383787