From ec42514f0e471e1ea8c5d656e4d8baaea5047168 Mon Sep 17 00:00:00 2001 From: Ning Yao Date: Wed, 16 Dec 2015 09:36:54 +0800 Subject: [PATCH] osd: use unordered_map for repop_map With a prediction of expected per pg maximum ops to initialize the number of hash bucket Signed-off-by: Ning Yao --- src/common/config_opts.h | 1 + src/osd/ReplicatedPG.cc | 1 + src/osd/ReplicatedPG.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 39f64998c8b9..230344568e83 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -553,6 +553,7 @@ OPTION(osd_max_write_size, OPT_INT, 90) OPTION(osd_max_pgls, OPT_U64, 1024) // max number of pgls entries to return OPTION(osd_client_message_size_cap, OPT_U64, 500*1024L*1024L) // client data allowed in-memory (in bytes) OPTION(osd_client_message_cap, OPT_U64, 100) // num client messages allowed in-memory +OPTION(osd_pg_op_threshold_ratio, OPT_U64, 2) // the expected maximum op over the average number of ops per pg OPTION(osd_pg_bits, OPT_INT, 6) // bits per osd OPTION(osd_pgp_bits, OPT_INT, 6) // bits per osd OPTION(osd_crush_chooseleaf_type, OPT_INT, 1) // 1 = host diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index ba7cfa91f90b..45d1f817dba0 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1338,6 +1338,7 @@ ReplicatedPG::ReplicatedPG(OSDService *o, OSDMapRef curmap, pgbackend->get_is_readable_predicate(), pgbackend->get_is_recoverable_predicate()); snap_trimmer_machine.initiate(); + repop_map.rehash(g_conf->osd_client_message_cap/_pool.info.get_pg_num() * g_conf->osd_pg_op_threshold_ratio); } void ReplicatedPG::get_src_oloc(const object_t& oid, const object_locator_t& oloc, object_locator_t& src_oloc) diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 9f328e50d592..a4f51d830690 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -21,6 +21,7 @@ #include #include "include/assert.h" +#include "include/unordered_map.h" #include "common/cmdparse.h" #include "HitSet.h" @@ -886,7 +887,7 @@ protected: // replica ops // [primary|tail] xlist repop_queue; - map repop_map; + ceph::unordered_map repop_map; friend class C_OSD_RepopApplied; friend class C_OSD_RepopCommit; -- 2.47.3