Skip to content
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

Add StarvingInRowForNotEnoughCpu for tcp sessions, KIKIMR-20586 #625

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,12 @@ namespace NActors {
}
}

SetEnoughCpu(enoughCpu);
if (enoughCpu) {
SetEnoughCpu(true);
StarvingInRow = 0;
} else {
SetEnoughCpu(++StarvingInRow < StarvingInRowForNotEnoughCpu);
}

// calculate ping time
auto it = std::min_element(PingQ.begin(), PingQ.end());
Expand Down
3 changes: 2 additions & 1 deletion ydb/library/actors/interconnect/interconnect_tcp_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,10 @@ namespace NActors {

if (!canProducePackets && !canWriteData) {
SetEnoughCpu(true); // we do not starve
StarvingInRow = 0;
break;
} else if (TimeLimit->CheckExceeded()) {
SetEnoughCpu(false);
SetEnoughCpu(++StarvingInRow < StarvingInRowForNotEnoughCpu);
IssueRam(false);
break;
}
Expand Down
7 changes: 7 additions & 0 deletions ydb/library/actors/interconnect/interconnect_tcp_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
#include <unordered_map>

namespace NActors {

static constexpr ui64 StarvingInRowForNotEnoughCpu = 32;

class TSlowPathChecker {
using TTraceCallback = std::function<void(double)>;
TTraceCallback Callback;
Expand Down Expand Up @@ -299,6 +302,8 @@ namespace NActors {
std::array<ui32, 16> InputTrafficArray;
THashMap<ui16, ui32> InputTrafficMap;

ui64 StarvingInRow = 0;

bool CloseInputSessionRequested = false;

void CloseInputSession();
Expand Down Expand Up @@ -634,6 +639,8 @@ namespace NActors {
bool StartHandshakeOnSessionClose = false;

ui64 EqualizeCounter = 0;

ui64 StarvingInRow = 0;
};

class TInterconnectSessionKiller
Expand Down
Loading