Skip to content

Commit c289f6b

Browse files
kruallAleksandr Kriukov
and
Aleksandr Kriukov
authored
add StarvingInRowForNotEnoughCpu for tcp sessions (#625)
Co-authored-by: Aleksandr Kriukov <[email protected]>
1 parent 1459018 commit c289f6b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

ydb/library/actors/interconnect/interconnect_tcp_input_session.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,12 @@ namespace NActors {
260260
}
261261
}
262262

263-
SetEnoughCpu(enoughCpu);
263+
if (enoughCpu) {
264+
SetEnoughCpu(true);
265+
StarvingInRow = 0;
266+
} else {
267+
SetEnoughCpu(++StarvingInRow < StarvingInRowForNotEnoughCpu);
268+
}
264269

265270
// calculate ping time
266271
auto it = std::min_element(PingQ.begin(), PingQ.end());

ydb/library/actors/interconnect/interconnect_tcp_session.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,10 @@ namespace NActors {
402402

403403
if (!canProducePackets && !canWriteData) {
404404
SetEnoughCpu(true); // we do not starve
405+
StarvingInRow = 0;
405406
break;
406407
} else if (TimeLimit->CheckExceeded()) {
407-
SetEnoughCpu(false);
408+
SetEnoughCpu(++StarvingInRow < StarvingInRowForNotEnoughCpu);
408409
IssueRam(false);
409410
break;
410411
}

ydb/library/actors/interconnect/interconnect_tcp_session.h

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
#include <unordered_map>
3434

3535
namespace NActors {
36+
37+
static constexpr ui64 StarvingInRowForNotEnoughCpu = 32;
38+
3639
class TSlowPathChecker {
3740
using TTraceCallback = std::function<void(double)>;
3841
TTraceCallback Callback;
@@ -299,6 +302,8 @@ namespace NActors {
299302
std::array<ui32, 16> InputTrafficArray;
300303
THashMap<ui16, ui32> InputTrafficMap;
301304

305+
ui64 StarvingInRow = 0;
306+
302307
bool CloseInputSessionRequested = false;
303308

304309
void CloseInputSession();
@@ -634,6 +639,8 @@ namespace NActors {
634639
bool StartHandshakeOnSessionClose = false;
635640

636641
ui64 EqualizeCounter = 0;
642+
643+
ui64 StarvingInRow = 0;
637644
};
638645

639646
class TInterconnectSessionKiller

0 commit comments

Comments
 (0)