1
0
mirror of https://github.com/Zygo/bees.git synced 2025-07-07 02:42:27 +02:00

throttle: add delays to match deferred request rate to btrfs completion rate

Measure the time spent running various operations that extend btrfs
transaction completion times (`LOGICAL_INO`, tmpfiles, and dedupe)
and arrange for each operation to run for not less than the average
amount of time by adding a sleep after each operation that takes less
than the average.

The delay after each operation is intended to slow down the rate of
deferred and long-running requests from bees to match the rate at which
btrfs is actually completing them.  This may help avoid big spikes in
latency if btrfs has so many requests queued that it has to force a
commit to release memory.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2024-12-10 00:36:28 -05:00
parent f209cafcd8
commit ea45982293
4 changed files with 58 additions and 9 deletions

View File

@ -605,8 +605,10 @@ BeesScanModeExtent::create_extent_map(const uint64_t bytenr, const ProgressTrack
} else {
BEESCOUNT(extent_fail);
}
const auto resolve_age = resolve_timer.age();
BEESCOUNTADD(extent_ms, resolve_timer.age() * 1000);
BEESCOUNTADD(extent_ms, resolve_age * 1000);
bees_throttle(resolve_age, "extent_map");
}
const size_t rv_count = log_ino.m_iors.size();