diff options
author | Aleksandr Dmitriev <monster@ydb.tech> | 2024-12-24 18:56:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-24 18:56:25 +0300 |
commit | 9b24da37ced803bb03b1b03348ace99673a40e4c (patch) | |
tree | ac34161be8caa5740aa7451c80755ef1c734f9a2 | |
parent | cf344b64297e6a79d1e538be9f8f59afb06a2a97 (diff) | |
download | ydb-9b24da37ced803bb03b1b03348ace99673a40e4c.tar.gz |
make throttling parameters configurable via CMS (#12911)
9 files changed, 79 insertions, 50 deletions
diff --git a/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp b/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp index 82e4577d23..38dc783a11 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp @@ -30,6 +30,11 @@ TNodeWarden::TNodeWarden(const TIntrusivePtr<TNodeWardenConfig> &cfg) , MaxSyncLogChunksInFlightSSD(10, 1, 1024) , DefaultHugeGarbagePerMille(300, 1, 1000) , HugeDefragFreeSpaceBorderPerMille(260, 1, 1000) + , ThrottlingDeviceSpeed(50 << 20, 1 << 20, 10ull << 30) + , ThrottlingMinSstCount(100, 1, 1000) + , ThrottlingMaxSstCount(250, 1, 1000) + , ThrottlingMinInplacedSize(20ull << 30, 1 << 20, 500ull < 30) + , ThrottlingMaxInplacedSize(60ull << 30, 1 << 20, 500ull < 30) , MaxCommonLogChunksHDD(200, 1, 1'000'000) , MaxCommonLogChunksSSD(200, 1, 1'000'000) , CostMetricsParametersByMedia({ @@ -336,6 +341,13 @@ void TNodeWarden::Bootstrap() { icb->RegisterSharedControl(MaxSyncLogChunksInFlightSSD, "VDiskControls.MaxSyncLogChunksInFlightSSD"); icb->RegisterSharedControl(DefaultHugeGarbagePerMille, "VDiskControls.DefaultHugeGarbagePerMille"); icb->RegisterSharedControl(HugeDefragFreeSpaceBorderPerMille, "VDiskControls.HugeDefragFreeSpaceBorderPerMille"); + + icb->RegisterSharedControl(ThrottlingDeviceSpeed, "VDiskControls.ThrottlingDeviceSpeed"); + icb->RegisterSharedControl(ThrottlingMinSstCount, "VDiskControls.ThrottlingMinSstCount"); + icb->RegisterSharedControl(ThrottlingMaxSstCount, "VDiskControls.ThrottlingMaxSstCount"); + icb->RegisterSharedControl(ThrottlingMinInplacedSize, "VDiskControls.ThrottlingMinInplacedSize"); + icb->RegisterSharedControl(ThrottlingMaxInplacedSize, "VDiskControls.ThrottlingMaxInplacedSize"); + icb->RegisterSharedControl(MaxCommonLogChunksHDD, "PDiskControls.MaxCommonLogChunksHDD"); icb->RegisterSharedControl(MaxCommonLogChunksSSD, "PDiskControls.MaxCommonLogChunksSSD"); diff --git a/ydb/core/blobstorage/nodewarden/node_warden_impl.h b/ydb/core/blobstorage/nodewarden/node_warden_impl.h index f2fac07a1c..3410d1545c 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_impl.h +++ b/ydb/core/blobstorage/nodewarden/node_warden_impl.h @@ -168,6 +168,13 @@ namespace NKikimr::NStorage { TControlWrapper MaxSyncLogChunksInFlightSSD; TControlWrapper DefaultHugeGarbagePerMille; TControlWrapper HugeDefragFreeSpaceBorderPerMille; + + TControlWrapper ThrottlingDeviceSpeed; + TControlWrapper ThrottlingMinSstCount; + TControlWrapper ThrottlingMaxSstCount; + TControlWrapper ThrottlingMinInplacedSize; + TControlWrapper ThrottlingMaxInplacedSize; + TControlWrapper MaxCommonLogChunksHDD; TControlWrapper MaxCommonLogChunksSSD; diff --git a/ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp b/ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp index 23e450a1b0..4b1c43780b 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp @@ -199,6 +199,12 @@ namespace NKikimr::NStorage { vdiskConfig->MaxSyncLogChunksInFlight = MaxSyncLogChunksInFlightSSD; } + vdiskConfig->ThrottlingDeviceSpeed = ThrottlingDeviceSpeed; + vdiskConfig->ThrottlingMinSstCount = ThrottlingMinSstCount; + vdiskConfig->ThrottlingMaxSstCount = ThrottlingMaxSstCount; + vdiskConfig->ThrottlingMinInplacedSize = ThrottlingMinInplacedSize; + vdiskConfig->ThrottlingMaxInplacedSize = ThrottlingMaxInplacedSize; + vdiskConfig->CostMetricsParametersByMedia = CostMetricsParametersByMedia; vdiskConfig->FeatureFlags = Cfg->FeatureFlags; diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_config.h b/ydb/core/blobstorage/vdisk/common/vdisk_config.h index 5cc9332bb5..246a10ce89 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_config.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_config.h @@ -242,6 +242,13 @@ namespace NKikimr { bool UseCostTracker = true; TCostMetricsParametersByMedia CostMetricsParametersByMedia; + ///////////// THROTTLING SETTINGS ////////////////// + TControlWrapper ThrottlingDeviceSpeed; + TControlWrapper ThrottlingMinSstCount; + TControlWrapper ThrottlingMaxSstCount; + TControlWrapper ThrottlingMinInplacedSize; + TControlWrapper ThrottlingMaxInplacedSize; + ///////////// FEATURE FLAGS //////////////////////// NKikimrConfig::TFeatureFlags FeatureFlags; diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp index c6d147b5bc..96c744a9a2 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp @@ -1982,7 +1982,7 @@ namespace NKikimr { this->PrivateHandle(ev, ctx); }; NMonGroup::TSkeletonOverloadGroup overloadMonGroup(VCtx->VDiskCounters, "subsystem", "emergency"); - OverloadHandler = std::make_unique<TOverloadHandler>(VCtx, PDiskCtx, Hull, + OverloadHandler = std::make_unique<TOverloadHandler>(Config, VCtx, PDiskCtx, Hull, std::move(overloadMonGroup), std::move(vMovedPatch), std::move(vPatchStart), std::move(vput), std::move(vMultiPutHandler), std::move(loc), std::move(aoput)); ScheduleWakeupEmergencyPutQueue(ctx); @@ -1990,8 +1990,6 @@ namespace NKikimr { // actualize weights before we start OverloadHandler->ActualizeWeights(ctx, AllEHullDbTypes, true); - OverloadHandler->RegisterIcbControls(AppData()->Icb); - // run Anubis if (Config->RunAnubis && !Config->BaseInfo.DonorMode) { auto anubisCtx = std::make_shared<TAnubisCtx>(HullCtx, ctx.SelfID, diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.cpp b/ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.cpp index 911069ef86..02c8ed4d26 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.cpp @@ -180,31 +180,7 @@ namespace NKikimr { class TThrottlingController { private: NMonGroup::TSkeletonOverloadGroup& Mon; - - struct TControls { - TControlWrapper DeviceSpeed; - TControlWrapper MinSstCount; - TControlWrapper MaxSstCount; - TControlWrapper MinInplacedSize; - TControlWrapper MaxInplacedSize; - - TControls() - : DeviceSpeed(50 << 20, 1 << 20, 1 << 30) - , MinSstCount(100, 1, 1000) - , MaxSstCount(250, 1, 1000) - , MinInplacedSize(20ull << 30, 0, 500ull < 30) - , MaxInplacedSize(60ull << 30, 0, 500ull < 30) - {} - - void Register(TIntrusivePtr<TControlBoard> icb) { - icb->RegisterSharedControl(DeviceSpeed, "VDiskControls.ThrottlingDeviceSpeed"); - icb->RegisterSharedControl(MinSstCount, "VDiskControls.ThrottlingMinSstCount"); - icb->RegisterSharedControl(MaxSstCount, "VDiskControls.ThrottlingMaxSstCount"); - icb->RegisterSharedControl(MinInplacedSize, "VDiskControls.ThrottlingMinInplacedSize"); - icb->RegisterSharedControl(MaxInplacedSize, "VDiskControls.ThrottlingMaxInplacedSize"); - } - }; - TControls Controls; + TIntrusivePtr<TVDiskConfig> VCfg; ui64 CurrentSstCount = 0; ui64 CurrentInplacedSize = 0; @@ -228,17 +204,17 @@ namespace NKikimr { } ui64 CalcSstCountSpeedLimit() const { - ui64 deviceSpeed = (ui64)Controls.DeviceSpeed; - ui64 minSstCount = (ui64)Controls.MinSstCount; - ui64 maxSstCount = (ui64)Controls.MaxSstCount; + ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed; + ui64 minSstCount = (ui64)VCfg->ThrottlingMinSstCount; + ui64 maxSstCount = (ui64)VCfg->ThrottlingMaxSstCount; return LinearInterpolation(CurrentSstCount, minSstCount, maxSstCount, deviceSpeed); } ui64 CalcInplacedSizeSpeedLimit() const { - ui64 deviceSpeed = (ui64)Controls.DeviceSpeed; - ui64 minInplacedSize = (ui64)Controls.MinInplacedSize; - ui64 maxInplacedSize = (ui64)Controls.MaxInplacedSize; + ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed; + ui64 minInplacedSize = (ui64)VCfg->ThrottlingMinInplacedSize; + ui64 maxInplacedSize = (ui64)VCfg->ThrottlingMaxInplacedSize; return LinearInterpolation(CurrentInplacedSize, minInplacedSize, maxInplacedSize, deviceSpeed); } @@ -250,17 +226,16 @@ namespace NKikimr { } public: - explicit TThrottlingController(NMonGroup::TSkeletonOverloadGroup& mon) + explicit TThrottlingController( + const TIntrusivePtr<TVDiskConfig> &vcfg, + NMonGroup::TSkeletonOverloadGroup& mon) : Mon(mon) + , VCfg(vcfg) {} - void RegisterIcbControls(TIntrusivePtr<TControlBoard> icb) { - Controls.Register(icb); - } - bool IsActive() const { - ui64 minSstCount = (ui64)Controls.MinSstCount; - ui64 minInplacedSize = (ui64)Controls.MinInplacedSize; + ui64 minSstCount = (ui64)VCfg->ThrottlingMinSstCount; + ui64 minInplacedSize = (ui64)VCfg->ThrottlingMinInplacedSize; return CurrentSstCount > minSstCount || CurrentInplacedSize > minInplacedSize; @@ -297,7 +272,7 @@ namespace NKikimr { if (!IsActive()) { CurrentTime = {}; AvailableBytes = 0; - CurrentSpeedLimit = (ui64)Controls.DeviceSpeed; + CurrentSpeedLimit = (ui64)VCfg->ThrottlingDeviceSpeed; } else { if (!prevActive) { CurrentTime = now; @@ -315,7 +290,7 @@ namespace NKikimr { } auto us = (now - CurrentTime).MicroSeconds(); AvailableBytes += CurrentSpeedLimit * us / 1000000; - ui64 deviceSpeed = (ui64)Controls.DeviceSpeed; + ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed; AvailableBytes = Min(AvailableBytes, deviceSpeed); CurrentTime = now; } @@ -325,6 +300,7 @@ namespace NKikimr { // TOverloadHandler /////////////////////////////////////////////////////////////////////////////////////////////////// TOverloadHandler::TOverloadHandler( + const TIntrusivePtr<TVDiskConfig> &vcfg, const TIntrusivePtr<TVDiskContext> &vctx, const TPDiskCtxPtr &pdiskCtx, std::shared_ptr<THull> hull, @@ -340,7 +316,7 @@ namespace NKikimr { , EmergencyQueue(new TEmergencyQueue(Mon, std::move(vMovedPatch), std::move(vPatchStart), std::move(vput), std::move(vMultiPut), std::move(loc), std::move(aoput))) , DynamicPDiskWeightsManager(std::make_shared<TDynamicPDiskWeightsManager>(vctx, pdiskCtx)) - , ThrottlingController(new TThrottlingController(Mon)) + , ThrottlingController(new TThrottlingController(vcfg, Mon)) {} TOverloadHandler::~TOverloadHandler() {} @@ -462,10 +438,6 @@ namespace NKikimr { KickInFlight = false; } - void TOverloadHandler::RegisterIcbControls(TIntrusivePtr<TControlBoard> icb) { - ThrottlingController->RegisterIcbControls(icb); - } - template <class TEv> inline bool TOverloadHandler::PostponeEvent(TAutoPtr<TEventHandle<TEv>> &ev) { if (DynamicPDiskWeightsManager->StopPuts() || diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.h b/ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.h index c3cfe29c04..2e318bae22 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.h +++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.h @@ -61,6 +61,7 @@ namespace NKikimr { class TOverloadHandler { public: TOverloadHandler( + const TIntrusivePtr<TVDiskConfig> &vcfg, const TIntrusivePtr<TVDiskContext> &vctx, const TPDiskCtxPtr &pdiskCtx, std::shared_ptr<THull> hull, @@ -91,8 +92,6 @@ namespace NKikimr { void OnKickEmergencyPutQueue(); - void RegisterIcbControls(TIntrusivePtr<TControlBoard> icb); - private: std::shared_ptr<THull> Hull; NMonGroup::TSkeletonOverloadGroup Mon; diff --git a/ydb/core/cms/json_proxy_proto.h b/ydb/core/cms/json_proxy_proto.h index 5d6e82d847..d7983e9b2d 100644 --- a/ydb/core/cms/json_proxy_proto.h +++ b/ydb/core/cms/json_proxy_proto.h @@ -86,6 +86,8 @@ protected: return ReplyWithTypeDescription(*NKikimrConfig::TImmediateControlsConfig::TDSProxyControls::descriptor(), ctx); else if (name == ".NKikimrConfig.TImmediateControlsConfig.TBlobStorageControllerControls") return ReplyWithTypeDescription(*NKikimrConfig::TImmediateControlsConfig::TBlobStorageControllerControls::descriptor(), ctx); + else if (name == ".NKikimrConfig.TImmediateControlsConfig.TTableServiceControls") + return ReplyWithTypeDescription(*NKikimrConfig::TImmediateControlsConfig::TTableServiceControls::descriptor(), ctx); } ctx.Send(RequestEvent->Sender, diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto index db850708b0..921edfcd74 100644 --- a/ydb/core/protos/config.proto +++ b/ydb/core/protos/config.proto @@ -1375,6 +1375,32 @@ message TImmediateControlsConfig { MinValue: 1, MaxValue: 1000, DefaultValue: 260 }]; + + optional uint64 ThrottlingDeviceSpeed = 14 [(ControlOptions) = { + Description: "Maximum allowed speed when throttling is active", + MinValue: 1048576, + MaxValue: 10737418240, + DefaultValue: 52428800 }]; + optional uint64 ThrottlingMinSstCount = 15 [(ControlOptions) = { + Description: "Minimum level 0 SST count - throttling is turned on", + MinValue: 1, + MaxValue: 1000, + DefaultValue: 100 }]; + optional uint64 ThrottlingMaxSstCount = 16 [(ControlOptions) = { + Description: "Maximum level 0 SST count - throttling speed is zero", + MinValue: 1, + MaxValue: 1000, + DefaultValue: 250 }]; + optional uint64 ThrottlingMinInplacedSize = 17 [(ControlOptions) = { + Description: "Minimum size of all inplaced blobs - throttling is turned on", + MinValue: 1048576, + MaxValue: 536870912000, + DefaultValue: 21474836480 }]; + optional uint64 ThrottlingMaxInplacedSize = 18 [(ControlOptions) = { + Description: "Maximum size of all inplaced blobs - throttling speed is zero", + MinValue: 1048576, + MaxValue: 536870912000, + DefaultValue: 64424509440 }]; } message TTabletControls { |