-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TCP Fast Open support #1375
Conversation
servicetalk-grpc-api/src/main/java/io/servicetalk/grpc/api/GrpcServerBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-netty/src/main/java/io/servicetalk/grpc/netty/DefaultGrpcServerBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/DefaultHttpServerBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/MutualSslTest.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/MutualSslTest.java
Show resolved
Hide resolved
Should include enhancements to this docs section: https://apple.github.io/servicetalk//servicetalk/SNAPSHOT/performance.html#socket-and-transport-options |
servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/MutualSslTest.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/TcpFastOpenTest.java
Outdated
Show resolved
Hide resolved
...etalk-transport-api/src/main/java/io/servicetalk/transport/api/ServiceTalkSocketOptions.java
Outdated
Show resolved
Hide resolved
...etalk-transport-api/src/main/java/io/servicetalk/transport/api/ServiceTalkSocketOptions.java
Outdated
Show resolved
Hide resolved
...-netty-internal/src/main/java/io/servicetalk/tcp/netty/internal/ReadOnlyTcpServerConfig.java
Outdated
Show resolved
Hide resolved
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.
LGTM after the build passes (awaiting netty release), thanks!
...etalk-transport-api/src/main/java/io/servicetalk/transport/api/ServiceTalkSocketOptions.java
Outdated
Show resolved
Hide resolved
...etalk-transport-api/src/main/java/io/servicetalk/transport/api/ServiceTalkSocketOptions.java
Outdated
Show resolved
Hide resolved
...-netty-internal/src/main/java/io/servicetalk/transport/netty/internal/SocketOptionUtils.java
Outdated
Show resolved
Hide resolved
...-netty-internal/src/main/java/io/servicetalk/transport/netty/internal/SocketOptionUtils.java
Show resolved
Hide resolved
} | ||
|
||
@Test | ||
public void requestSucceedsEvenIfTcpFastOpenNotEnabledOrSupported() 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.
Btw, this test proves that it's safe to have this option always enabled. WDYT about making it on by default (opt-out)?
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.
Btw, this test proves that it's safe to have this option always enabled.
Yes that is the goal. It shouldn't break anything even if not supported, and not enabled by the peer. If this test fails then we may want to consider more strict validation (e.g. throw error at build time if not supported).
WDYT about making it on by default (opt-out)?
Netty logs warnings if you enable an option that isn't supported, and also if it is supported users may not want to have it always enabled (e.g. idempotent, extra state tracking, etc.).
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.
Thanks for the explanation. What if we move it down to the transport, where we have access to Epoll.isAvailable()
check (or Channel
type) and know that the Channel
is secure? For example, SslClientChannelInitializer
might be a good place, if we pass the user-defined options there as well (to check that user did not explicitly set this option).
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.
Interesting idea. I propose we proceed by adding the feature as opt-in first, and after we get some data we can consider enabling by default in a followup PR.
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.
Sounds good to me!
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.
Reading around privacy concerns with TFO [1], makes me think that it's probably better left as opt-in.
servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/MutualSslTest.java
Outdated
Show resolved
Hide resolved
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.
LGTM
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.
LGTM, but I don't feel confident to approve.
6a08af1
to
904c31d
Compare
904c31d
to
f00fd78
Compare
depends upon netty/netty#11077 |
6c7c523
to
7690ca7
Compare
111a03b
to
1a6c58c
Compare
Motivation: Netty recently added support for [TCP fast open](https://tools.ietf.org/html/rfc7413) on the client, and has had server support for a while. We currently don't expose the necessary configuration knobs to enable this feature, but it may be able to reduce round trips and reduce connection setup latency. Modifications: - Add socket options to configure client and server TCP fast open. - Add mechanism to configure the listen/acceptor socket options, and use this for the backlog option which was an outlier. Result: TCP Fast Open can be enabled for client and server. Note that it is only supported by Netty's native EPOLL transport on linux, and only initiated on the client when TLS is enabled.
Motivation: Netty recently added support for [TCP fast open](https://tools.ietf.org/html/rfc7413) on the client, and has had server support for a while. We currently don't expose the necessary configuration knobs to enable this feature, but it may be able to reduce round trips and reduce connection setup latency. Modifications: - Add socket options to configure client and server TCP fast open. - Add mechanism to configure the listen/acceptor socket options, and use this for the backlog option which was an outlier. Result: TCP Fast Open can be enabled for client and server. Note that it is only supported by Netty's native EPOLL transport on linux, and only initiated on the client when TLS is enabled.
Motivation: `backlog(int)` builder option was deprecated in apple#1375 and can be removed now. Users should use `listenSocketOption(SocketOption, Object)` as an alternative. Modifications: - Remove `backlog(int)` from all server builders; Result: No deprecated `backlog(int)` server builder option.
(#1636) Motivation: `backlog(int)` builder option was deprecated in #1375 and can be removed now. Users should use `listenSocketOption(SocketOption, Object)` as an alternative. Modifications: - Remove `backlog(int)` from all server builders; Result: No deprecated `backlog(int)` server builder option.
Motivation:
Netty recently added support for
TCP fast open on the client, and
has had server support for a while. We currently don't expose the
necessary configuration knobs to enable this feature, but it may be able
to reduce round trips and reduce connection setup latency.
Modifications:
this for the backlog option which was an outlier.
Result:
TCP Fast Open can be enabled for client and server. Note that it is only
supported by Netty's native EPOLL transport on linux, and only
initiated on the client when TLS is enabled.