You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by zh...@apache.org on 2021/01/12 10:16:36 UTC
[incubator-pegasus] branch master updated: feat(hotkey): dynamic
change some parameters in hotkey detection (#679)
This is an automated email from the ASF dual-hosted git repository.
zhaoliwei 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 2344660 feat(hotkey): dynamic change some parameters in hotkey detection (#679)
2344660 is described below
commit 2344660bf14dc5f7c0ec17309816de0146659618
Author: Smilencer <52...@qq.com>
AuthorDate: Tue Jan 12 18:16:20 2021 +0800
feat(hotkey): dynamic change some parameters in hotkey detection (#679)
---
rdsn | 2 +-
src/server/hotkey_collector.cpp | 5 ++++-
src/server/hotspot_partition_calculator.cpp | 27 ++++++++++++++++-----------
3 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/rdsn b/rdsn
index 5fe7ff1..ec34633 160000
--- a/rdsn
+++ b/rdsn
@@ -1 +1 @@
-Subproject commit 5fe7ff16a5ecd7656f04a8689637d27865678e33
+Subproject commit ec34633e4695e881209973460469b2b069c0f52e
diff --git a/src/server/hotkey_collector.cpp b/src/server/hotkey_collector.cpp
index 26ff59d..d59214d 100644
--- a/src/server/hotkey_collector.cpp
+++ b/src/server/hotkey_collector.cpp
@@ -33,19 +33,21 @@ DSN_DEFINE_uint32(
hot_bucket_variance_threshold,
7,
"the variance threshold to detect hot bucket during coarse analysis of hotkey detection");
+DSN_TAG_VARIABLE(hot_bucket_variance_threshold, FT_MUTABLE);
DSN_DEFINE_uint32(
"pegasus.server",
hot_key_variance_threshold,
5,
"the variance threshold to detect hot key during fine analysis of hotkey detection");
+DSN_TAG_VARIABLE(hot_key_variance_threshold, FT_MUTABLE);
DSN_DEFINE_uint32("pegasus.server",
hotkey_buckets_num,
37,
"the number of data capture hash buckets");
-DSN_DEFINE_validator(hotkey_buckets_num, [](int32_t bucket_num) -> bool {
+DSN_DEFINE_validator(hotkey_buckets_num, [](uint32_t bucket_num) -> bool {
if (bucket_num < 3) {
return false;
}
@@ -63,6 +65,7 @@ DSN_DEFINE_uint32(
max_seconds_to_detect_hotkey,
150,
"the max time (in seconds) allowed to capture hotkey, will stop if hotkey's not found");
+DSN_TAG_VARIABLE(max_seconds_to_detect_hotkey, FT_MUTABLE);
// 68–95–99.7 rule, same algorithm as hotspot_partition_calculator::stat_histories_analyse
/*extern*/ bool
diff --git a/src/server/hotspot_partition_calculator.cpp b/src/server/hotspot_partition_calculator.cpp
index 3b7086b..68ad3db 100644
--- a/src/server/hotspot_partition_calculator.cpp
+++ b/src/server/hotspot_partition_calculator.cpp
@@ -41,17 +41,20 @@ DSN_DEFINE_bool("pegasus.collector",
enable_detect_hotkey,
false,
"auto detect hot key in the hot paritition");
+DSN_TAG_VARIABLE(enable_detect_hotkey, FT_MUTABLE);
-DSN_DEFINE_int32("pegasus.collector",
- hot_partition_threshold,
- 3,
- "threshold of hotspot partition value, if app.stat.hotspots >= "
- "FLAGS_hotpartition_threshold, this partition is a hot partition");
+DSN_DEFINE_uint32("pegasus.collector",
+ hot_partition_threshold,
+ 3,
+ "threshold of hotspot partition value, if app.stat.hotspots >= "
+ "FLAGS_hotpartition_threshold, this partition is a hot partition");
+DSN_TAG_VARIABLE(hot_partition_threshold, FT_MUTABLE);
-DSN_DEFINE_int32("pegasus.collector",
- occurrence_threshold,
- 3,
- "hot paritiotion occurrence times' threshold to send rpc to detect hotkey");
+DSN_DEFINE_uint32("pegasus.collector",
+ occurrence_threshold,
+ 3,
+ "hot paritiotion occurrence times' threshold to send rpc to detect hotkey");
+DSN_TAG_VARIABLE(occurrence_threshold, FT_MUTABLE);
void hotspot_partition_calculator::data_aggregate(const std::vector<row_data> &partition_stats)
{
@@ -149,9 +152,11 @@ void hotspot_partition_calculator::data_analyse()
void hotspot_partition_calculator::detect_hotkey_in_hotpartition(int data_type)
{
+ auto now_hot_partition_threshold = FLAGS_hot_partition_threshold;
+ auto now_occurrence_threshold = FLAGS_occurrence_threshold;
for (int index = 0; index < _hot_points.size(); index++) {
- if (_hot_points[index][data_type].get()->get_value() >= FLAGS_hot_partition_threshold) {
- if (++_hotpartition_counter[index][data_type] >= FLAGS_occurrence_threshold) {
+ if (_hot_points[index][data_type].get()->get_value() >= now_hot_partition_threshold) {
+ if (++_hotpartition_counter[index][data_type] >= now_occurrence_threshold) {
derror_f("Find a {} hot partition {}.{}",
(data_type == partition_qps_type::READ_HOTSPOT_DATA ? "read" : "write"),
_app_name,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org