I've got a Dropwizard application where a resource needs to invoke a resource on another Dropwizard application. We noticed that a lot of time is spent on SSL renegotiation. Upon closer inspection this happens only if the other application is on the same machine. I.e:
client.target("https://mymachine.com/test").request().post(null);
client.target("https://mymachine.com/test").request().post(null);
// renegotiation
if using command line option -Djavax.net.debug=ssl:handshake:verbose
the log says
%% Client cached [Session-13, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256]
%% Try resuming [Session-13, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256] from port 55043
...
%% Invalidated: [Session-13, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256]
%% Initialized: [Session-15, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256]
But when invoking the same service on my local machine:
client.target("https://othermachine.com/test").request().post(null);
client.target("https://othermachine.com/test").request().post(null);
// SSL session re-use (=wanted)
The log says:
%% Client cached [Session-15, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256]
%% Try resuming [Session-15, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256] from port 55051
...
%% Server resumed [Session-15, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256]
What is going on here?