Skip to content

Commit 9178a81

Browse files
committed
identify high priority flow lock
1 parent 6458cad commit 9178a81

File tree

5 files changed

+173
-32
lines changed

5 files changed

+173
-32
lines changed

fdbserver/networktest.actor.cpp

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -364,33 +364,50 @@ struct P2PNetworkTest {
364364
double probabilityNotCloseConn = 0;
365365

366366
double startTime;
367-
int64_t bytesSent;
368-
int64_t bytesReceived;
369-
int sessionsIn;
370-
int sessionsOut;
371-
int connectErrors;
372-
int acceptErrors;
373-
int sessionErrors;
367+
int64_t bytesSent = 0;
368+
int64_t bytesReceived = 0;
369+
int sessionsIn = 0;
370+
int sessionsOut = 0;
371+
int connectErrors = 0;
372+
int acceptErrors = 0;
373+
int sessionErrors = 0;
374+
int handshakeReqIn = 0;
375+
int handshakeReqOut = 0;
376+
int handshakeDoneIn = 0;
377+
int handshakeDoneOut = 0;
374378

375379
Standalone<StringRef> msgBuffer;
376380

377381
std::string statsString() {
378382
double elapsed = now() - startTime;
379-
std::string s = format(
380-
"%.2f MB/s bytes in %.2f MB/s bytes out %.2f/s completed sessions in %.2f/s completed sessions out ",
381-
bytesReceived / elapsed / 1e6,
382-
bytesSent / elapsed / 1e6,
383-
sessionsIn / elapsed,
384-
sessionsOut / elapsed);
385-
s += format("Total Errors %d connect=%d accept=%d session=%d",
386-
connectErrors + acceptErrors + sessionErrors,
387-
connectErrors,
388-
acceptErrors,
389-
sessionErrors);
383+
std::string s = format("%.2f MB/s in; %.2f MB/s out\nArrive: %.2f/s in HS req; %.2f/s "
384+
"out HS req\nProcessed %.2f/s in HS req; %.2f/s out HS req\n"
385+
"Completed Session %.2f/s in sessions; %.2f/s "
386+
"out sessions\n",
387+
bytesReceived / elapsed / 1e6,
388+
bytesSent / elapsed / 1e6,
389+
handshakeReqIn / elapsed,
390+
handshakeReqOut / elapsed,
391+
handshakeDoneIn / elapsed,
392+
handshakeDoneOut / elapsed,
393+
sessionsIn / elapsed,
394+
sessionsOut / elapsed);
395+
s += format("Total Errors %.2f/s ConnectError=%.2f/s AcceptError=%.2f/s SessionError=%.2f/s",
396+
(connectErrors + acceptErrors + sessionErrors) / elapsed,
397+
connectErrors / elapsed,
398+
acceptErrors / elapsed,
399+
sessionErrors / elapsed);
390400
bytesSent = 0;
391401
bytesReceived = 0;
392402
sessionsIn = 0;
393403
sessionsOut = 0;
404+
connectErrors = 0;
405+
acceptErrors = 0;
406+
sessionErrors = 0;
407+
handshakeReqIn = 0;
408+
handshakeReqOut = 0;
409+
handshakeDoneIn = 0;
410+
handshakeDoneOut = 0;
394411
startTime = now();
395412
return s;
396413
}
@@ -419,6 +436,10 @@ struct P2PNetworkTest {
419436
connectErrors = 0;
420437
acceptErrors = 0;
421438
sessionErrors = 0;
439+
handshakeReqIn = 0;
440+
handshakeReqOut = 0;
441+
handshakeDoneIn = 0;
442+
handshakeDoneOut = 0;
422443
msgBuffer = makeString(std::max(sendMsgBytes.max, recvMsgBytes.max));
423444

424445
if (!remoteAddresses.empty()) {
@@ -514,19 +535,23 @@ struct P2PNetworkTest {
514535

515536
try {
516537
if (incoming) {
538+
self->handshakeReqIn++;
517539
if (self->randomCloseMaxDelay > -1) {
518540
randomClose = randomDelayedConnClose(self, conn);
519541
}
520542
wait(conn->acceptHandshake());
543+
self->handshakeDoneIn++;
521544
// Read the number of requests for the session
522545
Standalone<StringRef> buf = wait(readMsg(self, conn));
523546
ASSERT(buf.size() == sizeof(int));
524547
numRequests = *(int*)buf.begin();
525548
} else {
549+
self->handshakeReqOut++;
526550
if (self->randomCloseMaxDelay > -1) {
527551
randomClose = randomDelayedConnClose(self, conn);
528552
}
529553
wait(conn->connectHandshake());
554+
self->handshakeDoneOut++;
530555

531556
// Pick the number of requests for the session and send it to remote
532557
numRequests = self->requests.get();
@@ -590,10 +615,8 @@ struct P2PNetworkTest {
590615

591616
ACTOR static Future<Void> incoming(P2PNetworkTest* self, Reference<IListener> listener) {
592617
state ActorCollection sessions(false);
593-
618+
state uint64_t connectionCount = 0;
594619
loop {
595-
wait(delay(0, TaskPriority::AcceptSocket));
596-
597620
try {
598621
state Reference<IConnection> conn = wait(listener->accept());
599622
// printf("Connected from %s\n", conn->getPeerAddress().toString().c_str());
@@ -602,6 +625,10 @@ struct P2PNetworkTest {
602625
++self->acceptErrors;
603626
TraceEvent(SevError, "P2PIncomingError").error(e).detail("Listener", listener->getListenAddress());
604627
}
628+
connectionCount++;
629+
if (connectionCount % (FLOW_KNOBS->ACCEPT_BATCH_SIZE) == 0) {
630+
wait(delay(0, TaskPriority::AcceptSocket));
631+
}
605632
}
606633
}
607634

flow/Knobs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ void FlowKnobs::initialize(Randomize randomize, IsSimulated isSimulated) {
108108
init( TLS_HANDSHAKE_ALWAYS_BACKGROUND, false );
109109
init( INJECT_TLS_HANDSHAKE_BUSYNESS_SEC, 0.0 );
110110
init( INJECT_TLS_HANDSHAKE_VERIFY_SEC, 0.0 );
111+
init( TLS_CONNECTION_EARLY_CLOSE, false );
112+
init( TLS_FLOW_LOCK_HIGH_PRIORITY, false );
111113

112114
//FlowTransport
113115
init( CONNECTION_REJECTED_MESSAGE_DELAY, 1.0 );

0 commit comments

Comments
 (0)