From a6eae1b88ffb00b601bfaa18f01a52932e499df3 Mon Sep 17 00:00:00 2001 From: levy Date: Wed, 24 Mar 2021 19:32:57 +0800 Subject: [PATCH] feat: add read rate limiter perfcounter in info collector --- rdsn | 2 +- src/server/info_collector.cpp | 2 ++ src/server/info_collector.h | 6 ++++++ src/server/table_stats.h | 8 ++++++++ src/shell/command_helper.h | 6 ++++++ src/shell/commands/table_management.cpp | 4 ++++ 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/rdsn b/rdsn index e2bf7c740b..140548388e 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit e2bf7c740b93cc4a59769b6dc888609f36871b67 +Subproject commit 140548388e62700b3f018c9f6ccaf2f0b396df35 diff --git a/src/server/info_collector.cpp b/src/server/info_collector.cpp index 2efabaed3a..a4f4d76fcd 100644 --- a/src/server/info_collector.cpp +++ b/src/server/info_collector.cpp @@ -213,6 +213,8 @@ info_collector::app_stat_counters *info_collector::get_app_counters(const std::s INIT_COUNTER(recent_abnormal_count); INIT_COUNTER(recent_write_throttling_delay_count); INIT_COUNTER(recent_write_throttling_reject_count); + INIT_COUNTER(recent_read_throttling_delay_count); + INIT_COUNTER(recent_read_throttling_reject_count); INIT_COUNTER(storage_mb); INIT_COUNTER(storage_count); INIT_COUNTER(rdb_block_cache_hit_rate); diff --git a/src/server/info_collector.h b/src/server/info_collector.h index a7afff20c1..c8012321a5 100644 --- a/src/server/info_collector.h +++ b/src/server/info_collector.h @@ -75,6 +75,10 @@ class info_collector row_stats.total_recent_write_throttling_delay_count); recent_write_throttling_reject_count->set( row_stats.total_recent_write_throttling_reject_count); + recent_read_throttling_delay_count->set( + row_stats.total_recent_read_throttling_delay_count); + recent_read_throttling_reject_count->set( + row_stats.total_recent_read_throttling_reject_count); storage_mb->set(row_stats.total_storage_mb); storage_count->set(row_stats.total_storage_count); rdb_block_cache_hit_rate->set( @@ -130,6 +134,8 @@ class info_collector ::dsn::perf_counter_wrapper recent_abnormal_count; ::dsn::perf_counter_wrapper recent_write_throttling_delay_count; ::dsn::perf_counter_wrapper recent_write_throttling_reject_count; + ::dsn::perf_counter_wrapper recent_read_throttling_delay_count; + ::dsn::perf_counter_wrapper recent_read_throttling_reject_count; ::dsn::perf_counter_wrapper storage_mb; ::dsn::perf_counter_wrapper storage_count; ::dsn::perf_counter_wrapper rdb_block_cache_hit_rate; diff --git a/src/server/table_stats.h b/src/server/table_stats.h index 1fe0b66373..cf9e10edac 100644 --- a/src/server/table_stats.h +++ b/src/server/table_stats.h @@ -68,6 +68,8 @@ struct table_stats total_recent_abnormal_count += row.recent_abnormal_count; total_recent_write_throttling_delay_count += row.recent_write_throttling_delay_count; total_recent_write_throttling_reject_count += row.recent_write_throttling_reject_count; + total_recent_read_throttling_delay_count += row.recent_read_throttling_delay_count; + total_recent_read_throttling_reject_count += row.recent_read_throttling_reject_count; total_storage_mb += row.storage_mb; total_storage_count += row.storage_count; total_rdb_block_cache_hit_count += row.rdb_block_cache_hit_count; @@ -114,6 +116,10 @@ struct table_stats row_stats.total_recent_write_throttling_delay_count; total_recent_write_throttling_reject_count += row_stats.total_recent_write_throttling_reject_count; + total_recent_read_throttling_delay_count += + row_stats.total_recent_read_throttling_delay_count; + total_recent_read_throttling_reject_count += + row_stats.total_recent_read_throttling_reject_count; total_storage_mb += row_stats.total_storage_mb; total_storage_count += row_stats.total_storage_count; total_rdb_block_cache_hit_count += row_stats.total_rdb_block_cache_hit_count; @@ -158,6 +164,8 @@ struct table_stats double total_recent_abnormal_count = 0; double total_recent_write_throttling_delay_count = 0; double total_recent_write_throttling_reject_count = 0; + double total_recent_read_throttling_delay_count = 0; + double total_recent_read_throttling_reject_count = 0; double total_storage_mb = 0; double total_storage_count = 0; double total_rdb_block_cache_hit_count = 0; diff --git a/src/shell/command_helper.h b/src/shell/command_helper.h index d345ad66af..0b9f9590a7 100644 --- a/src/shell/command_helper.h +++ b/src/shell/command_helper.h @@ -595,6 +595,8 @@ struct row_data double recent_abnormal_count = 0; double recent_write_throttling_delay_count = 0; double recent_write_throttling_reject_count = 0; + double recent_read_throttling_delay_count = 0; + double recent_read_throttling_reject_count = 0; double storage_mb = 0; double storage_count = 0; double rdb_block_cache_hit_count = 0; @@ -660,6 +662,10 @@ update_app_pegasus_perf_counter(row_data &row, const std::string &counter_name, row.recent_write_throttling_delay_count += value; else if (counter_name == "recent.write.throttling.reject.count") row.recent_write_throttling_reject_count += value; + else if (counter_name == "recent.read.throttling.delay.count") + row.recent_read_throttling_delay_count += value; + else if (counter_name == "recent.read.throttling.reject.count") + row.recent_read_throttling_reject_count += value; else if (counter_name == "disk.storage.sst(MB)") row.storage_mb += value; else if (counter_name == "disk.storage.sst.count") diff --git a/src/shell/commands/table_management.cpp b/src/shell/commands/table_management.cpp index e96b3d3210..a283ff1bd4 100644 --- a/src/shell/commands/table_management.cpp +++ b/src/shell/commands/table_management.cpp @@ -505,6 +505,8 @@ bool app_stat(command_executor *e, shell_context *sc, arguments args) sum.recent_abnormal_count += row.recent_abnormal_count; sum.recent_write_throttling_delay_count += row.recent_write_throttling_delay_count; sum.recent_write_throttling_reject_count += row.recent_write_throttling_reject_count; + sum.recent_read_throttling_delay_count += row.recent_read_throttling_delay_count; + sum.recent_read_throttling_reject_count += row.recent_read_throttling_reject_count; sum.storage_mb += row.storage_mb; sum.storage_count += row.storage_count; sum.rdb_block_cache_hit_count += row.rdb_block_cache_hit_count; @@ -589,6 +591,8 @@ bool app_stat(command_executor *e, shell_context *sc, arguments args) tp.append_data(row.recent_abnormal_count); tp.append_data(row.recent_write_throttling_delay_count); tp.append_data(row.recent_write_throttling_reject_count); + tp.append_data(row.recent_read_throttling_delay_count); + tp.append_data(row.recent_read_throttling_reject_count); } if (!only_qps) { tp.append_data(row.storage_mb);