From 5fca232080c0bde50b5c65c60c133bf81311e8d3 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 17 Dec 2014 16:06:55 +0100 Subject: [PATCH] crush: set_choose_tries = 100 for erasure code rulesets It is common for people to try to map 9 OSDs out of a 9 OSDs total ceph cluster. The default tries (50) will frequently lead to bad mappings for this use case. Changing it to 100 makes no significant CPU performance difference, as tested manually by running crushtool on one million mappings. http://tracker.ceph.com/issues/10353 Fixes: #10353 Signed-off-by: Loic Dachary (cherry picked from commit 2f87ac807f3cc7ac55d9677d2051645bf5396a62) --- src/crush/CrushWrapper.cc | 6 ++++-- src/erasure-code/lrc/ErasureCodeLrc.cc | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 34d430da4b0a..a1583853b768 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -812,15 +812,17 @@ int CrushWrapper::add_simple_ruleset(string name, string root_name, } int steps = 3; if (mode == "indep") - steps = 4; + steps = 5; int min_rep = mode == "firstn" ? 1 : 3; int max_rep = mode == "firstn" ? 10 : 20; //set the ruleset the same as rule_id(rno) crush_rule *rule = crush_make_rule(steps, rno, rule_type, min_rep, max_rep); assert(rule); int step = 0; - if (mode == "indep") + if (mode == "indep") { crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 5, 0); + crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSE_TRIES, 100, 0); + } crush_rule_set_step(rule, step++, CRUSH_RULE_TAKE, root, 0); if (type) crush_rule_set_step(rule, step++, diff --git a/src/erasure-code/lrc/ErasureCodeLrc.cc b/src/erasure-code/lrc/ErasureCodeLrc.cc index dd16252de723..d96460c4f526 100644 --- a/src/erasure-code/lrc/ErasureCodeLrc.cc +++ b/src/erasure-code/lrc/ErasureCodeLrc.cc @@ -62,7 +62,7 @@ int ErasureCodeLrc::create_ruleset(const string &name, } ruleset = rno; - int steps = 3 + ruleset_steps.size(); + int steps = 4 + ruleset_steps.size(); int min_rep = 3; int max_rep = 30; int ret; @@ -73,6 +73,8 @@ int ErasureCodeLrc::create_ruleset(const string &name, ret = crush.set_rule_step(rno, step++, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 5, 0); assert(ret == 0); + ret = crush.set_rule_step(rno, step++, CRUSH_RULE_SET_CHOOSE_TRIES, 100, 0); + assert(ret == 0); ret = crush.set_rule_step(rno, step++, CRUSH_RULE_TAKE, root, 0); assert(ret == 0); // [ [ "choose", "rack", 2 ], -- 2.47.3