From 2ee74e511a7805fa68fa224573b5beee11fd3921 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Wed, 14 Jan 2026 18:20:26 +0530 Subject: [PATCH] tools/cephfs_mirror: Make datasync threads configureable Add a config to configure the number of data sync threads. Fixes: https://tracker.ceph.com/issues/73452 Signed-off-by: Kotresh HR --- src/common/options/cephfs-mirror.yaml.in | 22 +++++++++++++++++++--- src/tools/cephfs_mirror/PeerReplayer.cc | 11 +++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/common/options/cephfs-mirror.yaml.in b/src/common/options/cephfs-mirror.yaml.in index f826161872b..7448fe50b44 100644 --- a/src/common/options/cephfs-mirror.yaml.in +++ b/src/common/options/cephfs-mirror.yaml.in @@ -5,13 +5,29 @@ options: - name: cephfs_mirror_max_concurrent_directory_syncs type: uint level: advanced - desc: maximum number of concurrent snapshot synchronization threads - long_desc: maximum number of directory snapshots that can be synchronized concurrently - by cephfs-mirror daemon. Controls the number of synchronization threads. + desc: maximum number of concurrent snapshot synchronization crawler threads + long_desc: maximum number of directory snapshots that can be crawled concurrently + by cephfs-mirror daemon. Controls the number of synchronization crawler threads. + Note that the crawler threads also does entry operations like directory creations, + file deletes and snapshot deletes/renames. default: 3 services: - cephfs-mirror min: 1 +- name: cephfs_mirror_max_concurrent_data_sync_threads + type: uint + level: advanced + desc: maximum number of concurrent snapshot data synchronization threads + long_desc: maximum number of directory snapshots that can be synchronized concurrently + by cephfs-mirror daemon. Controls the number of data synchronization threads. This is + the pool of threads that sync the files concurrently, queued by the crawler thread for + each snapshot. Note that the pool of threads pick up one snapshot at a time eventhough + the configured cephfs_mirror_max_concurrent_directory_syncs number of crawler threads + could concurrently crawl and sync entry operations. + default: 5 + services: + - cephfs-mirror + min: 1 - name: cephfs_mirror_action_update_interval type: secs level: advanced diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index 3b701836a89..8cb3d612bf6 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -299,14 +299,13 @@ int PeerReplayer::init() { m_replayers.push_back(std::move(replayer)); } - //TODO: Have a separate tuneable for data sync threads - nr_replayers = g_ceph_context->_conf.get_val( - "cephfs_mirror_max_concurrent_directory_syncs"); - dout(20) << ": spawning " << nr_replayers << " snapshot data replayer(s)" << dendl; - while (nr_replayers-- > 0) { + auto nr_data_replayers = g_ceph_context->_conf.get_val( + "cephfs_mirror_max_concurrent_data_sync_threads"); + dout(20) << ": spawning " << nr_data_replayers << " snapshot data replayer(s)" << dendl; + while (nr_data_replayers-- > 0) { std::unique_ptr data_replayer( new SnapshotDataSyncThread(this)); - std::string name("d_replayer-" + stringify(nr_replayers)); + std::string name("d_replayer-" + stringify(nr_data_replayers)); data_replayer->create(name.c_str()); m_data_replayers.push_back(std::move(data_replayer)); } -- 2.47.3