Skip to content

Commit e6baf76

Browse files
committed
add network throughput aggregation
1 parent 7fb4b65 commit e6baf76

File tree

7 files changed

+28
-1
lines changed

7 files changed

+28
-1
lines changed

ydb/core/protos/node_whiteboard.proto

+1
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ message TSystemStateInfo {
345345
optional double CoresUsed = 39;
346346
optional uint32 CoresTotal = 40;
347347
optional float NetworkUtilization = 41;
348+
optional uint64 NetworkWriteThroughput = 42;
348349
}
349350

350351
message TEvSystemStateRequest {

ydb/core/tablet/node_whiteboard.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class TNodeWhiteboardService : public TActorBootstrapped<TNodeWhiteboardService>
7474
i64 MaxClockSkewWithPeerUs;
7575
ui32 MaxClockSkewPeerId;
7676
float MaxNetworkUtilization = 0.0;
77+
ui64 SumNetworkWriteThroughput = 0;
7778
NKikimrWhiteboard::TSystemStateInfo SystemStateInfo;
7879
THolder<NTracing::ITraceCollection> TabletIntrospectionData;
7980

@@ -568,6 +569,7 @@ class TNodeWhiteboardService : public TActorBootstrapped<TNodeWhiteboardService>
568569
}
569570
// TODO: need better way to calculate network utilization
570571
MaxNetworkUtilization = std::max(MaxNetworkUtilization, ev->Get()->Record.GetUtilization());
572+
SumNetworkWriteThroughput += nodeStateInfo.GetWriteThroughput();
571573
nodeStateInfo.MergeFrom(ev->Get()->Record);
572574
nodeStateInfo.SetChangeTime(currentChangeTime);
573575
}
@@ -1095,6 +1097,7 @@ class TNodeWhiteboardService : public TActorBootstrapped<TNodeWhiteboardService>
10951097
}
10961098

10971099
void Handle(TEvPrivate::TEvUpdateRuntimeStats::TPtr &, const TActorContext &ctx) {
1100+
static constexpr TDuration UPDATE_PERIOD = TDuration::Seconds(15);
10981101
{
10991102
NKikimrWhiteboard::TSystemStateInfo systemStatsUpdate;
11001103
TVector<double> loadAverage = GetLoadAverage();
@@ -1120,8 +1123,13 @@ class TNodeWhiteboardService : public TActorBootstrapped<TNodeWhiteboardService>
11201123
MaxNetworkUtilization = 0;
11211124
}
11221125

1126+
{
1127+
SystemStateInfo.SetNetworkWriteThroughput(SumNetworkWriteThroughput / UPDATE_PERIOD.Seconds());
1128+
SumNetworkWriteThroughput = 0;
1129+
}
1130+
11231131
UpdateSystemState(ctx);
1124-
ctx.Schedule(TDuration::Seconds(15), new TEvPrivate::TEvUpdateRuntimeStats());
1132+
ctx.Schedule(UPDATE_PERIOD, new TEvPrivate::TEvUpdateRuntimeStats());
11251133
}
11261134

11271135
void Handle(TEvPrivate::TEvCleanupDeadTablets::TPtr &, const TActorContext &ctx) {

ydb/core/viewer/protos/viewer.proto

+2
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ message TClusterInfo {
344344
uint64 Hosts = 60;
345345
uint64 Tenants = 61;
346346
double NetworkUtilization = 62;
347+
uint64 NetworkWriteThroughput = 63;
347348
}
348349

349350
enum ETenantType {
@@ -400,6 +401,7 @@ message TTenant {
400401
uint32 CoresTotal = 50;
401402
optional NKikimrMemory.TMemoryStats MemoryStats = 51;
402403
float NetworkUtilization = 52;
404+
uint64 NetworkWriteThroughput = 53;
403405
}
404406

405407
message TTenants {

ydb/core/viewer/tests/canondata/result.json

+7
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,7 @@
14351435
"MapVersions": "not-empty-object",
14361436
"MemoryTotal": "not-zero-number-text",
14371437
"NetworkUtilization": "number",
1438+
"NetworkWriteThroughput": "text",
14381439
"NodesAlive": 3,
14391440
"NodesTotal": 3,
14401441
"NumberOfCpus": "not-zero-number",
@@ -4129,6 +4130,7 @@
41294130
"Metrics": {},
41304131
"Name": "/Root",
41314132
"NetworkUtilization": "number",
4133+
"NetworkWriteThroughput": "text",
41324134
"NodeIds": [
41334135
1
41344136
],
@@ -4175,6 +4177,7 @@
41754177
"Metrics": "not-empty-object",
41764178
"Name": "/Root/dedicated_db",
41774179
"NetworkUtilization": "number",
4180+
"NetworkWriteThroughput": "text",
41784181
"NodeIds": [
41794182
50000
41804183
],
@@ -4261,6 +4264,7 @@
42614264
"Metrics": "not-empty-object",
42624265
"Name": "/Root/shared_db",
42634266
"NetworkUtilization": "number",
4267+
"NetworkWriteThroughput": "text",
42644268
"NodeIds": [
42654269
50001
42664270
],
@@ -4327,6 +4331,7 @@
43274331
"Metrics": {},
43284332
"Name": "/Root",
43294333
"NetworkUtilization": "number",
4334+
"NetworkWriteThroughput": "text",
43304335
"NodeIds": [
43314336
1
43324337
],
@@ -4377,6 +4382,7 @@
43774382
"Metrics": "not-empty-object",
43784383
"Name": "/Root/dedicated_db",
43794384
"NetworkUtilization": "number",
4385+
"NetworkWriteThroughput": "text",
43804386
"NodeIds": [
43814387
50000
43824388
],
@@ -4470,6 +4476,7 @@
44704476
"Metrics": "not-empty-object",
44714477
"Name": "/Root/shared_db",
44724478
"NetworkUtilization": "number",
4479+
"NetworkWriteThroughput": "text",
44734480
"NodeIds": [
44744481
50001
44754482
],

ydb/core/viewer/tests/test.py

+1
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ def normalize_result_nodes(result):
326326
'NetworkUtilization',
327327
'NetworkUtilizationMin',
328328
'NetworkUtilizationMax',
329+
'NetworkWriteThroughput',
329330
'PingTimeUs',
330331
'PingTimeMinUs',
331332
'PingTimeMaxUs',

ydb/core/viewer/viewer_cluster.h

+4
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ class TJsonCluster : public TViewerPipeClient {
347347
request->AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kCoresUsedFieldNumber);
348348
request->AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kCoresTotalFieldNumber);
349349
request->AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kNetworkUtilizationFieldNumber);
350+
request->AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kNetworkWriteThroughputFieldNumber);
350351
}
351352

352353
void InitTabletWhiteboardRequest(NKikimrWhiteboard::TEvTabletStateRequest* request) {
@@ -544,6 +545,9 @@ class TJsonCluster : public TViewerPipeClient {
544545
ClusterInfo.SetNetworkUtilization(ClusterInfo.GetNetworkUtilization() + systemState.GetNetworkUtilization());
545546
++nodesWithNetworkUtilization;
546547
}
548+
if (systemState.HasNetworkWriteThroughput()) {
549+
ClusterInfo.SetNetworkWriteThroughput(ClusterInfo.GetNetworkWriteThroughput() + systemState.GetNetworkWriteThroughput());
550+
}
547551
}
548552

549553
if (nodesWithNetworkUtilization != 0) {

ydb/core/viewer/viewer_tenantinfo.h

+4
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ class TJsonTenantInfo : public TViewerPipeClient {
280280
request.AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kMemoryStatsFieldNumber);
281281
}
282282
request.AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kNetworkUtilizationFieldNumber);
283+
request.AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kNetworkWriteThroughputFieldNumber);
283284
}
284285

285286
void SendWhiteboardSystemStateRequest(const TNodeId nodeId) {
@@ -850,6 +851,9 @@ class TJsonTenantInfo : public TViewerPipeClient {
850851
tenant.SetNetworkUtilization(tenant.GetNetworkUtilization() + nodeInfo.GetNetworkUtilization());
851852
++nodesWithNetworkUtilization;
852853
}
854+
if (nodeInfo.HasNetworkWriteThroughput()) {
855+
tenant.SetNetworkWriteThroughput(tenant.GetNetworkWriteThroughput() + nodeInfo.GetNetworkWriteThroughput());
856+
}
853857
overall = Max(overall, GetViewerFlag(nodeInfo.GetSystemState()));
854858
}
855859
tenantNodes.emplace(nodeId);

0 commit comments

Comments
 (0)