From: Sage Weil Date: Fri, 14 Apr 2017 16:15:02 +0000 (-0400) Subject: os/bluestore: do not balance bluefs on every kv_sync_thread iteration X-Git-Tag: v12.0.3~327^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=880884b517346a414aceae31ff8057b960fd38e5;p=ceph.git os/bluestore: do not balance bluefs on every kv_sync_thread iteration This showed up with multiple samples in a wall-clock profile. We do not need to reconsider the freespace balance on every single kv commit cycle. Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 8984c35594e3..ee28638787fc 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -1020,6 +1020,7 @@ OPTION(bluestore_bluefs_min_ratio, OPT_FLOAT, .02) // min fs free / total free OPTION(bluestore_bluefs_max_ratio, OPT_FLOAT, .90) // max fs free / total free OPTION(bluestore_bluefs_gift_ratio, OPT_FLOAT, .02) // how much to add at a time OPTION(bluestore_bluefs_reclaim_ratio, OPT_FLOAT, .20) // how much to reclaim at a time +OPTION(bluestore_bluefs_balance_interval, OPT_FLOAT, 1) // how often (sec) to balance free space between bluefs and bluestore // If you want to use spdk driver, you need to specify NVMe serial number here // with "spdk:" prefix. // Users can use 'lspci -vvv -d 8086:0953 | grep "Device Serial Number"' to diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e9f0d1d40f80..663a1e83dd23 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -7847,7 +7847,10 @@ void BlueStore::_kv_sync_thread() } PExtentVector bluefs_gift_extents; - if (bluefs) { + if (bluefs && + after_flush - bluefs_last_balance > + cct->_conf->bluestore_bluefs_balance_interval) { + bluefs_last_balance = after_flush; int r = _balance_bluefs_freespace(&bluefs_gift_extents); assert(r >= 0); if (r > 0) { diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 64200e398bdc..8e6e22407039 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1723,6 +1723,8 @@ private: BlueFS *bluefs = nullptr; unsigned bluefs_shared_bdev = 0; ///< which bluefs bdev we are sharing bool bluefs_single_shared_device = true; + utime_t bluefs_last_balance; + KeyValueDB *db = nullptr; BlockDevice *bdev = nullptr; std::string freelist_type;