Skip to content

Commit

Permalink
feat: add read rate limiter perfcounter in info collector (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
levy5307 authored and neverchanje committed Mar 31, 2021
1 parent b16994b commit ca17d70
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/server/info_collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/server/info_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/server/table_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/shell/command_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions src/shell/commands/table_management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ca17d70

Please sign in to comment.