From d6037b7f484e13cfc9136e63e4cf7fac6ad68960 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 Dec 2019 07:43:54 -0600 Subject: [PATCH] mon: cap keys in mon_sync messages The previous cap was set at 1 MB. However, a user was experiencing mon timeouts while syncing the purged_snap_epoch * keys, which are ~20 bytes each. Reducing the max payload to 64K resolved the problem, which maps to (very!) roughly 1500 keys per message. Set our limit a bit higher than that since we just made this quite a bit more efficient. Most of the time the keys are larger than 20 bytes and we wouldn't hit the key limit, but having one ensures that we won't burn too much CPU in one go when we do have lots of these little keys. Signed-off-by: Sage Weil (cherry picked from commit 4d6c7e349b6749a45ef3ad239113e191b2c1d96a) --- src/common/legacy_config_opts.h | 1 + src/common/options.cc | 5 +++++ src/mon/Monitor.cc | 14 +++++++++----- src/mon/MonitorDBStore.h | 9 ++++++--- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h index 7aae31e8eabfe..d762a99e041d3 100644 --- a/src/common/legacy_config_opts.h +++ b/src/common/legacy_config_opts.h @@ -284,6 +284,7 @@ OPTION(mon_scrub_inject_missing_keys, OPT_DOUBLE) // probability of injected mis OPTION(mon_config_key_max_entry_size, OPT_INT) // max num bytes per config-key entry OPTION(mon_sync_timeout, OPT_DOUBLE) OPTION(mon_sync_max_payload_size, OPT_U32) // max size for a sync chunk payload (say) +OPTION(mon_sync_max_payload_keys, OPT_INT) OPTION(mon_sync_debug, OPT_BOOL) // enable sync-specific debug OPTION(mon_inject_sync_get_chunk_delay, OPT_DOUBLE) // inject N second delay on each get_chunk request OPTION(mon_osd_force_trim_to, OPT_INT) // force mon to trim maps to this point, regardless of min_last_epoch_clean (dangerous) diff --git a/src/common/options.cc b/src/common/options.cc index 8135ea8f1ebcd..95ddada8ef942 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -1941,6 +1941,11 @@ std::vector