aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorserg-belyakov <serg-belyakov@yandex-team.com>2023-10-09 11:32:31 +0300
committerserg-belyakov <serg-belyakov@yandex-team.com>2023-10-09 12:11:48 +0300
commit1a23ec84d8ea29be4a09a32204202ccdf0fb9802 (patch)
treeadea5de460049e60619d670777cd989faac3af19
parent58307058105a8bec95ee64df787b9eedb72a8aa6 (diff)
downloadydb-1a23ec84d8ea29be4a09a32204202ccdf0fb9802.tar.gz
Count cost of VDisk's internal operations, KIKIMR-17759
Count internal cost of defrag, scrub and compaction
-rw-r--r--ydb/core/blob_depot/agent/status.cpp1
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/monitoring.cpp2
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/replication.cpp1
-rw-r--r--ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h2
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.darwin-x86_64.txt1
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-aarch64.txt1
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-x86_64.txt1
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.windows-x86_64.txt1
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.cpp1
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.h1
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h1
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.h2
-rw-r--r--ydb/core/blobstorage/vdisk/anubis_osiris/ya.make1
-rw-r--r--ydb/core/blobstorage/vdisk/common/disk_part.h1
-rw-r--r--ydb/core/blobstorage/vdisk/common/vdisk_context.cpp1
-rw-r--r--ydb/core/blobstorage/vdisk/common/vdisk_context.h27
-rw-r--r--ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp136
-rw-r--r--ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h150
-rw-r--r--ydb/core/blobstorage/vdisk/common/vdisk_events.cpp49
-rw-r--r--ydb/core/blobstorage/vdisk/common/vdisk_events.h53
-rw-r--r--ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h14
-rw-r--r--ydb/core/blobstorage/vdisk/defrag/defrag_rewriter.cpp1
-rw-r--r--ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp1
-rw-r--r--ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h1
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp26
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h26
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/generic/hulldb_bulksstmngr.h1
-rw-r--r--ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h2
-rw-r--r--ydb/core/blobstorage/vdisk/query/query_readbatch.h1
-rw-r--r--ydb/core/blobstorage/vdisk/scrub/scrub_actor_pdisk.cpp2
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp34
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfullhandler.h2
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.h1
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.h1
-rw-r--r--ydb/core/blobstorage/vdisk/syncer/guid_propagator.h1
-rw-r--r--ydb/core/blobstorage/vdisk/syncer/guid_proxybase.h1
36 files changed, 344 insertions, 204 deletions
diff --git a/ydb/core/blob_depot/agent/status.cpp b/ydb/core/blob_depot/agent/status.cpp
index 5fc6fc6b23..48e8e8653f 100644
--- a/ydb/core/blob_depot/agent/status.cpp
+++ b/ydb/core/blob_depot/agent/status.cpp
@@ -1,4 +1,5 @@
#include "agent_impl.h"
+#include <ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_space_color.h>
namespace NKikimr::NBlobDepot {
diff --git a/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp b/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp
index c872b87c48..31a9d0e725 100644
--- a/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp
+++ b/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp
@@ -112,7 +112,7 @@ void Test(const TBlobStorageGroupInfo::TTopology& topology, TInflightActor* acto
GetSubgroup("subsystem", "request")->
GetSubgroup("storagePool", env.StoragePoolName)->
GetCounter("DSProxyDiskCostNs")->Val();
- vdiskCost = vdisksTotal("cost", "VDiskUserCostNs");
+ vdiskCost = vdisksTotal("cost", "SkeletonFrontUserCostNs");
};
updateCounters();
diff --git a/ydb/core/blobstorage/ut_blobstorage/replication.cpp b/ydb/core/blobstorage/ut_blobstorage/replication.cpp
index 2cb374a458..3db37376b7 100644
--- a/ydb/core/blobstorage/ut_blobstorage/replication.cpp
+++ b/ydb/core/blobstorage/ut_blobstorage/replication.cpp
@@ -1,4 +1,5 @@
#include <ydb/core/blobstorage/ut_blobstorage/lib/env.h>
+#include <ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.h>
#include <util/system/info.h>
#define SINGLE_THREAD 1
diff --git a/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h b/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h
index 7330ae908a..caa56bbe3c 100644
--- a/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h
+++ b/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h
@@ -2,7 +2,9 @@
#include "defs.h"
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
+#include <ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.h>
#include <util/system/mutex.h>
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.darwin-x86_64.txt b/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.darwin-x86_64.txt
index cf20eaa1b5..f6e647888b 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.darwin-x86_64.txt
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.darwin-x86_64.txt
@@ -19,6 +19,7 @@ target_link_libraries(blobstorage-vdisk-anubis_osiris PUBLIC
core-blobstorage-base
core-blobstorage-groupinfo
vdisk-hulldb-barriers
+ vdisk-hulldb-base
vdisk-hulldb-generic
ydb-core-protos
)
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-aarch64.txt b/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-aarch64.txt
index 61a0b43247..3d37991857 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-aarch64.txt
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-aarch64.txt
@@ -20,6 +20,7 @@ target_link_libraries(blobstorage-vdisk-anubis_osiris PUBLIC
core-blobstorage-base
core-blobstorage-groupinfo
vdisk-hulldb-barriers
+ vdisk-hulldb-base
vdisk-hulldb-generic
ydb-core-protos
)
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-x86_64.txt b/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-x86_64.txt
index 61a0b43247..3d37991857 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-x86_64.txt
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.linux-x86_64.txt
@@ -20,6 +20,7 @@ target_link_libraries(blobstorage-vdisk-anubis_osiris PUBLIC
core-blobstorage-base
core-blobstorage-groupinfo
vdisk-hulldb-barriers
+ vdisk-hulldb-base
vdisk-hulldb-generic
ydb-core-protos
)
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.windows-x86_64.txt b/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.windows-x86_64.txt
index cf20eaa1b5..f6e647888b 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.windows-x86_64.txt
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/CMakeLists.windows-x86_64.txt
@@ -19,6 +19,7 @@ target_link_libraries(blobstorage-vdisk-anubis_osiris PUBLIC
core-blobstorage-base
core-blobstorage-groupinfo
vdisk-hulldb-barriers
+ vdisk-hulldb-base
vdisk-hulldb-generic
ydb-core-protos
)
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.cpp b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.cpp
index 2e1754c18a..2589d705d4 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.cpp
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.cpp
@@ -1,4 +1,5 @@
#include "blobstorage_anubis_osiris.h"
+#include <ydb/core/protos/blobstorage_vdisk_internal.pb.h>
namespace NKikimr {
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.h b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.h
index 30ed07606c..09f6a0a87c 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.h
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_osiris.h
@@ -2,6 +2,7 @@
#include "defs.h"
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
+#include <ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h>
namespace NKikimr {
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h
index 8d53c580b0..b7516bc2f1 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h
@@ -2,6 +2,7 @@
#include "defs.h"
#include <ydb/core/base/blobstorage.h>
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
#include <ydb/core/blobstorage/base/blobstorage_vdiskid.h>
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.h b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.h
index c242916436..f58a02f39d 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.h
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.h
@@ -4,7 +4,7 @@
#include "blobstorage_anubis.h"
#include <ydb/core/base/blobstorage.h>
#include <ydb/core/blobstorage/base/blobstorage_vdiskid.h>
-
+#include <ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h>
namespace NKikimr {
diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/ya.make b/ydb/core/blobstorage/vdisk/anubis_osiris/ya.make
index 2a153a458b..aa2bed1caf 100644
--- a/ydb/core/blobstorage/vdisk/anubis_osiris/ya.make
+++ b/ydb/core/blobstorage/vdisk/anubis_osiris/ya.make
@@ -8,6 +8,7 @@ PEERDIR(
ydb/core/blobstorage/base
ydb/core/blobstorage/groupinfo
ydb/core/blobstorage/vdisk/hulldb/barriers
+ ydb/core/blobstorage/vdisk/hulldb/base
ydb/core/blobstorage/vdisk/hulldb/generic
ydb/core/protos
)
diff --git a/ydb/core/blobstorage/vdisk/common/disk_part.h b/ydb/core/blobstorage/vdisk/common/disk_part.h
index f8916ba6ee..beba7a5ae7 100644
--- a/ydb/core/blobstorage/vdisk/common/disk_part.h
+++ b/ydb/core/blobstorage/vdisk/common/disk_part.h
@@ -1,7 +1,6 @@
#pragma once
#include "defs.h"
-#include "vdisk_context.h"
#include <util/generic/vector.h>
#include <util/generic/buffer.h>
#include <util/stream/output.h>
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_context.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_context.cpp
index a5064cd967..5f39af02aa 100644
--- a/ydb/core/blobstorage/vdisk/common/vdisk_context.cpp
+++ b/ydb/core/blobstorage/vdisk/common/vdisk_context.cpp
@@ -58,6 +58,7 @@ namespace NKikimr {
, ReplNodeRequestQuoter(std::move(replNodeRequestQuoter))
, ReplNodeResponseQuoter(std::move(replNodeResponseQuoter))
, OutOfSpaceState(Top->GetTotalVDisksNum(), Top->GetOrderNumber(ShortSelfVDisk))
+ , CostMonGroup(vdiskCounters, "subsystem", "cost")
, Logger(as ? ActorSystemLogger(as) : DevNullLogger())
{
Y_VERIFY(!VDiskLogPrefix.empty());
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_context.h b/ydb/core/blobstorage/vdisk/common/vdisk_context.h
index f4f10de486..bfc35c61e3 100644
--- a/ydb/core/blobstorage/vdisk/common/vdisk_context.h
+++ b/ydb/core/blobstorage/vdisk/common/vdisk_context.h
@@ -2,6 +2,7 @@
#include "defs.h"
#include "memusage.h"
#include "vdisk_config.h"
+#include "vdisk_costmodel.h"
#include "vdisk_log.h"
#include "vdisk_pdisk_error.h"
#include "vdisk_outofspace.h"
@@ -12,6 +13,7 @@
#include <ydb/core/blobstorage/pdisk/blobstorage_pdisk.h>
namespace NKikimr {
+ class TCostModel;
/////////////////////////////////////////////////////////////////////////////////////////
// TBSProxyContext
@@ -64,6 +66,8 @@ namespace NKikimr {
// diagnostics
TString LocalRecoveryErrorStr;
+ std::unique_ptr<TCostModel> CostModel;
+
private:
// Managing disk space
TOutOfSpaceState OutOfSpaceState;
@@ -73,6 +77,8 @@ namespace NKikimr {
TPDiskErrorState PDiskErrorState;
friend class TDskSpaceTrackerActor;
+ NMonGroup::TCostGroup CostMonGroup;
+
public:
TLogger Logger;
@@ -161,6 +167,27 @@ namespace NKikimr {
return HugeHeapFragmentation;
}
+ template<class TEvent>
+ void CountDefragCost(const TEvent& ev) {
+ if (CostModel) {
+ CostMonGroup.DefragCostNs() += CostModel->GetCost(ev);
+ }
+ }
+
+ template<class TEvent>
+ void CountScrubCost(const TEvent& ev) {
+ if (CostModel) {
+ CostMonGroup.ScrubCostNs() += CostModel->GetCost(ev);
+ }
+ }
+
+ template<class TEvent>
+ void CountCompactionCost(const TEvent& ev) {
+ if (CostModel) {
+ CostMonGroup.CompactionCostNs() += CostModel->GetCost(ev);
+ }
+ }
+
private:
TString FormatMessage(
NKikimrProto::EReplyStatus status,
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp
index 4a6921a34e..7592b2bdd3 100644
--- a/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp
+++ b/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp
@@ -3,6 +3,96 @@
namespace NKikimr {
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVGet& ev) {
+ const auto &record = ev.Record;
+
+ // range query
+ if (record.HasRangeQuery()) {
+ if (record.GetIndexOnly()) {
+ // in-memory only
+ BaseCost += InMemReadCost();
+ } else {
+ // we don't know cost of the query, it depends on number of elements and their size
+ BaseCost += 10000000; // let's assume it's 10 ms
+ }
+ }
+
+ // extreme queries
+ ReadSizes.reserve(record.GetExtremeQueries().size());
+ for (const auto &x : record.GetExtremeQueries()) {
+ ui64 size = 0;
+ if (x.HasSize())
+ size = x.GetSize();
+ else {
+ TLogoBlobID id(LogoBlobIDFromLogoBlobID(x.GetId()));
+ size = id.BlobSize();
+ }
+
+ ReadSizes.push_back(size);
+ }
+ }
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVGetBlock& /*ev*/)
+ : BaseCost(TCostModel::InMemReadCost(EInMemType::Read))
+ {}
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVGetBarrier& /*ev*/)
+ : BaseCost(TCostModel::InMemReadCost(EInMemType::Read))
+ {}
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVBlock& ev)
+ : SmallWriteSize(ev.GetCachedByteSize())
+ {}
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVCollectGarbage& ev)
+ : SmallWriteSize(ev.GetCachedByteSize())
+ {}
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVMovedPatch& ev)
+ : HandleClass(NKikimrBlobStorage::EPutHandleClass::AsyncBlob)
+ {
+ TLogoBlobID id = LogoBlobIDFromLogoBlobID(ev.Record.GetOriginalBlobId());
+ MovedPatchBlobSize = id.BlobSize();
+ }
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVPatchStart&)
+ : BaseCost(TCostModel::InMemReadCost(EInMemType::Read))
+ , HandleClass(NKikimrBlobStorage::EPutHandleClass::AsyncBlob)
+ {}
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVPatchDiff& ev)
+ : HandleClass(NKikimrBlobStorage::EPutHandleClass::AsyncBlob)
+ {
+ // it has range vget subquery for finding parts
+ TLogoBlobID id(LogoBlobIDFromLogoBlobID(ev.Record.GetOriginalPartBlobId()));
+ ReadSizes.push_back(id.BlobSize());
+ PutBufferSizes.push_back(id.BlobSize());
+ }
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVPatchXorDiff& ev)
+ : HandleClass(NKikimrBlobStorage::EPutHandleClass::AsyncBlob)
+ {
+ PutBufferSizes.push_back(ev.DiffSizeSum());
+ }
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVPut& ev)
+ : HandleClass(ev.Record.GetHandleClass())
+ {
+ PutBufferSizes.push_back(ev.Record.HasBuffer() ?
+ ev.Record.GetBuffer().size() : ev.GetPayload(0).GetSize());
+ }
+
+ TCostModel::TMessageCostEssence::TMessageCostEssence(const TEvBlobStorage::TEvVMultiPut& ev)
+ : HandleClass(ev.Record.GetHandleClass())
+ {
+ const NKikimrBlobStorage::TEvVMultiPut &record = ev.Record;
+ const ui64 itemsSize = record.ItemsSize();
+ PutBufferSizes.reserve(itemsSize);
+ for (ui64 idx = 0; idx < itemsSize; ++idx) {
+ PutBufferSizes.push_back(ev.GetBufferBytes(idx));
+ }
+ }
+
TCostModel::TCostModel(ui64 seekTimeUs, ui64 readSpeedBps, ui64 writeSpeedBps, ui64 readBlockSize,
ui64 writeBlockSize, ui32 minREALHugeBlobInBytes, TBlobStorageGroupType gType)
: SeekTimeUs(seekTimeUs)
@@ -33,6 +123,38 @@ namespace NKikimr {
settings.SetMinREALHugeBlobInBytes(MinREALHugeBlobInBytes);
}
+ /// READS
+ ui64 TCostModel::GetCost(const TEvBlobStorage::TEvVGet &ev) const {
+ return ReadCost(ev);
+ }
+
+ ui64 TCostModel::GetCost(const TEvBlobStorage::TEvVGetBlock &ev) const {
+ Y_UNUSED(ev);
+ return InMemReadCost(TCostModel::EInMemType::Read);
+ }
+
+ ui64 TCostModel::GetCost(const TEvBlobStorage::TEvVGetBarrier &ev) const {
+ Y_UNUSED(ev);
+ return InMemReadCost(TCostModel::EInMemType::Read);
+ }
+
+ /// WRITES
+ ui64 TCostModel::GetCost(const TEvBlobStorage::TEvVBlock &ev) const {
+ const ui32 recByteSize = ev.GetCachedByteSize();
+ return SmallWriteCost(recByteSize);
+ }
+
+ ui64 TCostModel::GetCost(const TEvBlobStorage::TEvVCollectGarbage &ev) const {
+ const ui32 recByteSize = ev.GetCachedByteSize();
+ return SmallWriteCost(recByteSize);
+ }
+
+ ui64 TCostModel::GetCost(const TEvBlobStorage::TEvVPut &ev) const {
+ bool logPutInternalQueue = true;
+ return GetCost(ev, &logPutInternalQueue);
+ }
+
+ // PATCHES
ui64 TCostModel::GetCost(const TEvBlobStorage::TEvVPatchStart &) const {
return InMemReadCost();
}
@@ -175,4 +297,18 @@ namespace NKikimr {
MinREALHugeBlobInBytes = std::max(MinREALHugeBlobInBytes, other.MinREALHugeBlobInBytes);
}
+ // PDisk messages cost
+ ui64 TCostModel::GetCost(const NPDisk::TEvChunkRead& ev) const {
+ return ReadCostBySize(ev.Size);
+ }
+
+ // PDisk messages cost
+ ui64 TCostModel::GetCost(const NPDisk::TEvChunkWrite& ev) const {
+ if (ev.PriorityClass == NPriPut::Log) {
+ return SmallWriteCost(ev.PartsPtr->Size());
+ } else {
+ return HugeWriteCost(ev.PartsPtr->Size());
+ }
+ }
+
} // NKikimr
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h b/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h
index d072757471..e10f519f60 100644
--- a/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h
+++ b/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h
@@ -4,6 +4,7 @@
#include "vdisk_events.h"
#include <ydb/core/protos/blobstorage.pb.h>
#include <ydb/core/base/blobstorage.h>
+#include <ydb/core/blobstorage/pdisk/blobstorage_pdisk.h>
namespace NKikimr {
@@ -25,96 +26,27 @@ namespace NKikimr {
NKikimrBlobStorage::EPutHandleClass HandleClass = NKikimrBlobStorage::TabletLog;
public:
- TMessageCostEssence(const TEvBlobStorage::TEvVGet& ev) {
- const auto &record = ev.Record;
-
- // range query
- if (record.HasRangeQuery()) {
- if (record.GetIndexOnly()) {
- // in-memory only
- BaseCost += InMemReadCost();
- } else {
- // we don't know cost of the query, it depends on number of elements and their size
- BaseCost += 10000000; // let's assume it's 10 ms
- }
- }
-
- // extreme queries
- ReadSizes.reserve(record.GetExtremeQueries().size());
- for (const auto &x : record.GetExtremeQueries()) {
- ui64 size = 0;
- if (x.HasSize())
- size = x.GetSize();
- else {
- TLogoBlobID id(LogoBlobIDFromLogoBlobID(x.GetId()));
- size = id.BlobSize();
- }
-
- ReadSizes.push_back(size);
- }
- }
-
- TMessageCostEssence(const TEvBlobStorage::TEvVGetBlock& /*ev*/)
- : BaseCost(TCostModel::InMemReadCost(EInMemType::Read))
- {}
-
- TMessageCostEssence(const TEvBlobStorage::TEvVGetBarrier& /*ev*/)
- : BaseCost(TCostModel::InMemReadCost(EInMemType::Read))
- {}
-
- TMessageCostEssence(const TEvBlobStorage::TEvVBlock& ev)
- : SmallWriteSize(ev.GetCachedByteSize())
- {}
-
- TMessageCostEssence(const TEvBlobStorage::TEvVCollectGarbage& ev)
- : SmallWriteSize(ev.GetCachedByteSize())
- {}
-
- TMessageCostEssence(const TEvBlobStorage::TEvVMovedPatch& ev)
- : HandleClass(NKikimrBlobStorage::EPutHandleClass::AsyncBlob)
- {
- TLogoBlobID id = LogoBlobIDFromLogoBlobID(ev.Record.GetOriginalBlobId());
- MovedPatchBlobSize = id.BlobSize();
- }
-
- TMessageCostEssence(const TEvBlobStorage::TEvVPatchStart&)
- : BaseCost(TCostModel::InMemReadCost(EInMemType::Read))
- , HandleClass(NKikimrBlobStorage::EPutHandleClass::AsyncBlob)
- {
- }
-
- TMessageCostEssence(const TEvBlobStorage::TEvVPatchDiff& ev)
- : HandleClass(NKikimrBlobStorage::EPutHandleClass::AsyncBlob)
- {
- // it has range vget subquery for finding parts
- TLogoBlobID id(LogoBlobIDFromLogoBlobID(ev.Record.GetOriginalPartBlobId()));
- ReadSizes.push_back(id.BlobSize());
- PutBufferSizes.push_back(id.BlobSize());
- }
-
- TMessageCostEssence(const TEvBlobStorage::TEvVPatchXorDiff& ev)
- : HandleClass(NKikimrBlobStorage::EPutHandleClass::AsyncBlob)
- {
- PutBufferSizes.push_back(ev.DiffSizeSum());
- }
-
- TMessageCostEssence(const TEvBlobStorage::TEvVPut& ev)
- : HandleClass(ev.Record.GetHandleClass())
- {
- PutBufferSizes.push_back(ev.Record.HasBuffer() ?
- ev.Record.GetBuffer().size() : ev.GetPayload(0).GetSize());
- }
-
- TMessageCostEssence(const TEvBlobStorage::TEvVMultiPut& ev)
- : HandleClass(ev.Record.GetHandleClass())
- {
- const NKikimrBlobStorage::TEvVMultiPut &record = ev.Record;
- const ui64 itemsSize = record.ItemsSize();
- PutBufferSizes.reserve(itemsSize);
- for (ui64 idx = 0; idx < itemsSize; ++idx) {
- PutBufferSizes.push_back(ev.GetBufferBytes(idx));
- }
- }
+ TMessageCostEssence(const TEvBlobStorage::TEvVGet& ev);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVGetBlock& /*ev*/);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVGetBarrier& /*ev*/);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVBlock& ev);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVCollectGarbage& ev);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVMovedPatch& ev);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVPatchStart&);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVPatchDiff& ev);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVPatchXorDiff& ev);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVPut& ev);
+
+ TMessageCostEssence(const TEvBlobStorage::TEvVMultiPut& ev);
};
public:
@@ -134,35 +66,14 @@ namespace NKikimr {
void FillInSettings(NKikimrBlobStorage::TVDiskCostSettings &settings) const;
/// READS
- ui64 GetCost(const TEvBlobStorage::TEvVGet &ev) const {
- return ReadCost(ev);
- }
-
- ui64 GetCost(const TEvBlobStorage::TEvVGetBlock &ev) const {
- Y_UNUSED(ev);
- return InMemReadCost(TCostModel::EInMemType::Read);
- }
-
- ui64 GetCost(const TEvBlobStorage::TEvVGetBarrier &ev) const {
- Y_UNUSED(ev);
- return InMemReadCost(TCostModel::EInMemType::Read);
- }
+ ui64 GetCost(const TEvBlobStorage::TEvVGet &ev) const;
+ ui64 GetCost(const TEvBlobStorage::TEvVGetBlock &ev) const;
+ ui64 GetCost(const TEvBlobStorage::TEvVGetBarrier &ev) const;
/// WRITES
- ui64 GetCost(const TEvBlobStorage::TEvVBlock &ev) const {
- const ui32 recByteSize = ev.GetCachedByteSize();
- return SmallWriteCost(recByteSize);
- }
-
- ui64 GetCost(const TEvBlobStorage::TEvVCollectGarbage &ev) const {
- const ui32 recByteSize = ev.GetCachedByteSize();
- return SmallWriteCost(recByteSize);
- }
-
- ui64 GetCost(const TEvBlobStorage::TEvVPut &ev) const {
- bool logPutInternalQueue = true;
- return GetCost(ev, &logPutInternalQueue);
- }
+ ui64 GetCost(const TEvBlobStorage::TEvVBlock &ev) const;
+ ui64 GetCost(const TEvBlobStorage::TEvVCollectGarbage &ev) const;
+ ui64 GetCost(const TEvBlobStorage::TEvVPut &ev) const;
ui64 GetCost(const TEvBlobStorage::TEvVPatchStart &ev) const;
ui64 GetCost(const TEvBlobStorage::TEvVPatchDiff &ev) const;
@@ -170,7 +81,6 @@ namespace NKikimr {
ui64 GetCost(const TEvBlobStorage::TEvVMovedPatch &ev) const;
ui64 GetCost(const TEvBlobStorage::TEvVPut &ev, bool *logPutInternalQueue) const;
-
ui64 GetCost(const TEvBlobStorage::TEvVMultiPut &ev, bool *logPutInternalQueue) const;
/// LAZY EVALUATION
@@ -185,6 +95,10 @@ namespace NKikimr {
MinREALHugeBlobInBytes != other.MinREALHugeBlobInBytes;
}
+ // PDisk messages cost
+ ui64 GetCost(const NPDisk::TEvChunkRead &ev) const;
+ ui64 GetCost(const NPDisk::TEvChunkWrite &ev) const;
+
protected:
ui64 SmallWriteCost(ui64 size) const {
const ui64 seekCost = SeekTimeUs / 100u; // assume we do one seek per 100 log records
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_events.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_events.cpp
index fdcc002b4b..669f2ae27a 100644
--- a/ydb/core/blobstorage/vdisk/common/vdisk_events.cpp
+++ b/ydb/core/blobstorage/vdisk/common/vdisk_events.cpp
@@ -1,5 +1,6 @@
#include "vdisk_events.h"
#include <ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.h>
+#include <ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.h>
namespace NKikimr {
@@ -56,4 +57,52 @@ namespace NKikimr {
return GetPayload(itemIdx);
}
}
+
+
+ TEvBlobStorage::TEvVGetBarrier::TEvVGetBarrier(const TVDiskID &vdisk, const TKeyBarrier &from, const TKeyBarrier &to, ui32 *maxResults,
+ bool showInternals)
+ {
+ VDiskIDFromVDiskID(vdisk, Record.MutableVDiskID());
+ from.Serialize(*Record.MutableFrom());
+ to.Serialize(*Record.MutableTo());
+ if (maxResults)
+ Record.SetMaxResults(*maxResults);
+ if (showInternals)
+ Record.SetShowInternals(true);
+ Record.MutableMsgQoS()->SetExtQueueId(NKikimrBlobStorage::EVDiskQueueId::GetFastRead);
+ }
+
+ TString TEvBlobStorage::TEvVGetBarrier::ToString() const {
+ TStringStream str;
+ str << "{From# " << TKeyBarrier(Record.GetFrom()).ToString()
+ << " To# " << TKeyBarrier(Record.GetTo()).ToString();
+ if (Record.HasMsgQoS()) {
+ TEvBlobStorage::TEvVPut::OutMsgQos(Record.GetMsgQoS(), str);
+ }
+ if (Record.HasShowInternals() && Record.GetShowInternals())
+ str << " ShowInternals";
+ str << "}";
+ return str.Str();
+ }
+
+ void TEvBlobStorage::TEvVGetBarrierResult::AddResult(const TKeyBarrier &key, const TMemRecBarrier &memRec, bool showInternals) {
+ auto k = Record.AddKeys();
+ key.Serialize(*k);
+ auto v = Record.AddValues();
+ memRec.Serialize(*v, showInternals);
+ }
+
+ TEvBlobStorage::TEvVSyncFull::TEvVSyncFull(const TSyncState &syncState, const TVDiskID &sourceVDisk, const TVDiskID &targetVDisk,
+ ui64 cookie, NKikimrBlobStorage::ESyncFullStage stage, const TLogoBlobID &logoBlobFrom,
+ ui64 blockTabletFrom, const TKeyBarrier &barrierFrom)
+ {
+ SyncStateFromSyncState(syncState, Record.MutableSyncState());
+ VDiskIDFromVDiskID(sourceVDisk, Record.MutableSourceVDiskID());
+ VDiskIDFromVDiskID(targetVDisk, Record.MutableTargetVDiskID());
+ Record.SetCookie(cookie);
+ Record.SetStage(stage);
+ LogoBlobIDFromLogoBlobID(logoBlobFrom, Record.MutableLogoBlobFrom());
+ Record.SetBlockTabletFrom(blockTabletFrom);
+ barrierFrom.Serialize(*Record.MutableBarrierFrom());
+ }
} // NKikimr
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_events.h b/ydb/core/blobstorage/vdisk/common/vdisk_events.h
index cbc8093618..d700a6510f 100644
--- a/ydb/core/blobstorage/vdisk/common/vdisk_events.h
+++ b/ydb/core/blobstorage/vdisk/common/vdisk_events.h
@@ -3,11 +3,14 @@
#include <ydb/core/blobstorage/base/blobstorage_syncstate.h>
#include <ydb/core/blobstorage/base/blobstorage_oos_defs.h>
+#include <ydb/core/blobstorage/base/utility.h>
#include <ydb/core/blobstorage/base/vdisk_priorities.h>
#include <ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h>
-#include <ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.h>
+#include <ydb/core/blobstorage/pdisk/blobstorage_pdisk_defs.h>
+#include <ydb/core/blobstorage/vdisk/common/disk_part.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_histogram_latency.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_mon.h>
+#include <ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.h>
#include <ydb/core/blobstorage/vdisk/protos/events.pb.h>
#include <ydb/core/blobstorage/storagepoolmon/storagepool_counters.h>
@@ -2403,6 +2406,9 @@ namespace NKikimr {
}
};
+ struct TKeyBarrier;
+ struct TMemRecBarrier;
+
struct TEvBlobStorage::TEvVGetBarrier
: TEventPB<TEvBlobStorage::TEvVGetBarrier, NKikimrBlobStorage::TEvVGetBarrier, TEvBlobStorage::EvVGetBarrier>
, TEventWithRelevanceTracker
@@ -2411,30 +2417,9 @@ namespace NKikimr {
{}
TEvVGetBarrier(const TVDiskID &vdisk, const TKeyBarrier &from, const TKeyBarrier &to, ui32 *maxResults,
- bool showInternals)
- {
- VDiskIDFromVDiskID(vdisk, Record.MutableVDiskID());
- from.Serialize(*Record.MutableFrom());
- to.Serialize(*Record.MutableTo());
- if (maxResults)
- Record.SetMaxResults(*maxResults);
- if (showInternals)
- Record.SetShowInternals(true);
- Record.MutableMsgQoS()->SetExtQueueId(NKikimrBlobStorage::EVDiskQueueId::GetFastRead);
- }
+ bool showInternals);
- TString ToString() const override {
- TStringStream str;
- str << "{From# " << TKeyBarrier(Record.GetFrom()).ToString()
- << " To# " << TKeyBarrier(Record.GetTo()).ToString();
- if (Record.HasMsgQoS()) {
- TEvBlobStorage::TEvVPut::OutMsgQos(Record.GetMsgQoS(), str);
- }
- if (Record.HasShowInternals() && Record.GetShowInternals())
- str << " ShowInternals";
- str << "}";
- return str.Str();
- }
+ TString ToString() const override;
};
struct TEvBlobStorage::TEvVGetBarrierResult
@@ -2454,12 +2439,7 @@ namespace NKikimr {
VDiskIDFromVDiskID(vdisk, Record.MutableVDiskID());
}
- void AddResult(const TKeyBarrier &key, const TMemRecBarrier &memRec, bool showInternals) {
- auto k = Record.AddKeys();
- key.Serialize(*k);
- auto v = Record.AddValues();
- memRec.Serialize(*v, showInternals);
- }
+ void AddResult(const TKeyBarrier &key, const TMemRecBarrier &memRec, bool showInternals);
void MakeError(NKikimrProto::EReplyStatus status, const TString& /*errorReason*/,
const NKikimrBlobStorage::TEvVGetBarrier &request) {
@@ -2814,16 +2794,7 @@ namespace NKikimr {
TEvVSyncFull(const TSyncState &syncState, const TVDiskID &sourceVDisk, const TVDiskID &targetVDisk,
ui64 cookie, NKikimrBlobStorage::ESyncFullStage stage, const TLogoBlobID &logoBlobFrom,
- ui64 blockTabletFrom, const TKeyBarrier &barrierFrom) {
- SyncStateFromSyncState(syncState, Record.MutableSyncState());
- VDiskIDFromVDiskID(sourceVDisk, Record.MutableSourceVDiskID());
- VDiskIDFromVDiskID(targetVDisk, Record.MutableTargetVDiskID());
- Record.SetCookie(cookie);
- Record.SetStage(stage);
- LogoBlobIDFromLogoBlobID(logoBlobFrom, Record.MutableLogoBlobFrom());
- Record.SetBlockTabletFrom(blockTabletFrom);
- barrierFrom.Serialize(*Record.MutableBarrierFrom());
- }
+ ui64 blockTabletFrom, const TKeyBarrier &barrierFrom);
bool IsInitial() const {
return Record.GetCookie() == 0;
@@ -2972,6 +2943,8 @@ namespace NKikimr {
struct TEvBlobStorage::TEvCaptureVDiskLayout : TEventLocal<TEvCaptureVDiskLayout, EvCaptureVDiskLayout>
{};
+ struct TDiskPart;
+
struct TEvBlobStorage::TEvCaptureVDiskLayoutResult : TEventLocal<TEvCaptureVDiskLayoutResult, EvCaptureVDiskLayoutResult> {
enum class EDatabase {
LogoBlobs,
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h b/ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h
index f72b3ded08..a7eb960cd0 100644
--- a/ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h
+++ b/ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h
@@ -166,12 +166,18 @@ public:
GROUP_CONSTRUCTOR(TCostGroup)
{
COUNTER_INIT(DiskTimeAvailableNs, false);
- COUNTER_INIT(VDiskUserCostNs, true);
- COUNTER_INIT(VDiskInternalCostNs, true);
+ COUNTER_INIT(SkeletonFrontUserCostNs, true);
+ COUNTER_INIT(SkeletonFrontInternalCostNs, true);
+ COUNTER_INIT(DefragCostNs, true);
+ COUNTER_INIT(CompactionCostNs, true);
+ COUNTER_INIT(ScrubCostNs, true);
}
COUNTER_DEF(DiskTimeAvailableNs);
- COUNTER_DEF(VDiskUserCostNs);
- COUNTER_DEF(VDiskInternalCostNs);
+ COUNTER_DEF(SkeletonFrontUserCostNs);
+ COUNTER_DEF(SkeletonFrontInternalCostNs);
+ COUNTER_DEF(DefragCostNs);
+ COUNTER_DEF(CompactionCostNs);
+ COUNTER_DEF(ScrubCostNs);
};
///////////////////////////////////////////////////////////////////////////////////
diff --git a/ydb/core/blobstorage/vdisk/defrag/defrag_rewriter.cpp b/ydb/core/blobstorage/vdisk/defrag/defrag_rewriter.cpp
index 54f93afc2c..3240817e67 100644
--- a/ydb/core/blobstorage/vdisk/defrag/defrag_rewriter.cpp
+++ b/ydb/core/blobstorage/vdisk/defrag/defrag_rewriter.cpp
@@ -87,6 +87,7 @@ namespace NKikimr {
const TDiskPart& p = rec.OldDiskPart;
auto msg = std::make_unique<NPDisk::TEvChunkRead>(DCtx->PDiskCtx->Dsk->Owner,
DCtx->PDiskCtx->Dsk->OwnerRound, p.ChunkIdx, p.Offset, p.Size, NPriRead::HullComp, nullptr);
+ DCtx->VCtx->CountDefragCost(*msg);
ctx.Send(DCtx->PDiskCtx->PDiskId, msg.release());
DCtx->DefragMonGroup.DefragBytesRewritten() += p.Size;
RewrittenBytes += p.Size;
diff --git a/ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp b/ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp
index 0ac940598e..57fc73c113 100644
--- a/ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp
+++ b/ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp
@@ -1,6 +1,7 @@
#include "handoff_proxy.h"
#include "handoff_delegate.h"
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
+#include <ydb/core/blobstorage/vdisk/common/vdisk_log.h>
using namespace NKikimrServices;
using namespace NKikimr::NHandoff;
diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h
index 5f44af3431..94936c0f24 100644
--- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h
+++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h
@@ -4,6 +4,7 @@
#include "blobstorage_hullhugedefs.h"
#include <util/generic/hash_set.h>
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
namespace NKikimr {
diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp
index 3ab1858cea..14c5ee9e8e 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp
+++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp
@@ -85,4 +85,30 @@ namespace NKikimr {
str << "{Id# " << Id << "}";
}
+ THullCtx::THullCtx(TVDiskContextPtr vctx, ui32 chunkSize, ui32 compWorthReadSize, bool freshCompaction,
+ bool gcOnlySynced, bool allowKeepFlags, bool barrierValidation, ui32 hullSstSizeInChunksFresh,
+ ui32 hullSstSizeInChunksLevel, double hullCompFreeSpaceThreshold, ui32 freshCompMaxInFlightWrites,
+ ui32 hullCompMaxInFlightWrites, ui32 hullCompMaxInFlightReads, double hullCompReadBatchEfficiencyThreshold,
+ TDuration hullCompStorageRatioCalcPeriod, TDuration hullCompStorageRatioMaxCalcDuration)
+ : VCtx(std::move(vctx))
+ , IngressCache(TIngressCache::Create(VCtx->Top, VCtx->ShortSelfVDisk))
+ , ChunkSize(chunkSize)
+ , CompWorthReadSize(compWorthReadSize)
+ , FreshCompaction(freshCompaction)
+ , GCOnlySynced(gcOnlySynced)
+ , AllowKeepFlags(allowKeepFlags)
+ , BarrierValidation(barrierValidation)
+ , HullSstSizeInChunksFresh(hullSstSizeInChunksFresh)
+ , HullSstSizeInChunksLevel(hullSstSizeInChunksLevel)
+ , HullCompFreeSpaceThreshold(hullCompFreeSpaceThreshold)
+ , FreshCompMaxInFlightWrites(freshCompMaxInFlightWrites)
+ , HullCompMaxInFlightWrites(hullCompMaxInFlightWrites)
+ , HullCompMaxInFlightReads(hullCompMaxInFlightReads)
+ , HullCompReadBatchEfficiencyThreshold(hullCompReadBatchEfficiencyThreshold)
+ , HullCompStorageRatioCalcPeriod(hullCompStorageRatioCalcPeriod)
+ , HullCompStorageRatioMaxCalcDuration(hullCompStorageRatioMaxCalcDuration)
+ , LsmHullGroup(VCtx->VDiskCounters, "subsystem", "lsmhull")
+ , LsmHullSpaceGroup(VCtx->VDiskCounters, "subsystem", "outofspace")
+ {}
+
} // NKikimr
diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h
index c0edacd2dc..fe50cecc87 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h
+++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h
@@ -4,6 +4,7 @@
#include "blobstorage_hullstorageratio.h"
#include <ydb/core/blobstorage/pdisk/blobstorage_pdisk.h>
#include <ydb/core/blobstorage/vdisk/common/disk_part.h>
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h>
#include <util/generic/vector.h>
#include <util/generic/buffer.h>
@@ -20,6 +21,9 @@ namespace NKikimr {
template <class TKey>
TLogSignature PDiskSignatureForHullDbKey();
+ class TVDiskContext;
+ using TVDiskContextPtr = TIntrusivePtr<TVDiskContext>;
+
///////////////////////////////////////////////////////////////////////////////////////
// TDiskDataExtractor
///////////////////////////////////////////////////////////////////////////////////////
@@ -153,27 +157,7 @@ namespace NKikimr {
ui32 hullCompMaxInFlightReads,
double hullCompReadBatchEfficiencyThreshold,
TDuration hullCompStorageRatioCalcPeriod,
- TDuration hullCompStorageRatioMaxCalcDuration)
- : VCtx(std::move(vctx))
- , IngressCache(TIngressCache::Create(VCtx->Top, VCtx->ShortSelfVDisk))
- , ChunkSize(chunkSize)
- , CompWorthReadSize(compWorthReadSize)
- , FreshCompaction(freshCompaction)
- , GCOnlySynced(gcOnlySynced)
- , AllowKeepFlags(allowKeepFlags)
- , BarrierValidation(barrierValidation)
- , HullSstSizeInChunksFresh(hullSstSizeInChunksFresh)
- , HullSstSizeInChunksLevel(hullSstSizeInChunksLevel)
- , HullCompFreeSpaceThreshold(hullCompFreeSpaceThreshold)
- , FreshCompMaxInFlightWrites(freshCompMaxInFlightWrites)
- , HullCompMaxInFlightWrites(hullCompMaxInFlightWrites)
- , HullCompMaxInFlightReads(hullCompMaxInFlightReads)
- , HullCompReadBatchEfficiencyThreshold(hullCompReadBatchEfficiencyThreshold)
- , HullCompStorageRatioCalcPeriod(hullCompStorageRatioCalcPeriod)
- , HullCompStorageRatioMaxCalcDuration(hullCompStorageRatioMaxCalcDuration)
- , LsmHullGroup(VCtx->VDiskCounters, "subsystem", "lsmhull")
- , LsmHullSpaceGroup(VCtx->VDiskCounters, "subsystem", "outofspace")
- {}
+ TDuration hullCompStorageRatioMaxCalcDuration);
void UpdateSpaceCounters(const NHullComp::TSstRatio& prev, const NHullComp::TSstRatio& current);
};
diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hulldb_bulksstmngr.h b/ydb/core/blobstorage/vdisk/hulldb/generic/hulldb_bulksstmngr.h
index 22038ef95c..d2f26a926e 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/generic/hulldb_bulksstmngr.h
+++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hulldb_bulksstmngr.h
@@ -2,6 +2,7 @@
#include "defs.h"
#include <ydb/core/blobstorage/vdisk/common/disk_part.h>
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/blobstorage/base/utility.h>
#include <util/generic/set.h>
diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h
index 93ca75320c..50da1d21f6 100644
--- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h
+++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h
@@ -694,6 +694,7 @@ namespace NKikimr {
// send new messages until we reach in flight limit
std::unique_ptr<NPDisk::TEvChunkWrite> msg;
while (InFlightWrites < MaxInFlightWrites && (msg = WriterPtr->GetPendingMessage())) {
+ HullCtx->VCtx->CountCompactionCost(*msg);
Statistics.Update(msg.get());
msgsForYard.push_back(std::move(msg));
++InFlightWrites;
@@ -703,6 +704,7 @@ namespace NKikimr {
std::unique_ptr<NPDisk::TEvChunkRead> readMsg;
while (InFlightReads < MaxInFlightReads && (readMsg = ReadBatcher.GetPendingMessage(
PDiskCtx->Dsk->Owner, PDiskCtx->Dsk->OwnerRound, NPriRead::HullComp))) {
+ HullCtx->VCtx->CountCompactionCost(*readMsg);
Statistics.Update(readMsg.get());
msgsForYard.push_back(std::move(readMsg));
++InFlightReads;
diff --git a/ydb/core/blobstorage/vdisk/query/query_readbatch.h b/ydb/core/blobstorage/vdisk/query/query_readbatch.h
index 82bc710cba..43bb586ab6 100644
--- a/ydb/core/blobstorage/vdisk/query/query_readbatch.h
+++ b/ydb/core/blobstorage/vdisk/query/query_readbatch.h
@@ -4,6 +4,7 @@
#include <ydb/core/blobstorage/vdisk/common/disk_part.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_pdiskctx.h>
#include <ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h>
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
#include <util/generic/deque.h>
diff --git a/ydb/core/blobstorage/vdisk/scrub/scrub_actor_pdisk.cpp b/ydb/core/blobstorage/vdisk/scrub/scrub_actor_pdisk.cpp
index f99f3d5088..31578290e5 100644
--- a/ydb/core/blobstorage/vdisk/scrub/scrub_actor_pdisk.cpp
+++ b/ydb/core/blobstorage/vdisk/scrub/scrub_actor_pdisk.cpp
@@ -7,6 +7,7 @@ namespace NKikimr {
Y_VERIFY(part.Size);
auto msg = std::make_unique<NPDisk::TEvChunkRead>(ScrubCtx->PDiskCtx->Dsk->Owner,
ScrubCtx->PDiskCtx->Dsk->OwnerRound, part.ChunkIdx, part.Offset, part.Size, NPriRead::HullLow, nullptr);
+ ScrubCtx->VCtx->CountScrubCost(*msg);
Send(ScrubCtx->PDiskCtx->PDiskId, msg.release());
CurrentState = TStringBuilder() << "reading data from " << part.ToString();
auto res = WaitForPDiskEvent<NPDisk::TEvChunkReadResult>();
@@ -36,6 +37,7 @@ namespace NKikimr {
nullptr,
true,
NPriWrite::HullComp);
+ ScrubCtx->VCtx->CountScrubCost(*msg);
Send(ScrubCtx->PDiskCtx->PDiskId, msg.release());
CurrentState = TStringBuilder() << "writing index to " << part.ToString();
auto res = WaitForPDiskEvent<NPDisk::TEvChunkWriteResult>();
diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp
index 5c7cda83ba..76c4a2f46b 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp
+++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp
@@ -698,7 +698,6 @@ namespace NKikimr {
TExtQueueClass ExtQueueTabletLogPuts;
TExtQueueClass ExtQueueAsyncBlobPuts;
TExtQueueClass ExtQueueUserDataPuts;
- std::unique_ptr<TCostModel> CostModel;
TActiveActors ActiveActors;
NMonGroup::TReplGroup ReplMonGroup;
NMonGroup::TSyncerGroup SyncerMonGroup;
@@ -848,7 +847,7 @@ namespace NKikimr {
{
Become(&TThis::StateSyncGuidRecoveryInProgress);
TBlobStorageGroupType type = (GInfo ? GInfo->Type : TErasureType::ErasureNone);
- CostModel = std::make_unique<TCostModel>(msg->Dsk->SeekTimeUs, msg->Dsk->ReadSpeedBps,
+ VCtx->CostModel = std::make_unique<TCostModel>(msg->Dsk->SeekTimeUs, msg->Dsk->ReadSpeedBps,
msg->Dsk->WriteSpeedBps, msg->Dsk->ReadBlockSize, msg->Dsk->WriteBlockSize,
msg->HugeBlobCtx->MinREALHugeBlobInBytes, type);
break;
@@ -1079,7 +1078,7 @@ namespace NKikimr {
template <class TEventPtr>
inline void CheckEvent(TEventPtr &ev, const char *msgName) {
- Y_VERIFY_DEBUG(CostModel);
+ Y_VERIFY_DEBUG(VCtx->CostModel);
Y_VERIFY(ev->Get(), "Incoming message of type %s is null at the VDisk border. This MUST never happens, "
"check VDisk clients: bufSize# %u", msgName, unsigned(ev->GetSize()));
}
@@ -1167,8 +1166,8 @@ namespace NKikimr {
void FillInCostSettingsAndTimestampIfRequired(NKikimrBlobStorage::TMsgQoS *qos, TInstant now) const {
qos->MutableExecTimeStats()->SetReceivedTimestamp(now.GetValue());
- if (qos->GetSendMeCostSettings() && CostModel) {
- CostModel->FillInSettings(*qos->MutableCostSettings());
+ if (qos->GetSendMeCostSettings() && VCtx->CostModel) {
+ VCtx->CostModel->FillInSettings(*qos->MutableCostSettings());
}
}
@@ -1228,9 +1227,9 @@ namespace NKikimr {
// TEvVPatchXorDiff's cost is included in cost of other Patch operations
} else {
if (clientId.GetType() == NBackpressure::EQueueClientType::DSProxy) {
- CostGroup.VDiskUserCostNs() += cost;
+ CostGroup.SkeletonFrontUserCostNs() += cost;
} else {
- CostGroup.VDiskInternalCostNs() += cost;
+ CostGroup.SkeletonFrontInternalCostNs() += cost;
}
}
}
@@ -1266,7 +1265,7 @@ namespace NKikimr {
template <typename TEvPtr>
void HandlePatchEvent(TEvPtr &ev) {
- const ui64 cost = CostModel->GetCost(*ev->Get());
+ const ui64 cost = VCtx->CostModel->GetCost(*ev->Get());
auto &record = ev->Get()->Record;
@@ -1310,7 +1309,7 @@ namespace NKikimr {
void Handle(TEvBlobStorage::TEvVPut::TPtr &ev, const TActorContext &ctx) {
bool logPutInternalQueue = true;
- const ui64 cost = CostModel->GetCost(*ev->Get(), &logPutInternalQueue);
+ const ui64 cost = VCtx->CostModel->GetCost(*ev->Get(), &logPutInternalQueue);
const NKikimrBlobStorage::TEvVPut &record = ev->Get()->Record;
const TLogoBlobID blob = LogoBlobIDFromLogoBlobID(record.GetBlobID());
@@ -1337,7 +1336,7 @@ namespace NKikimr {
void Handle(TEvBlobStorage::TEvVMultiPut::TPtr &ev, const TActorContext &ctx) {
bool logPutInternalQueue = true;
- const ui64 cost = CostModel->GetCost(*ev->Get(), &logPutInternalQueue);
+ const ui64 cost = VCtx->CostModel->GetCost(*ev->Get(), &logPutInternalQueue);
const NKikimrBlobStorage::TEvVMultiPut &record = ev->Get()->Record;
LWTRACK(VDiskSkeletonFrontVMultiPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId,
@@ -1363,7 +1362,7 @@ namespace NKikimr {
}
void Handle(TEvBlobStorage::TEvVGet::TPtr &ev, const TActorContext &ctx) {
- const ui64 cost = CostModel->GetCost(*ev->Get());
+ const ui64 cost = VCtx->CostModel->GetCost(*ev->Get());
// select correct internal queue
Y_VERIFY(ev->Get()->Record.HasHandleClass());
auto cls = ev->Get()->Record.GetHandleClass();
@@ -1389,22 +1388,22 @@ namespace NKikimr {
}
void Handle(TEvBlobStorage::TEvVBlock::TPtr &ev, const TActorContext &ctx) {
- const ui64 cost = CostModel->GetCost(*ev->Get());
+ const ui64 cost = VCtx->CostModel->GetCost(*ev->Get());
HandleRequestWithQoS(ctx, ev, "TEvVBlock", cost, *IntQueueLogPuts);
}
void Handle(TEvBlobStorage::TEvVGetBlock::TPtr &ev, const TActorContext &ctx) {
- const ui64 cost = CostModel->GetCost(*ev->Get());
+ const ui64 cost = VCtx->CostModel->GetCost(*ev->Get());
HandleRequestWithQoS(ctx, ev, "TEvVGetBlock", cost, *IntQueueFastGets);
}
void Handle(TEvBlobStorage::TEvVCollectGarbage::TPtr &ev, const TActorContext &ctx) {
- const ui64 cost = CostModel->GetCost(*ev->Get());
+ const ui64 cost = VCtx->CostModel->GetCost(*ev->Get());
HandleRequestWithQoS(ctx, ev, "TEvVCollectGarbage", cost, *IntQueueLogPuts);
}
void Handle(TEvBlobStorage::TEvVGetBarrier::TPtr &ev, const TActorContext &ctx) {
- const ui64 cost = CostModel->GetCost(*ev->Get());
+ const ui64 cost = VCtx->CostModel->GetCost(*ev->Get());
HandleRequestWithQoS(ctx, ev, "TEvVGetBarrier", cost, *IntQueueFastGets);
}
@@ -1498,8 +1497,8 @@ namespace NKikimr {
if (expectedMsgId) {
expectedMsgId->Serialize(*record.MutableExpectedMsgId());
}
- if (CostModel && status == NKikimrProto::OK) {
- CostModel->FillInSettings(*record.MutableCostSettings());
+ if (VCtx->CostModel && status == NKikimrProto::OK) {
+ VCtx->CostModel->FillInSettings(*record.MutableCostSettings());
}
ctx.Send(ev->Sender, res.release(), flags, ev->Cookie);
}
@@ -2141,7 +2140,6 @@ namespace NKikimr {
Config->SkeletonFrontQueueBackpressureCheckMsgId,
SkeletonFrontGroup,
cfg)
- , CostModel()
, ReplMonGroup(VDiskCounters, "subsystem", "repl")
, SyncerMonGroup(VDiskCounters, "subsystem", "syncer")
, VDiskMonGroup(VDiskCounters, "subsystem", "state")
diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfullhandler.h b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfullhandler.h
index 7d4c29253a..36a4927818 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfullhandler.h
+++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfullhandler.h
@@ -1,7 +1,9 @@
#pragma once
#include "defs.h"
+#include <ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
+#include <ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h>
namespace NKikimr {
diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.h b/ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.h
index 62918b02d7..939d65c591 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.h
+++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.h
@@ -1,5 +1,6 @@
#pragma once
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
#include <library/cpp/actors/core/actor.h>
diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.h b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.h
index 01e185f8dd..a5403dac43 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.h
+++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.h
@@ -2,6 +2,7 @@
#include "defs.h"
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
namespace NKikimr {
diff --git a/ydb/core/blobstorage/vdisk/syncer/guid_propagator.h b/ydb/core/blobstorage/vdisk/syncer/guid_propagator.h
index de67b4611a..d85b393827 100644
--- a/ydb/core/blobstorage/vdisk/syncer/guid_propagator.h
+++ b/ydb/core/blobstorage/vdisk/syncer/guid_propagator.h
@@ -2,6 +2,7 @@
#include "defs.h"
#include <ydb/core/blobstorage/vdisk/common/blobstorage_vdisk_guids.h>
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/protos/blobstorage.pb.h>
namespace NKikimr {
diff --git a/ydb/core/blobstorage/vdisk/syncer/guid_proxybase.h b/ydb/core/blobstorage/vdisk/syncer/guid_proxybase.h
index ffdd4b26c7..514e2f9ce0 100644
--- a/ydb/core/blobstorage/vdisk/syncer/guid_proxybase.h
+++ b/ydb/core/blobstorage/vdisk/syncer/guid_proxybase.h
@@ -1,5 +1,6 @@
#pragma once
#include "defs.h"
+#include <ydb/core/blobstorage/vdisk/common/vdisk_context.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
#include <library/cpp/actors/core/interconnect.h>