@@ -12,14 +12,13 @@ TString MakeData(ui32 dataSize) {
12
12
return data;
13
13
}
14
14
15
- ui64 AggregateVDiskCounters (std::unique_ptr<TEnvironmentSetup>& env, const NKikimrBlobStorage::TBaseConfig& baseConfig,
16
- TString storagePool, ui32 groupSize, ui32 groupId, const std::vector<ui32>& pdiskLayout, TString subsystem,
17
- TString counter, bool derivative = false ) {
15
+ ui64 AggregateVDiskCounters (std::unique_ptr<TEnvironmentSetup>& env, TString storagePool, ui32 nodesCount, ui32 groupId,
16
+ const std::vector<ui32>& pdiskLayout, TString subsystem, TString counter, bool derivative = false ) {
18
17
ui64 ctr = 0 ;
19
18
20
- for (const auto & vslot : baseConfig. GetVSlot () ) {
21
- auto * appData = env->Runtime ->GetNode (vslot. GetVSlotId (). GetNodeId () )->AppData .get ();
22
- for (ui32 i = 0 ; i < groupSize ; ++i) {
19
+ for (ui32 nodeId = 1 ; nodeId <= nodesCount; ++nodeId ) {
20
+ auto * appData = env->Runtime ->GetNode (nodeId )->AppData .get ();
21
+ for (ui32 i = 0 ; i < nodesCount ; ++i) {
23
22
ctr += GetServiceCounters (appData->Counters , " vdisks" )->
24
23
GetSubgroup (" storagePool" , storagePool)->
25
24
GetSubgroup (" group" , std::to_string (groupId))->
@@ -34,8 +33,7 @@ ui64 AggregateVDiskCounters(std::unique_ptr<TEnvironmentSetup>& env, const NKiki
34
33
};
35
34
36
35
void SetupEnv (const TBlobStorageGroupInfo::TTopology& topology, std::unique_ptr<TEnvironmentSetup>& env,
37
- NKikimrBlobStorage::TBaseConfig& baseConfig, ui32& groupSize, TBlobStorageGroupType& groupType,
38
- ui32& groupId, std::vector<ui32>& pdiskLayout) {
36
+ ui32& groupSize, TBlobStorageGroupType& groupType, ui32& groupId, std::vector<ui32>& pdiskLayout) {
39
37
groupSize = topology.TotalVDisks ;
40
38
groupType = topology.GType ;
41
39
env.reset (new TEnvironmentSetup ({
@@ -51,7 +49,7 @@ void SetupEnv(const TBlobStorageGroupInfo::TTopology& topology, std::unique_ptr<
51
49
request.AddCommand ()->MutableQueryBaseConfig ();
52
50
auto response = env->Invoke (request);
53
51
54
- baseConfig = response.GetStatus (0 ).GetBaseConfig ();
52
+ const auto & baseConfig = response.GetStatus (0 ).GetBaseConfig ();
55
53
UNIT_ASSERT_VALUES_EQUAL (baseConfig.GroupSize (), 1 );
56
54
groupId = baseConfig.GetGroup (0 ).GetGroupId ();
57
55
pdiskLayout.resize (groupSize);
@@ -67,51 +65,79 @@ void SetupEnv(const TBlobStorageGroupInfo::TTopology& topology, std::unique_ptr<
67
65
template <typename TInflightActor>
68
66
void TestDSProxyAndVDiskEqualCost (const TBlobStorageGroupInfo::TTopology& topology, TInflightActor* actor) {
69
67
std::unique_ptr<TEnvironmentSetup> env;
70
- NKikimrBlobStorage::TBaseConfig baseConfig;
71
68
ui32 groupSize;
72
69
TBlobStorageGroupType groupType;
73
70
ui32 groupId;
74
71
std::vector<ui32> pdiskLayout;
75
- SetupEnv (topology, env, baseConfig, groupSize, groupType, groupId, pdiskLayout);
72
+ SetupEnv (topology, env, groupSize, groupType, groupId, pdiskLayout);
76
73
77
74
ui64 dsproxyCost = 0 ;
78
75
ui64 vdiskCost = 0 ;
76
+ ui64 queuePut = 0 ;
77
+ ui64 queueSent = 0 ;
78
+
79
+ std::vector<TString> priorities = {
80
+ " GetAsyncRead" , " GetDiscover" , " GetFastRead" , " GetLowRead" ,
81
+ " PutAsyncBlob" , " PutTabletLog" , " PutUserData"
82
+ };
79
83
80
84
auto updateCounters = [&]() {
81
85
dsproxyCost = 0 ;
86
+ queuePut = 0 ;
87
+ queueSent = 0 ;
82
88
83
- for (const auto & vslot : baseConfig. GetVSlot () ) {
84
- auto * appData = env->Runtime ->GetNode (vslot. GetVSlotId (). GetNodeId () )->AppData .get ();
89
+ for (ui32 nodeId = 1 ; nodeId <= groupSize; ++nodeId ) {
90
+ auto * appData = env->Runtime ->GetNode (nodeId )->AppData .get ();
85
91
dsproxyCost += GetServiceCounters (appData->Counters , " dsproxynode" )->
86
92
GetSubgroup (" subsystem" , " request" )->
87
93
GetSubgroup (" storagePool" , env->StoragePoolName )->
88
94
GetCounter (" DSProxyDiskCostNs" )->Val ();
95
+
96
+ for (TString priority : priorities) {
97
+ queuePut += GetServiceCounters (appData->Counters , " dsproxy_queue" )->
98
+ GetSubgroup (" queue" , priority)->
99
+ GetCounter (" QueueItemsPut" )->Val ();
100
+ queueSent += GetServiceCounters (appData->Counters , " dsproxy_queue" )->
101
+ GetSubgroup (" queue" , priority)->
102
+ GetCounter (" QueueItemsSent" )->Val ();
103
+ }
89
104
}
90
- vdiskCost = AggregateVDiskCounters (env, baseConfig, env->StoragePoolName , groupSize, groupId,
91
- pdiskLayout, " cost" , " SkeletonFrontUserCostNs" );
105
+ vdiskCost = AggregateVDiskCounters (env, env->StoragePoolName , groupSize, groupId, pdiskLayout ,
106
+ " cost" , " SkeletonFrontUserCostNs" );
92
107
};
93
108
94
109
updateCounters ();
95
110
UNIT_ASSERT_VALUES_EQUAL (dsproxyCost, vdiskCost);
96
111
97
112
actor->SetGroupId (groupId);
98
113
env->Runtime ->Register (actor, 1 );
99
- env->Sim (TDuration::Minutes (15 ));
114
+ env->Sim (TDuration::Minutes (5 ));
100
115
116
+ updateCounters ();
117
+ env->Sim (TDuration::Minutes (5 ));
101
118
updateCounters ();
102
119
103
120
TStringStream str;
104
121
double proportion = 1 . * dsproxyCost / vdiskCost;
105
122
i64 diff = (i64)dsproxyCost - vdiskCost;
106
- str << " OKs# " << actor->ResponsesByStatus [NKikimrProto::OK] << " , Errors# " << actor->ResponsesByStatus [NKikimrProto::ERROR]
107
- << " , Cost on dsproxy# " << dsproxyCost << " , Cost on vdisks# " << vdiskCost << " , proportion# " << proportion
108
- << " diff# " << diff;
123
+ ui32 oks = actor->ResponsesByStatus [NKikimrProto::OK];
124
+ ui32 errors = actor->ResponsesByStatus [NKikimrProto::ERROR];
125
+ str << " OKs# " << oks << " , Errors# " << errors << " , QueueItemsPut# " << queuePut
126
+ << " , QueueItemsSent# " << queueSent << " , Cost on dsproxy# " << dsproxyCost
127
+ << " , Cost on vdisks# " << vdiskCost << " , proportion# " << proportion << " diff# " << diff;
109
128
110
129
if constexpr (VERBOSE) {
111
130
Cerr << str.Str () << Endl;
112
- // env->Runtime->GetAppData()->Counters->OutputPlainText(Cerr);
131
+ for (ui32 i = 1 ; i <= groupSize; ++i) {
132
+ Cerr << " ##################### Node " << i << " ##################### " << Endl;
133
+ env->Runtime ->GetNode (i)->AppData ->Counters ->OutputPlainText (Cerr);
134
+ }
135
+ }
136
+
137
+ if (dsproxyCost == vdiskCost) {
138
+ return ;
113
139
}
114
- UNIT_ASSERT_VALUES_EQUAL_C (dsproxyCost, vdiskCost , str.Str ());
140
+ UNIT_ASSERT_C (oks != actor-> RequestsSent || queuePut != queueSent , str.Str ());
115
141
}
116
142
117
143
#define MAKE_TEST (erasure, requestType, requests, inflight ) \
@@ -190,7 +216,6 @@ Y_UNIT_TEST_SUITE(CostMetricsGetHugeMirror3dc) {
190
216
MAKE_TEST_W_DATASIZE (Mirror3dc, Get, 2 , 2 , 2000000 );
191
217
MAKE_TEST_W_DATASIZE (Mirror3dc, Get, 10 , 10 , 2000000 );
192
218
MAKE_TEST_W_DATASIZE (Mirror3dc, Get, 100 , 10 , 2000000 );
193
- MAKE_TEST_W_DATASIZE (Mirror3dc, Get, 10000 , 100 , 2000000 );
194
219
}
195
220
196
221
Y_UNIT_TEST_SUITE (CostMetricsPatchMirror3dc) {
@@ -221,19 +246,18 @@ enum class ELoadDistribution : ui8 {
221
246
template <typename TInflightActor>
222
247
void TestBurst (const TBlobStorageGroupInfo::TTopology& topology, TInflightActor* actor, ELoadDistribution loadDistribution) {
223
248
std::unique_ptr<TEnvironmentSetup> env;
224
- NKikimrBlobStorage::TBaseConfig baseConfig;
225
249
ui32 groupSize;
226
250
TBlobStorageGroupType groupType;
227
251
ui32 groupId;
228
252
std::vector<ui32> pdiskLayout;
229
- SetupEnv (topology, env, baseConfig, groupSize, groupType, groupId, pdiskLayout);
253
+ SetupEnv (topology, env, groupSize, groupType, groupId, pdiskLayout);
230
254
231
255
actor->SetGroupId (groupId);
232
256
env->Runtime ->Register (actor, 1 );
233
257
env->Sim (TDuration::Minutes (10 ));
234
258
235
- ui64 redMs = AggregateVDiskCounters (env, baseConfig, env->StoragePoolName , groupSize, groupId,
236
- pdiskLayout, " advancedCost" , " BurstDetector_redMs" );
259
+ ui64 redMs = AggregateVDiskCounters (env, env->StoragePoolName , groupSize, groupId, pdiskLayout ,
260
+ " advancedCost" , " BurstDetector_redMs" );
237
261
238
262
if (loadDistribution == ELoadDistribution::DistributionBurst) {
239
263
UNIT_ASSERT_VALUES_UNEQUAL (redMs, 0 );
0 commit comments