Skip to content

Commit 69317a4

Browse files
authored
Merge double accelerations into 24-3 (#11740)
1 parent 3f50d43 commit 69317a4

File tree

79 files changed

+2150
-1012
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2150
-1012
lines changed

ydb/core/base/blobstorage.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ struct TEvBlobStorage {
488488
EvInplacePatch,
489489
EvAssimilate,
490490

491+
EvGetQueuesInfo, // for debugging purposes
492+
491493
//
492494
EvPutResult = EvPut + 512, /// 268 632 576
493495
EvGetResult,
@@ -502,6 +504,8 @@ struct TEvBlobStorage {
502504
EvInplacePatchResult,
503505
EvAssimilateResult,
504506

507+
EvQueuesInfo, // for debugging purposes
508+
505509
// proxy <-> vdisk interface
506510
EvVPut = EvPut + 2 * 512, /// 268 633 088
507511
EvVGet,
@@ -869,6 +873,7 @@ struct TEvBlobStorage {
869873
EvRunActor = EvPut + 15 * 512,
870874
EvVMockCtlRequest,
871875
EvVMockCtlResponse,
876+
EvDelayedMessageWrapper,
872877

873878
// incremental huge blob keeper
874879
EvIncrHugeInit = EvPut + 17 * 512,

ydb/core/blobstorage/backpressure/common.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,39 @@
1515
#define QLOG_DEBUG_S(marker, arg) QLOG_LOG_S(marker, NActors::NLog::PRI_DEBUG , arg)
1616

1717
LWTRACE_USING(BLOBSTORAGE_PROVIDER);
18+
19+
namespace NKikimr::NBsQueue {
20+
21+
// Special timer for debug purposes, which works with virtual time of TTestActorSystem
22+
struct TActivationContextTimer {
23+
TActivationContextTimer()
24+
: CreationTimestamp(NActors::TActivationContext::Monotonic())
25+
{}
26+
27+
double Passed() const {
28+
return (NActors::TActivationContext::Monotonic() - CreationTimestamp).SecondsFloat();
29+
}
30+
31+
TMonotonic CreationTimestamp;
32+
};
33+
34+
struct TBSQueueTimer {
35+
TBSQueueTimer(bool useActorSystemTime)
36+
{
37+
if (useActorSystemTime) {
38+
Timer.emplace<TActivationContextTimer>();
39+
} else {
40+
Timer.emplace<THPTimer>();
41+
}
42+
}
43+
44+
std::variant<THPTimer, TActivationContextTimer> Timer;
45+
46+
double Passed() const {
47+
return std::visit([](const auto& timer) -> double {
48+
return timer.Passed();
49+
}, Timer);
50+
}
51+
};
52+
53+
} // namespace NKikimr::NBsQueue

ydb/core/blobstorage/backpressure/event.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ IEventBase *TEventHolder::MakeErrorReply(NKikimrProto::EReplyStatus status, cons
2727

2828
void TEventHolder::SendToVDisk(const TActorContext& ctx, const TActorId& remoteVDisk, ui64 queueCookie, ui64 msgId,
2929
ui64 sequenceId, bool sendMeCostSettings, NWilson::TTraceId traceId, const NBackpressure::TQueueClientId& clientId,
30-
const THPTimer& processingTimer) {
30+
const TBSQueueTimer& processingTimer) {
3131
// check that we are not discarded yet
3232
Y_ABORT_UNLESS(Type != 0);
3333

ydb/core/blobstorage/backpressure/event.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class TEventHolder {
142142

143143
void SendToVDisk(const TActorContext& ctx, const TActorId& remoteVDisk, ui64 queueCookie, ui64 msgId, ui64 sequenceId,
144144
bool sendMeCostSettings, NWilson::TTraceId traceId, const NBackpressure::TQueueClientId& clientId,
145-
const THPTimer& processingTimer);
145+
const TBSQueueTimer& processingTimer);
146146

147147
void Discard();
148148
};

ydb/core/blobstorage/backpressure/queue.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace NKikimr::NBsQueue {
44

55
TBlobStorageQueue::TBlobStorageQueue(const TIntrusivePtr<::NMonitoring::TDynamicCounters>& counters, TString& logPrefix,
66
const TBSProxyContextPtr& bspctx, const NBackpressure::TQueueClientId& clientId, ui32 interconnectChannel,
7-
const TBlobStorageGroupType& gType, NMonitoring::TCountableBase::EVisibility visibility)
7+
const TBlobStorageGroupType& gType, NMonitoring::TCountableBase::EVisibility visibility, bool useActorSystemTime)
88
: Queues(bspctx)
99
, WindowSize(0)
1010
, InFlightCost(0)
@@ -16,6 +16,7 @@ TBlobStorageQueue::TBlobStorageQueue(const TIntrusivePtr<::NMonitoring::TDynamic
1616
, ClientId(clientId)
1717
, BytesWaiting(0)
1818
, InterconnectChannel(interconnectChannel)
19+
, UseActorSystemTime(useActorSystemTime)
1920
// use parent group visibility
2021
, QueueWaitingItems(counters->GetCounter("QueueWaitingItems", false, visibility))
2122
, QueueWaitingBytes(counters->GetCounter("QueueWaitingBytes", false, visibility))

ydb/core/blobstorage/backpressure/queue.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ class TBlobStorageQueue {
5151
const ui64 QueueCookie;
5252
ui64 Cost;
5353
bool DirtyCost;
54-
THPTimer ProcessingTimer;
54+
TBSQueueTimer ProcessingTimer;
55+
5556
TTrackableList<TItem>::iterator Iterator;
5657

5758
template<typename TEvent>
5859
TItem(TAutoPtr<TEventHandle<TEvent>>& event, TInstant deadline,
5960
const ::NMonitoring::TDynamicCounters::TCounterPtr& serItems,
6061
const ::NMonitoring::TDynamicCounters::TCounterPtr& serBytes,
6162
const TBSProxyContextPtr& bspctx, ui32 interconnectChannel,
62-
bool local)
63+
bool local, bool useActorSystemTime)
6364
: Queue(EItemQueue::NotSet)
6465
, CostEssence(*event->Get())
6566
, Span(TWilson::VDiskTopLevel, std::move(event->TraceId), "Backpressure.InFlight")
@@ -70,6 +71,7 @@ class TBlobStorageQueue {
7071
, QueueCookie(RandomNumber<ui64>())
7172
, Cost(0)
7273
, DirtyCost(true)
74+
, ProcessingTimer(useActorSystemTime)
7375
{
7476
if (Span) {
7577
Span
@@ -129,6 +131,8 @@ class TBlobStorageQueue {
129131

130132
const ui32 InterconnectChannel;
131133

134+
const bool UseActorSystemTime;
135+
132136
public:
133137
::NMonitoring::TDynamicCounters::TCounterPtr QueueWaitingItems;
134138
::NMonitoring::TDynamicCounters::TCounterPtr QueueWaitingBytes;
@@ -156,7 +160,8 @@ class TBlobStorageQueue {
156160
TBlobStorageQueue(const TIntrusivePtr<::NMonitoring::TDynamicCounters>& counters, TString& logPrefix,
157161
const TBSProxyContextPtr& bspctx, const NBackpressure::TQueueClientId& clientId, ui32 interconnectChannel,
158162
const TBlobStorageGroupType &gType,
159-
NMonitoring::TCountableBase::EVisibility visibility = NMonitoring::TCountableBase::EVisibility::Public);
163+
NMonitoring::TCountableBase::EVisibility visibility = NMonitoring::TCountableBase::EVisibility::Public,
164+
bool useActorSystemTime = false);
160165

161166
~TBlobStorageQueue();
162167

@@ -213,7 +218,8 @@ class TBlobStorageQueue {
213218
TItemList::iterator newIt;
214219
if (Queues.Unused.empty()) {
215220
newIt = Queues.Waiting.emplace(Queues.Waiting.end(), event, deadline,
216-
QueueSerializedItems, QueueSerializedBytes, BSProxyCtx, InterconnectChannel, local);
221+
QueueSerializedItems, QueueSerializedBytes, BSProxyCtx, InterconnectChannel, local,
222+
UseActorSystemTime);
217223
++*QueueSize;
218224
} else {
219225
newIt = Queues.Unused.begin();
@@ -222,7 +228,7 @@ class TBlobStorageQueue {
222228
TItem& item = *newIt;
223229
item.~TItem();
224230
new(&item) TItem(event, deadline, QueueSerializedItems, QueueSerializedBytes, BSProxyCtx,
225-
InterconnectChannel, local);
231+
InterconnectChannel, local, UseActorSystemTime);
226232
}
227233

228234
newIt->Iterator = newIt;

ydb/core/blobstorage/backpressure/queue_backpressure_client.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ class TVDiskBackpressureClientActor : public TActorBootstrapped<TVDiskBackpressu
7777
NKikimrBlobStorage::EVDiskQueueId queueId,const TIntrusivePtr<::NMonitoring::TDynamicCounters>& counters,
7878
const TBSProxyContextPtr& bspctx, const NBackpressure::TQueueClientId& clientId, const TString& queueName,
7979
ui32 interconnectChannel, bool /*local*/, TDuration watchdogTimeout,
80-
TIntrusivePtr<NBackpressure::TFlowRecord> &flowRecord, NMonitoring::TCountableBase::EVisibility visibility)
80+
TIntrusivePtr<NBackpressure::TFlowRecord> &flowRecord, NMonitoring::TCountableBase::EVisibility visibility,
81+
bool useActorSystemTime)
8182
: BSProxyCtx(bspctx)
8283
, QueueName(queueName)
8384
, Counters(counters->GetSubgroup("queue", queueName))
8485
, Queue(Counters, LogPrefix, bspctx, clientId, interconnectChannel,
85-
(info ? info->Type : TErasureType::ErasureNone), visibility)
86+
(info ? info->Type : TErasureType::ErasureNone), visibility, useActorSystemTime)
8687
, VDiskIdShort(vdiskId)
8788
, QueueId(queueId)
8889
, QueueWatchdogTimeout(watchdogTimeout)
@@ -975,9 +976,10 @@ IActor* CreateVDiskBackpressureClient(const TIntrusivePtr<TBlobStorageGroupInfo>
975976
NKikimrBlobStorage::EVDiskQueueId queueId,const TIntrusivePtr<::NMonitoring::TDynamicCounters>& counters,
976977
const TBSProxyContextPtr& bspctx, const NBackpressure::TQueueClientId& clientId, const TString& queueName,
977978
ui32 interconnectChannel, bool local, TDuration watchdogTimeout,
978-
TIntrusivePtr<NBackpressure::TFlowRecord> &flowRecord, NMonitoring::TCountableBase::EVisibility visibility) {
979+
TIntrusivePtr<NBackpressure::TFlowRecord> &flowRecord, NMonitoring::TCountableBase::EVisibility visibility,
980+
bool useActorSystemTime) {
979981
return new NBsQueue::TVDiskBackpressureClientActor(info, vdiskId, queueId, counters, bspctx, clientId, queueName,
980-
interconnectChannel, local, watchdogTimeout, flowRecord, visibility);
982+
interconnectChannel, local, watchdogTimeout, flowRecord, visibility, useActorSystemTime);
981983
}
982984

983985
} // NKikimr

ydb/core/blobstorage/backpressure/queue_backpressure_client.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ namespace NKikimr {
5050
NKikimrBlobStorage::EVDiskQueueId queueId,const TIntrusivePtr<::NMonitoring::TDynamicCounters>& counters,
5151
const TBSProxyContextPtr& bspctx, const NBackpressure::TQueueClientId& clientId, const TString& queueName,
5252
ui32 interconnectChannel, bool local, TDuration watchdogTimeout,
53-
TIntrusivePtr<NBackpressure::TFlowRecord> &flowRecord, NMonitoring::TCountableBase::EVisibility visibility);
53+
TIntrusivePtr<NBackpressure::TFlowRecord> &flowRecord, NMonitoring::TCountableBase::EVisibility visibility,
54+
bool useActorSystemTime = false);
5455

5556
} // NKikimr

ydb/core/blobstorage/common/defs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#pragma once
2+
3+
#include <ydb/core/blobstorage/defs.h>
4+
#include <util/datetime/base.h>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "immediate_control_defaults.h"
2+
3+
namespace NKikimr {
4+
5+
TControlWrapper SlowDiskThresholdDefaultControl =
6+
TControlWrapper(std::round(DefaultSlowDiskThreshold * 1000), 1, 1'000'000);
7+
8+
TControlWrapper PredictedDelayMultiplierDefaultControl =
9+
TControlWrapper(std::round(DefaultPredictedDelayMultiplier * 1000), 0, 1'000'000);
10+
11+
TControlWrapper MaxNumOfSlowDisksDefaultControl =
12+
TControlWrapper(DefaultMaxNumOfSlowDisks, 1, 2);
13+
14+
} // namespace NKikimr
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
3+
#include "defs.h"
4+
#include <ydb/core/control/immediate_control_board_wrapper.h>
5+
6+
namespace NKikimr {
7+
8+
constexpr bool DefaultEnablePutBatching = true;
9+
constexpr bool DefaultEnableVPatch = false;
10+
11+
constexpr float DefaultSlowDiskThreshold = 2;
12+
constexpr float DefaultPredictedDelayMultiplier = 1;
13+
constexpr ui32 DefaultMaxNumOfSlowDisks = 2;
14+
15+
extern TControlWrapper SlowDiskThresholdDefaultControl;
16+
extern TControlWrapper PredictedDelayMultiplierDefaultControl;
17+
extern TControlWrapper MaxNumOfSlowDisksDefaultControl;
18+
}

ydb/core/blobstorage/common/ya.make

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
LIBRARY()
2+
3+
PEERDIR(
4+
ydb/core/base
5+
)
6+
7+
SRCS(
8+
immediate_control_defaults.cpp
9+
)
10+
11+
END()

0 commit comments

Comments
 (0)