Skip to content

Commit

Permalink
Introduce local hdd disks
Browse files Browse the repository at this point in the history
  • Loading branch information
komarevtsev-d committed Oct 16, 2024
1 parent c4f1132 commit c58b4cd
Show file tree
Hide file tree
Showing 24 changed files with 115 additions and 18 deletions.
5 changes: 5 additions & 0 deletions cloud/blockstore/libs/client/throttling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ class TThrottlerPolicy final
break;
}

case NCloud::NProto::STORAGE_MEDIA_SSD_LOCAL:
case NCloud::NProto::STORAGE_MEDIA_HDD_LOCAL:
Y_DEBUG_ABORT_UNLESS(false);
[[fallthrough]];

default: {
mediaKindProfile = &Profile.GetHDDProfile();
break;
Expand Down
1 change: 1 addition & 0 deletions cloud/blockstore/libs/diagnostics/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ TDuration GetDowntimeThreshold(
case NCloud::NProto::STORAGE_MEDIA_SSD_MIRROR2: {
return config.GetMirror2SSDDowntimeThreshold();
}
case NCloud::NProto::STORAGE_MEDIA_HDD_LOCAL:
case NCloud::NProto::STORAGE_MEDIA_SSD_LOCAL: {
return config.GetLocalSSDDowntimeThreshold();
}
Expand Down
18 changes: 18 additions & 0 deletions cloud/blockstore/libs/diagnostics/request_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class TRequestStats final
TRequestCounters TotalSSDMirror3;
TRequestCounters TotalSSDLocal;
TRequestCounters TotalHDDNonrepl;
TRequestCounters TotalHDDLocal;

THdrPercentiles HdrTotal;
THdrPercentiles HdrTotalSSD;
Expand All @@ -187,6 +188,7 @@ class TRequestStats final
THdrPercentiles HdrTotalSSDMirror3;
THdrPercentiles HdrTotalSSDLocal;
THdrPercentiles HdrTotalHDDNonrepl;
THdrPercentiles HdrTotalHDDLocal;

public:
TRequestStats(
Expand Down Expand Up @@ -241,6 +243,12 @@ class TRequestStats final
TRequestCounters::EOption::AddSpecialCounters |
TRequestCounters::EOption::OnlyReadWriteRequests,
histogramCounterOptions))
, TotalHDDLocal(MakeRequestCounters(
timer,
TRequestCounters::EOption::ReportDataPlaneHistogram |
TRequestCounters::EOption::AddSpecialCounters |
TRequestCounters::EOption::OnlyReadWriteRequests,
histogramCounterOptions))
{
Total.Register(*Counters);

Expand All @@ -265,6 +273,9 @@ class TRequestStats final
auto hddNonrepl = Counters->GetSubgroup("type", "hdd_nonrepl");
TotalHDDNonrepl.Register(*hddNonrepl);

auto hddLocal = Counters->GetSubgroup("type", "hdd_local");
TotalHDDLocal.Register(*hddLocal);

if (IsServerSide) {
HdrTotal.Register(*Counters);
HdrTotalSSD.Register(*ssd);
Expand All @@ -274,6 +285,7 @@ class TRequestStats final
HdrTotalSSDMirror3.Register(*ssdMirror3);
HdrTotalSSDLocal.Register(*ssdLocal);
HdrTotalHDDNonrepl.Register(*hddNonrepl);
HdrTotalHDDLocal.Register(*ssdLocal);
}
}

Expand Down Expand Up @@ -491,6 +503,7 @@ class TRequestStats final
TotalSSDMirror3.UpdateStats(updatePercentiles);
TotalSSDLocal.UpdateStats(updatePercentiles);
TotalHDDNonrepl.UpdateStats(updatePercentiles);
TotalHDDLocal.UpdateStats(updatePercentiles);

if (updatePercentiles && IsServerSide) {
HdrTotal.UpdateStats();
Expand All @@ -501,6 +514,7 @@ class TRequestStats final
HdrTotalSSDMirror3.UpdateStats();
HdrTotalSSDLocal.UpdateStats();
HdrTotalHDDNonrepl.UpdateStats();
HdrTotalHDDLocal.UpdateStats();
}
}

Expand All @@ -521,6 +535,8 @@ class TRequestStats final
return TotalSSDLocal;
case NCloud::NProto::STORAGE_MEDIA_HDD_NONREPLICATED:
return TotalHDDNonrepl;
case NCloud::NProto::STORAGE_MEDIA_HDD_LOCAL:
return TotalHDDLocal;
default:
return TotalHDD;
}
Expand All @@ -542,6 +558,8 @@ class TRequestStats final
return HdrTotalSSDLocal;
case NCloud::NProto::STORAGE_MEDIA_HDD_NONREPLICATED:
return HdrTotalHDDNonrepl;
case NCloud::NProto::STORAGE_MEDIA_HDD_LOCAL:
return HdrTotalHDDLocal;
default:
return HdrTotalHDD;
}
Expand Down
12 changes: 9 additions & 3 deletions cloud/blockstore/libs/diagnostics/volume_perf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ TVolumePerfSettings TVolumePerformanceCalculator::GetConfigSettings(
case NCloud::NProto::STORAGE_MEDIA_SSD_MIRROR3: {
return diagnosticsConfig->GetMirror3PerfSettings();
}
case NCloud::NProto::STORAGE_MEDIA_HDD_LOCAL:
case NCloud::NProto::STORAGE_MEDIA_SSD_LOCAL: {
return diagnosticsConfig->GetLocalSSDPerfSettings();
}
Expand Down Expand Up @@ -240,9 +241,14 @@ void TSufferCounters::PublishCounters()
"ssd_local",
RunCounters[NCloud::NProto::STORAGE_MEDIA_SSD_LOCAL]);

auto hddCount = RunCounters[NCloud::NProto::STORAGE_MEDIA_DEFAULT]
+ RunCounters[NCloud::NProto::STORAGE_MEDIA_HYBRID]
+ RunCounters[NCloud::NProto::STORAGE_MEDIA_HDD];
total += UpdateCounter(
HddLocal,
"hdd_local",
RunCounters[NCloud::NProto::STORAGE_MEDIA_HDD_LOCAL]);

ui64 hddCount = RunCounters[NCloud::NProto::STORAGE_MEDIA_DEFAULT] +
RunCounters[NCloud::NProto::STORAGE_MEDIA_HYBRID] +
RunCounters[NCloud::NProto::STORAGE_MEDIA_HDD];

total += UpdateCounter(Hdd, "hdd", hddCount);

Expand Down
1 change: 1 addition & 0 deletions cloud/blockstore/libs/diagnostics/volume_perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class TSufferCounters
TDynamicCounterPtr SsdMirror2;
TDynamicCounterPtr SsdMirror3;
TDynamicCounterPtr SsdLocal;
TDynamicCounterPtr HddLocal;

public:
explicit TSufferCounters(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,10 @@ class TExternalVhostEndpointListener final
const NProto::TStartEndpointRequest& request,
const NProto::TVolume& volume) const
{
return volume.GetStorageMediaKind() == NProto::STORAGE_MEDIA_SSD_LOCAL
&& request.GetVolumeMountMode() == NProto::VOLUME_MOUNT_LOCAL
&& request.GetIpcType() == NProto::IPC_VHOST;
return (volume.GetStorageMediaKind() == NProto::STORAGE_MEDIA_SSD_LOCAL ||
volume.GetStorageMediaKind() == NProto::STORAGE_MEDIA_HDD_LOCAL) &&
request.GetVolumeMountMode() == NProto::VOLUME_MOUNT_LOCAL &&
request.GetIpcType() == NProto::IPC_VHOST;
}

bool IsFastPathMode(
Expand Down
1 change: 1 addition & 0 deletions cloud/blockstore/libs/storage/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ ui64 GetAllocationUnit(
break;

case STORAGE_MEDIA_SSD_LOCAL:
case STORAGE_MEDIA_HDD_LOCAL:
unit = 4_KB; // custom pool can have any size
break;

Expand Down
2 changes: 2 additions & 0 deletions cloud/blockstore/libs/storage/core/volume_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ bool GetThrottlingEnabled(
{
switch (volumeParams.MediaKind) {
case NCloud::NProto::EStorageMediaKind::STORAGE_MEDIA_SSD_LOCAL:
case NCloud::NProto::EStorageMediaKind::STORAGE_MEDIA_HDD_LOCAL:
return false;
case NCloud::NProto::EStorageMediaKind::STORAGE_MEDIA_SSD:
return config.GetThrottlingEnabledSSD();
Expand All @@ -138,6 +139,7 @@ auto GetThrottlingBoostUnits(
return config.GetThrottlingSSDBoostUnits();

case NCloud::NProto::EStorageMediaKind::STORAGE_MEDIA_SSD_LOCAL:
case NCloud::NProto::EStorageMediaKind::STORAGE_MEDIA_HDD_LOCAL:
case NCloud::NProto::EStorageMediaKind::STORAGE_MEDIA_SSD_NONREPLICATED:
case NCloud::NProto::EStorageMediaKind::STORAGE_MEDIA_HDD_NONREPLICATED:
case NCloud::NProto::EStorageMediaKind::STORAGE_MEDIA_SSD_MIRROR2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ void TDiskRegistryActor::HandleCreateDiskFromDevices(
const auto& volume = record.GetVolumeConfig();

LOG_INFO(ctx, TBlockStoreComponents::DISK_REGISTRY,
"[%lu] Received CreateDiskFromDevices %s, %d, [ %s] %s",
"[%lu] Received CreateDiskFromDevices %s, %u, %u, [%s] %s",
TabletID(),
volume.GetDiskId().c_str(),
volume.GetBlockSize(),
volume.GetStorageMediaKind(),
[&] {
TStringStream out;
for (auto& d: record.GetDevices()) {
Expand All @@ -32,6 +33,18 @@ void TDiskRegistryActor::HandleCreateDiskFromDevices(
}().c_str(),
record.GetForce() ? "force" : "");

if (!NProto::EStorageMediaKind_IsValid(volume.GetStorageMediaKind())) {
auto response =
std::make_unique<TEvDiskRegistry::TEvCreateDiskFromDevicesResponse>(
std::move(MakeError(
E_ARGUMENT,
TStringBuilder()
<< "Storage Media kind %d"
<< volume.GetStorageMediaKind() << " is not valid.")));
NCloud::Reply(ctx, *ev, std::move(response));
return;
}

ExecuteTx<TCreateDiskFromDevices>(
ctx,
CreateRequestInfo<TEvDiskRegistry::TCreateDiskFromDevicesMethod>(
Expand All @@ -42,6 +55,7 @@ void TDiskRegistryActor::HandleCreateDiskFromDevices(
record.GetForce(),
volume.GetDiskId(),
volume.GetBlockSize(),
static_cast<NProto::EStorageMediaKind>(volume.GetStorageMediaKind()),
TVector<NProto::TDeviceConfig> (
record.GetDevices().begin(),
record.GetDevices().end())
Expand Down Expand Up @@ -74,6 +88,7 @@ void TDiskRegistryActor::ExecuteCreateDiskFromDevices(
args.Force,
args.DiskId,
args.BlockSize,
args.MediaKind,
args.Devices,
&result);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ void TDiskRegistryState::AllowNotifications(

if (disk.MediaKind == NProto::STORAGE_MEDIA_SSD_NONREPLICATED ||
disk.MediaKind == NProto::STORAGE_MEDIA_HDD_NONREPLICATED ||
disk.MediaKind == NProto::STORAGE_MEDIA_SSD_LOCAL)
disk.MediaKind == NProto::STORAGE_MEDIA_SSD_LOCAL ||
disk.MediaKind == NProto::STORAGE_MEDIA_HDD_LOCAL)
{
NotificationSystem.AllowNotifications(diskId);
}
Expand Down Expand Up @@ -582,8 +583,9 @@ void TDiskRegistryState::AddMigration(
const TString& diskId,
const TString& sourceDeviceId)
{
if (disk.MediaKind == NProto::STORAGE_MEDIA_SSD_LOCAL
|| disk.MediaKind == NProto::STORAGE_MEDIA_HDD_NONREPLICATED)
if (disk.MediaKind == NProto::STORAGE_MEDIA_SSD_LOCAL ||
disk.MediaKind == NProto::STORAGE_MEDIA_HDD_LOCAL ||
disk.MediaKind == NProto::STORAGE_MEDIA_HDD_NONREPLICATED)
{
return;
}
Expand Down Expand Up @@ -1959,7 +1961,10 @@ NProto::TError TDiskRegistryState::ValidateDiskLocation(
const TVector<NProto::TDeviceConfig>& diskDevices,
const TAllocateDiskParams& params) const
{
if (params.MediaKind != NProto::STORAGE_MEDIA_SSD_LOCAL || diskDevices.empty()) {
if ((params.MediaKind != NProto::STORAGE_MEDIA_SSD_LOCAL &&
params.MediaKind != NProto::STORAGE_MEDIA_HDD_LOCAL) ||
diskDevices.empty())
{
return {};
}

Expand Down Expand Up @@ -2023,7 +2028,9 @@ TResultOrError<TDeviceList::TAllocationQuery> TDiskRegistryState::PrepareAllocat
? NProto::DEVICE_POOL_KIND_DEFAULT
: NProto::DEVICE_POOL_KIND_GLOBAL;

if (params.MediaKind == NProto::STORAGE_MEDIA_SSD_LOCAL) {
if (params.MediaKind == NProto::STORAGE_MEDIA_SSD_LOCAL ||
params.MediaKind == NProto::STORAGE_MEDIA_HDD_LOCAL)
{
poolKind = NProto::DEVICE_POOL_KIND_LOCAL;
}

Expand Down Expand Up @@ -6965,6 +6972,7 @@ NProto::TError TDiskRegistryState::CreateDiskFromDevices(
bool force,
const TDiskId& diskId,
ui32 blockSize,
NProto::EStorageMediaKind mediaKind,
const TVector<NProto::TDeviceConfig>& devices,
TAllocateDiskResult* result)
{
Expand Down Expand Up @@ -7045,9 +7053,7 @@ NProto::TError TDiskRegistryState::CreateDiskFromDevices(
disk.LogicalBlockSize = blockSize;
disk.StateTs = now;
disk.State = CalculateDiskState(disk);
if (poolKind == NProto::DEVICE_POOL_KIND_LOCAL) {
disk.MediaKind = NProto::STORAGE_MEDIA_SSD_LOCAL;
}
disk.MediaKind = mediaKind;

for (auto& uuid: deviceIds) {
DeviceList.MarkDeviceAllocated(diskId, uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ class TDiskRegistryState
bool force,
const TDiskId& diskId,
ui32 blockSize,
NProto::EStorageMediaKind mediaKind,
const TVector<NProto::TDeviceConfig>& devices,
TAllocateDiskResult* result);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ struct TTxDiskRegistry
const bool Force;
const TString DiskId;
const ui32 BlockSize;
const NProto::EStorageMediaKind MediaKind;
const TVector<NProto::TDeviceConfig> Devices;

NProto::TError Error;
Expand All @@ -1155,11 +1156,13 @@ struct TTxDiskRegistry
bool force,
TString diskId,
ui32 blockSize,
NProto::EStorageMediaKind mediaKind,
TVector<NProto::TDeviceConfig> devices)
: RequestInfo(std::move(requestInfo))
, Force(force)
, DiskId(std::move(diskId))
, BlockSize(std::move(blockSize))
, BlockSize(blockSize)
, MediaKind(mediaKind)
, Devices(std::move(devices))
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ void TServiceActor::RenderVolumeList(IOutputStream& out) const
}
TABLED() {
if (volume.GetLocalMountClientInfo() &&
volume.StorageMediaKind != NProto::STORAGE_MEDIA_SSD_LOCAL)
volume.StorageMediaKind !=
NProto::STORAGE_MEDIA_SSD_LOCAL &&
volume.StorageMediaKind !=
NProto::STORAGE_MEDIA_HDD_LOCAL)
{
BuildVolumePreemptionButton(out, volume);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ void TStatsServiceActor::RegisterCounters(const TActorContext& ctx)
auto ssdMirror3Counters = totalCounters->GetSubgroup("type", "ssd_mirror3");
auto ssdSystemCounters = totalCounters->GetSubgroup("type", "ssd_system");
auto hddSystemCounters = totalCounters->GetSubgroup("type", "hdd_system");
auto hddLocalCounters = totalCounters->GetSubgroup("type", "hdd_local");
auto ssdLocalCounters = totalCounters->GetSubgroup("type", "sdd_local");
auto localCounters = totalCounters->GetSubgroup("binding", "local");
auto nonlocalCounters = totalCounters->GetSubgroup("binding", "remote");

Expand All @@ -66,6 +68,8 @@ void TStatsServiceActor::RegisterCounters(const TActorContext& ctx)
State.GetSsdMirror3Counters().Register(ssdMirror3Counters);
State.GetSsdSystemCounters().Register(ssdSystemCounters);
State.GetHddSystemCounters().Register(hddSystemCounters);
State.GetSsdLocalCounters().Register(ssdLocalCounters);
State.GetHddLocalCounters().Register(hddLocalCounters);
State.GetLocalVolumesCounters().Register(localCounters);
State.GetNonlocalVolumesCounters().Register(nonlocalCounters);
State.GetSsdBlobCounters().Register(ssdCounters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void TStatsServiceActor::UpdateVolumeSelfCounters(const TActorContext& ctx)
&State.GetSsdMirror3Counters(),
&State.GetSsdSystemCounters(),
&State.GetHddSystemCounters(),
&State.GetHddSystemCounters(),
&State.GetHddLocalCounters(),
&State.GetSsdLocalCounters(),
};

for (auto* tc: totalCounters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class TStatsServiceState
TTotalCounters SsdMirror2;
TTotalCounters SsdMirror3;
TTotalCounters SsdLocal;
TTotalCounters HddLocal;
TTotalCounters SsdSystem;
TTotalCounters HddSystem;

Expand Down Expand Up @@ -197,6 +198,7 @@ class TStatsServiceState
, SsdMirror2(EPublishingPolicy::DiskRegistryBased)
, SsdMirror3(EPublishingPolicy::DiskRegistryBased)
, SsdLocal(EPublishingPolicy::DiskRegistryBased)
, HddLocal(EPublishingPolicy::DiskRegistryBased)
, SsdSystem(EPublishingPolicy::Repl)
, HddSystem(EPublishingPolicy::Repl)
, SsdBlobLoadCounters(
Expand Down Expand Up @@ -265,6 +267,11 @@ class TStatsServiceState
return SsdLocal;
}

TTotalCounters& GetHddLocalCounters()
{
return HddLocal;
}

TTotalCounters& GetSsdSystemCounters()
{
return SsdSystem;
Expand All @@ -288,6 +295,7 @@ class TStatsServiceState
case NCloud::NProto::STORAGE_MEDIA_SSD_MIRROR2: return SsdMirror2;
case NCloud::NProto::STORAGE_MEDIA_SSD_MIRROR3: return SsdMirror3;
case NCloud::NProto::STORAGE_MEDIA_SSD_LOCAL: return SsdLocal;
case NCloud::NProto::STORAGE_MEDIA_HDD_LOCAL: return HddLocal;
case NCloud::NProto::STORAGE_MEDIA_HDD:
case NCloud::NProto::STORAGE_MEDIA_HYBRID:
case NCloud::NProto::STORAGE_MEDIA_DEFAULT:
Expand Down
Loading

0 comments on commit c58b4cd

Please sign in to comment.