diff options
author | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
commit | b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806 (patch) | |
tree | 2a23209faf0fea5586a6d4b9cee60d1b318d29fe /library/cpp/yt/stockpile | |
parent | 559174a9144de40d6bb3997ea4073c82289b4974 (diff) | |
download | ydb-b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806.tar.gz |
remove kikimr/driver DEPENDS
Diffstat (limited to 'library/cpp/yt/stockpile')
-rw-r--r-- | library/cpp/yt/stockpile/README.md | 12 | ||||
-rw-r--r-- | library/cpp/yt/stockpile/stockpile.h | 24 | ||||
-rw-r--r-- | library/cpp/yt/stockpile/stockpile_linux.cpp | 42 | ||||
-rw-r--r-- | library/cpp/yt/stockpile/stockpile_other.cpp | 12 |
4 files changed, 0 insertions, 90 deletions
diff --git a/library/cpp/yt/stockpile/README.md b/library/cpp/yt/stockpile/README.md deleted file mode 100644 index 6ee4cd1b1f..0000000000 --- a/library/cpp/yt/stockpile/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# stockpile - -При приближении к лимиту памяти в memory cgroup, linux запускает механизм direct reclaim, -чтобы освободить свободную память. По опыту YT, direct reclaim очень сильно замедляет работу -всего процесса. - -Проблема возникает не только, когда память занята анонимными страницами. 50% памяти контейнера -может быть занято не dirty страницами page cache, но проблема всёравно будет проявляться. Например, -если процесс активно читает файлы с диска без O_DIRECT, вся память очень быстро будет забита. - -Чтобы бороться с этой проблемой, в яндексовом ядре добавлена ручка `madvise(MADV_STOCKPILE)`. -Больше подробностей в https://st.yandex-team.ru/KERNEL-186
\ No newline at end of file diff --git a/library/cpp/yt/stockpile/stockpile.h b/library/cpp/yt/stockpile/stockpile.h deleted file mode 100644 index 2b1b53e9b5..0000000000 --- a/library/cpp/yt/stockpile/stockpile.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include <util/system/types.h> - -#include <util/generic/size_literals.h> - -#include <util/datetime/base.h> - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - -struct TStockpileOptions -{ - i64 BufferSize = 4_GB; - int ThreadCount = 4; - TDuration Period = TDuration::MilliSeconds(10); -}; - -void StockpileMemory(const TStockpileOptions& options); - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT diff --git a/library/cpp/yt/stockpile/stockpile_linux.cpp b/library/cpp/yt/stockpile/stockpile_linux.cpp deleted file mode 100644 index 9be33e3811..0000000000 --- a/library/cpp/yt/stockpile/stockpile_linux.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "stockpile.h" - -#include <thread> -#include <mutex> - -#include <sys/mman.h> - -#include <util/system/thread.h> - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - -namespace { - -void RunStockpile(const TStockpileOptions& options) -{ - TThread::SetCurrentThreadName("Stockpile"); - - constexpr int MADV_STOCKPILE = 0x59410004; - - while (true) { - ::madvise(nullptr, options.BufferSize, MADV_STOCKPILE); - Sleep(options.Period); - } -} - -} // namespace - -void StockpileMemory(const TStockpileOptions& options) -{ - static std::once_flag OnceFlag; - std::call_once(OnceFlag, [options] { - for (int i = 0; i < options.ThreadCount; i++) { - std::thread(RunStockpile, options).detach(); - } - }); -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT diff --git a/library/cpp/yt/stockpile/stockpile_other.cpp b/library/cpp/yt/stockpile/stockpile_other.cpp deleted file mode 100644 index 913ad88b20..0000000000 --- a/library/cpp/yt/stockpile/stockpile_other.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "stockpile.h" - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - -void StockpileMemory(const TStockpileOptions& /*options*/) -{ } - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT |