From 306fd5a4d211480f6d1574d810dc2245e4b47017 Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Sun, 4 Dec 2022 17:42:39 -0500 Subject: [PATCH] rgw: finish adding the bool config var for perf counters cache Signed-off-by: Ali Maredia --- src/common/options/rgw.yaml.in | 7 ++++++ src/rgw/rgw_op.cc | 42 +++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/common/options/rgw.yaml.in b/src/common/options/rgw.yaml.in index 33fe0a607948a..cce68e6401b8f 100644 --- a/src/common/options/rgw.yaml.in +++ b/src/common/options/rgw.yaml.in @@ -3692,3 +3692,10 @@ options: default: tank services: - rgw +- name: rgw_perf_counters_cache + type: bool + level: dev + default: false + desc: If set to true, rgw creates labeled perf counters and stores them in it's perf counters cache. + services: + - rgw diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index bfae8af1fd05a..f1f6173ae9673 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2154,6 +2154,7 @@ void RGWGetObj::execute(optional_yield y) std::unique_ptr run_lua; map::iterator attr_iter; std::string labels; + bool rgw_perf_counters_cache; perfcounter->inc(l_rgw_get); @@ -2322,11 +2323,14 @@ void RGWGetObj::execute(optional_yield y) return; } - labels = ceph::perf_counters::cache_key("z_rgw", {{"Bucket", s->bucket_name}, {"User", s->user->get_display_name()}}); - // TODO delete logging - ldpp_dout(this, 20) << "labels for perf counters cache for l_rgw_metrics_get_b: " << labels << dendl; - perf_counters_cache->add(labels); - perf_counters_cache->inc(labels, l_rgw_get_b, s->obj_size); + rgw_perf_counters_cache = s->cct->_conf.get_val("rgw_perf_counters_cache"); + if(rgw_perf_counters_cache) { + labels = ceph::perf_counters::cache_key("z_rgw", {{"Bucket", s->bucket_name}, {"User", s->user->get_display_name()}}); + // TODO delete logging + ldpp_dout(this, 20) << "labels for perf counters cache for l_rgw_metrics_get_b: " << labels << dendl; + perf_counters_cache->add(labels); + perf_counters_cache->inc(labels, l_rgw_get_b, s->obj_size); + } perfcounter->inc(l_rgw_get_b, end - ofs); @@ -2336,7 +2340,11 @@ void RGWGetObj::execute(optional_yield y) op_ret = filter->flush(); perfcounter->tinc(l_rgw_get_lat, s->time_elapsed()); - perf_counters_cache->tinc(labels, l_rgw_get_lat, s->time_elapsed()); + + if(rgw_perf_counters_cache) { + perf_counters_cache->tinc(labels, l_rgw_get_lat, s->time_elapsed()); + } + if (op_ret < 0) { goto done_err; } @@ -3908,14 +3916,17 @@ void RGWPutObj::execute(optional_yield y) off_t fst; off_t lst; + bool rgw_perf_counters_cache = s->cct->_conf.get_val("rgw_perf_counters_cache"); std::string labels = ceph::perf_counters::cache_key("z_rgw", {{"Bucket", s->bucket_name}, {"User", s->user->get_display_name()}}); - // TODO delete below logging - ldpp_dout(this, 20) << "labels for perf counters cache for l_rgw_metrics_put_b: " << labels << dendl; - uint64_t target_size = s->cct->_conf.get_val("labeled_perfcounters_cache_size"); - bool eviction = s->cct->_conf.get_val("labeled_perfcounters_cache_eviction"); - ldpp_dout(this, 20) << "target size for perf counters cache is: " << target_size << " eviction is: " << eviction << dendl; + if(rgw_perf_counters_cache) { + // TODO delete below logging + ldpp_dout(this, 20) << "labels for perf counters cache for l_rgw_metrics_put_b: " << labels << dendl; + uint64_t target_size = s->cct->_conf.get_val("labeled_perfcounters_cache_size"); + bool eviction = s->cct->_conf.get_val("labeled_perfcounters_cache_eviction"); + ldpp_dout(this, 20) << "target size for perf counters cache is: " << target_size << " eviction is: " << eviction << dendl; - perf_counters_cache->add(labels); + perf_counters_cache->add(labels); + } bool need_calc_md5 = (dlo_manifest == NULL) && (slo_info == NULL); perfcounter->inc(l_rgw_put); @@ -3923,6 +3934,8 @@ void RGWPutObj::execute(optional_yield y) auto put_lat = make_scope_guard([&] { perfcounter->tinc(l_rgw_put_lat, s->time_elapsed()); perf_counters_cache->tinc(labels, l_rgw_put_lat, s->time_elapsed()); + //if(rgw_perf_counters_cache) { + //} }); op_ret = -EINVAL; @@ -4184,7 +4197,10 @@ void RGWPutObj::execute(optional_yield y) s->obj_size = ofs; s->object->set_obj_size(ofs); - perf_counters_cache->inc(labels, l_rgw_put_b, s->obj_size); + rgw_perf_counters_cache = s->cct->_conf.get_val("rgw_perf_counters_cache"); + if(rgw_perf_counters_cache) { + perf_counters_cache->inc(labels, l_rgw_put_b, s->obj_size); + } perfcounter->inc(l_rgw_put_b, s->obj_size); -- 2.39.5