From 39e5a2a406b77fa82e9a78c267b679d49927e3c3 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Mon, 15 Jul 2013 13:44:20 -0700 Subject: [PATCH] OSD: add config option for peering_wq batch size Large peering_wq batch sizes may excessively delay peering messages resulting in unreasonably long peering. This may speed up peering. Backport: cuttlefish Related: #5084 Signed-off-by: Samuel Just Reviewed-by: Sage Weil --- src/common/config_opts.h | 1 + src/osd/OSD.cc | 2 +- src/osd/OSD.h | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index a959b4db40144..485a683692b47 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -393,6 +393,7 @@ OPTION(osd_map_cache_size, OPT_INT, 500) OPTION(osd_map_message_max, OPT_INT, 100) // max maps per MOSDMap message OPTION(osd_map_share_max_epochs, OPT_INT, 100) // cap on # of inc maps we send to peers, clients OPTION(osd_op_threads, OPT_INT, 2) // 0 == no threading +OPTION(osd_peering_wq_batch_size, OPT_U64, 20) OPTION(osd_op_pq_max_tokens_per_priority, OPT_U64, 4194304) OPTION(osd_op_pq_min_cost, OPT_U64, 65536) OPTION(osd_disk_threads, OPT_INT, 1) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index f2cb90756642b..e0f00b92536ec 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -918,7 +918,7 @@ OSD::OSD(int id, Messenger *internal_messenger, Messenger *external_messenger, finished_lock("OSD::finished_lock"), test_ops_hook(NULL), op_wq(this, g_conf->osd_op_thread_timeout, &op_tp), - peering_wq(this, g_conf->osd_op_thread_timeout, &op_tp, 200), + peering_wq(this, g_conf->osd_op_thread_timeout, &op_tp), map_lock("OSD::map_lock"), peer_map_epoch_lock("OSD::peer_map_epoch_lock"), debug_drop_pg_create_probability(g_conf->osd_debug_drop_pg_create_probability), diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 5114c99b66a39..cbd61b0a7bcbc 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -901,10 +901,9 @@ private: list peering_queue; OSD *osd; set in_use; - const size_t batch_size; - PeeringWQ(OSD *o, time_t ti, ThreadPool *tp, size_t batch_size) + PeeringWQ(OSD *o, time_t ti, ThreadPool *tp) : ThreadPool::BatchWorkQueue( - "OSD::PeeringWQ", ti, ti*10, tp), osd(o), batch_size(batch_size) {} + "OSD::PeeringWQ", ti, ti*10, tp), osd(o) {} void _dequeue(PG *pg) { for (list::iterator i = peering_queue.begin(); @@ -929,7 +928,8 @@ private: void _dequeue(list *out) { set got; for (list::iterator i = peering_queue.begin(); - i != peering_queue.end() && out->size() < batch_size; + i != peering_queue.end() && + out->size() < g_conf->osd_peering_wq_batch_size; ) { if (in_use.count(*i)) { ++i; -- 2.39.5