@@ -418,8 +418,10 @@ class Net2 final : public INetwork, public INetworkConnections {
418
418
DoubleMetricHandle countLaunchTime;
419
419
DoubleMetricHandle countReactTime;
420
420
BoolMetricHandle awakeMetric;
421
- Int64MetricHandle countTLSHandshakesOnSideThreads;
422
- Int64MetricHandle countTLSHandshakesOnMainThread;
421
+ Int64MetricHandle countClientTLSHandshakesOnSideThreads;
422
+ Int64MetricHandle countClientTLSHandshakesOnMainThread;
423
+ Int64MetricHandle countServerTLSHandshakesOnSideThreads;
424
+ Int64MetricHandle countServerTLSHandshakesOnMainThread;
423
425
424
426
EventMetricHandle<SlowTask> slowTaskMetric;
425
427
@@ -1062,8 +1064,11 @@ class SSLConnection final : public IConnection, ReferenceCounted<SSLConnection>
1062
1064
});
1063
1065
1064
1066
// If the background handshakers are not all busy, use one
1067
+
1068
+ // FIXME: see comment elsewhere about making this the only path.
1065
1069
if (FLOW_KNOBS->TLS_HANDSHAKE_ALWAYS_BACKGROUND ||
1066
1070
N2::g_net2->sslPoolHandshakesInProgress < N2::g_net2->sslHandshakerThreadsStarted ) {
1071
+ g_net2->countServerTLSHandshakesOnSideThreads ++;
1067
1072
holder = Hold (&N2::g_net2->sslPoolHandshakesInProgress );
1068
1073
auto handshake =
1069
1074
new SSLHandshakerThread::Handshake (self->ssl_sock , boost::asio::ssl::stream_base::server);
@@ -1073,6 +1078,7 @@ class SSLConnection final : public IConnection, ReferenceCounted<SSLConnection>
1073
1078
N2::g_net2->sslHandshakerPool ->post (handshake);
1074
1079
} else {
1075
1080
// Otherwise use flow network thread
1081
+ g_net2->countServerTLSHandshakesOnMainThread ++;
1076
1082
BindPromise p (" N2_AcceptHandshakeError" _audit, self->id );
1077
1083
p.setPeerAddr (self->getPeerAddress ());
1078
1084
onHandshook = p.getFuture ();
@@ -1177,9 +1183,10 @@ class SSLConnection final : public IConnection, ReferenceCounted<SSLConnection>
1177
1183
// unpredictable system performance and reliability) is
1178
1184
// much, much higher than the cost a few hundred or
1179
1185
// thousand incremental threads.
1186
+
1180
1187
if (FLOW_KNOBS->TLS_HANDSHAKE_ALWAYS_BACKGROUND ||
1181
1188
N2::g_net2->sslPoolHandshakesInProgress < N2::g_net2->sslHandshakerThreadsStarted ) {
1182
- g_net2->countTLSHandshakesOnSideThreads ++;
1189
+ g_net2->countClientTLSHandshakesOnSideThreads ++;
1183
1190
holder = Hold (&N2::g_net2->sslPoolHandshakesInProgress );
1184
1191
auto handshake =
1185
1192
new SSLHandshakerThread::Handshake (self->ssl_sock , boost::asio::ssl::stream_base::client);
@@ -1189,7 +1196,7 @@ class SSLConnection final : public IConnection, ReferenceCounted<SSLConnection>
1189
1196
N2::g_net2->sslHandshakerPool ->post (handshake);
1190
1197
} else {
1191
1198
// Otherwise use flow network thread
1192
- g_net2->countTLSHandshakesOnMainThread ++;
1199
+ g_net2->countClientTLSHandshakesOnMainThread ++;
1193
1200
BindPromise p (" N2_ConnectHandshakeError" _audit, self->id );
1194
1201
p.setPeerAddr (self->getPeerAddress ());
1195
1202
onHandshook = p.getFuture ();
@@ -1622,8 +1629,10 @@ void Net2::initMetrics() {
1622
1629
slowTaskMetric.init (" Net2.SlowTask" _sr);
1623
1630
countLaunchTime.init (" Net2.CountLaunchTime" _sr);
1624
1631
countReactTime.init (" Net2.CountReactTime" _sr);
1625
- countTLSHandshakesOnSideThreads.init (" Net2.CountTLSHandshakesOnSideThreads" _sr);
1626
- countTLSHandshakesOnMainThread.init (" Net2.CountTLSHandshakesOnMainThread" _sr);
1632
+ countClientTLSHandshakesOnSideThreads.init (" Net2.CountClientTLSHandshakesOnSideThreads" _sr);
1633
+ countClientTLSHandshakesOnMainThread.init (" Net2.CountClientTLSHandshakesOnMainThread" _sr);
1634
+ countServerTLSHandshakesOnSideThreads.init (" Net2.CountServerTLSHandshakesOnSideThreads" _sr);
1635
+ countServerTLSHandshakesOnMainThread.init (" Net2.CountServerTLSHandshakesOnMainThread" _sr);
1627
1636
taskQueue.initMetrics ();
1628
1637
}
1629
1638
0 commit comments