This is an automated email from the ASF dual-hosted git repository.

yuchenhe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new ae90a0f  feat(collector): support more table-level rocksdb perfcounter 
 (#800)
ae90a0f is described below

commit ae90a0fe83746452105a54c318b15a94df458a24
Author: Jiashuo <[email protected]>
AuthorDate: Tue Aug 17 18:13:38 2021 +0800

    feat(collector): support more table-level rocksdb perfcounter  (#800)
---
 src/server/info_collector.cpp |  8 ++++++++
 src/server/info_collector.h   | 18 ++++++++++++++++++
 src/shell/command_helper.h    | 24 ++++++++++++++++++++++++
 3 files changed, 50 insertions(+)

diff --git a/src/server/info_collector.cpp b/src/server/info_collector.cpp
index 9962133..c7f2a84 100644
--- a/src/server/info_collector.cpp
+++ b/src/server/info_collector.cpp
@@ -153,6 +153,8 @@ void info_collector::on_app_stat()
     for (const auto &app_rows : all_rows) {
         // get statistics data for app
         row_data app_stats(app_rows.first);
+        app_stats.partition_count = app_rows.second.size();
+        all_stats.partition_count += app_rows.second.size();
         for (auto partition_row : app_rows.second) {
             app_stats.aggregate(partition_row);
         }
@@ -240,6 +242,12 @@ info_collector::app_stat_counters 
*info_collector::get_app_counters(const std::s
     INIT_COUNTER(check_and_mutate_bytes);
     INIT_COUNTER(read_bytes);
     INIT_COUNTER(write_bytes);
+    INIT_COUNTER(rdb_read_l2andup_hit_rate);
+    INIT_COUNTER(rdb_read_l1_hit_rate);
+    INIT_COUNTER(rdb_read_l0_hit_rate);
+    INIT_COUNTER(rdb_read_memtable_hit_rate);
+    INIT_COUNTER(rdb_write_amplification);
+    INIT_COUNTER(rdb_read_amplification);
     _app_stat_counters[app_name] = counters;
     return counters;
 }
diff --git a/src/server/info_collector.h b/src/server/info_collector.h
index 51ecd2a..a9e8ab0 100644
--- a/src/server/info_collector.h
+++ b/src/server/info_collector.h
@@ -110,6 +110,18 @@ public:
             check_and_mutate_bytes->set(row_stats.check_and_mutate_bytes);
             read_bytes->set(row_stats.get_total_read_bytes());
             write_bytes->set(row_stats.get_total_write_bytes());
+            rdb_read_l2andup_hit_rate->set(convert_to_1M_ratio(
+                row_stats.rdb_read_l2andup_hit_count, 
row_stats.rdb_block_cache_total_count));
+            
rdb_read_l1_hit_rate->set(convert_to_1M_ratio(row_stats.rdb_read_l1_hit_count,
+                                                          
row_stats.rdb_block_cache_total_count));
+            
rdb_read_l0_hit_rate->set(convert_to_1M_ratio(row_stats.rdb_read_l0_hit_count,
+                                                          
row_stats.rdb_block_cache_total_count));
+            rdb_read_memtable_hit_rate->set(convert_to_1M_ratio(
+                row_stats.rdb_read_memtable_hit_count, 
row_stats.rdb_block_cache_total_count));
+            rdb_write_amplification->set(row_stats.rdb_write_amplification /
+                                         row_stats.partition_count);
+            rdb_read_amplification->set(row_stats.rdb_read_amplification /
+                                        row_stats.partition_count);
         }
 
         ::dsn::perf_counter_wrapper get_qps;
@@ -161,6 +173,12 @@ public:
         ::dsn::perf_counter_wrapper check_and_mutate_bytes;
         ::dsn::perf_counter_wrapper read_bytes;
         ::dsn::perf_counter_wrapper write_bytes;
+        ::dsn::perf_counter_wrapper rdb_read_l2andup_hit_rate;
+        ::dsn::perf_counter_wrapper rdb_read_l1_hit_rate;
+        ::dsn::perf_counter_wrapper rdb_read_l0_hit_rate;
+        ::dsn::perf_counter_wrapper rdb_read_memtable_hit_rate;
+        ::dsn::perf_counter_wrapper rdb_write_amplification;
+        ::dsn::perf_counter_wrapper rdb_read_amplification;
     };
 
     info_collector();
diff --git a/src/shell/command_helper.h b/src/shell/command_helper.h
index 2ac605d..c6364a4 100644
--- a/src/shell/command_helper.h
+++ b/src/shell/command_helper.h
@@ -648,6 +648,12 @@ struct row_data
         multi_put_bytes += row.multi_put_bytes;
         check_and_set_bytes += row.check_and_set_bytes;
         check_and_mutate_bytes += row.check_and_mutate_bytes;
+        rdb_read_l2andup_hit_count += row.rdb_read_l2andup_hit_count;
+        rdb_read_l1_hit_count += row.rdb_read_l1_hit_count;
+        rdb_read_l0_hit_count += row.rdb_read_l0_hit_count;
+        rdb_read_memtable_hit_count += row.rdb_read_memtable_hit_count;
+        rdb_write_amplification += row.rdb_write_amplification;
+        rdb_read_amplification += row.rdb_read_amplification;
     }
 
     std::string row_name;
@@ -699,6 +705,12 @@ struct row_data
     double multi_put_bytes = 0;
     double check_and_set_bytes = 0;
     double check_and_mutate_bytes = 0;
+    double rdb_read_l2andup_hit_count = 0;
+    double rdb_read_l1_hit_count = 0;
+    double rdb_read_l0_hit_count = 0;
+    double rdb_read_memtable_hit_count = 0;
+    double rdb_write_amplification = 0;
+    double rdb_read_amplification = 0;
 };
 
 inline bool
@@ -796,6 +808,18 @@ update_app_pegasus_perf_counter(row_data &row, const 
std::string &counter_name,
         row.check_and_set_bytes += value;
     else if (counter_name == "check_and_mutate_bytes")
         row.check_and_mutate_bytes += value;
+    else if (counter_name == "rdb.read_l2andup_hit_count")
+        row.rdb_read_l2andup_hit_count += value;
+    else if (counter_name == "rdb.read_l1_hit_count")
+        row.rdb_read_l1_hit_count += value;
+    else if (counter_name == "rdb.read_l0_hit_count")
+        row.rdb_read_l0_hit_count += value;
+    else if (counter_name == "rdb.read_memtable_hit_count")
+        row.rdb_read_memtable_hit_count += value;
+    else if (counter_name == "rdb.write_amplification")
+        row.rdb_write_amplification += value;
+    else if (counter_name == "rdb.read_amplification")
+        row.rdb_read_amplification += value;
     else
         return false;
     return true;

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to