-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
How to warm up SslConnection #6514
Comments
Just to be clear, method However, yes, we don't have a way to force the TLS handshake, which is always initiated lazily when the first request is sent. |
Hi @sbordet , thanks for the clarification and hopefully the feature can be supported officially! In my application, there is a class implements the interface Request.Listener in order to record the time spent on each step. What I observed is that between invoking Do you think it could be a workaround to avoid SSL handshake when sending the first request if application sends a dummy request to the same destination before it started? Maybe it is a bit tricky as a single request can only trigger SSL handshake of one connection in the connection pool. |
Yes that will work the problem around by "priming" the connection and forcing the TLS handshake. |
Hi @sbordet ! Do you think the solution even works if application sends concurrent requests sent as soon as it is started? I thought concurrent requests may need to use multiple connections from connection pool and the dummy request cannot force TLS handshake of all these connections. Is my understanding correct? |
Yes you would need to force the TLS handshake on all connections. Consider whether this is worth the effort. Lots of complexity for 100 ms that are amortized. |
Hi @sbordet , thanks for the explanation! As the logic will become quite complicated, I will try to just send a single dummy request to force handshake of a single connection and see if the application could gain any performance. |
This issue has been automatically marked as stale because it has been a |
This issue has been automatically marked as stale because it has been a |
This issue has been automatically marked as stale because it has been a |
@sbordet I think we can close this one? |
@gregw let me ponder about this for a little more, as it may be an important use case also for customers. |
Implemented "priming" of HTTP/1.1 connections using ConnectionPool.preCreateConnections(int) and HttpClientTransportOverHTTP.setInitializeConnections(true). This sends `OPTIONS * HTTP/1.1` to the server. I tried to implement this feature by forcing a write of 0 bytes from the layer above `SslConnection`, but it did not work when using TLS because in both WriteFlusher and SslConnection the fact that there are 0 bytes left to write is treated specially. Other HTTP versions have no problems because they must initialize the connection by e.g. sending a SETTINGS frame, so they would also initialize TLS. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Jetty version
org.eclipse.jetty:jetty-client:9.4.36.v20210114
Java version
openjdk version "11.0.2" 2019-01-15
Question
Hi Community,
It is a follow up question of a question that I raised earlier. I tried to use
preCreateConnections
andresolveDestination
to pre create connections in connection pool. The time that is spent on obtaining connections has been reduced significantly. However, my original goal is to warm up connections before sending any request so that the time which is spent on SSL handshake can be eliminated for the first request.However, after profiling my application, I found that the call to
wrap
method of classSslConnection
still occurs when making the first request. Please see the attached flame graph below.I am wondering if it is possible to warm up the
SslConnection
even before sending the first request? Any suggestions would be greatly appreciated!The text was updated successfully, but these errors were encountered: