diff --git a/rdsn b/rdsn index 5fe7ff16a5..ec34633e46 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 26ff59dee6..d59214deef 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 3b7086b695..68ad3dbc88 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 &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,