From: Ning Yao Date: Wed, 16 Dec 2015 01:36:54 +0000 (+0800) Subject: osd: use unordered_map for repop_map X-Git-Tag: v10.0.3~199^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6950%2Fhead;p=ceph.git 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 --- 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;