You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2020/09/21 03:51:45 UTC

[GitHub] [incubator-pegasus] hycdong commented on a change in pull request #604: feat(hotspot): calculator auto detect hotkey in the hot partition

hycdong commented on a change in pull request #604:
URL: https://github.com/apache/incubator-pegasus/pull/604#discussion_r491781213



##########
File path: src/server/hotspot_partition_calculator.h
##########
@@ -63,7 +66,10 @@ class hotspot_partition_calculator
     // saving historical data can improve accuracy
     stat_histories _partitions_stat_histories;
 
+    std::vector<std::array<int, 2>> _hotpartition_pool;

Review comment:
       Add comments for this structure to explain the meaning of `array<int, 2>`

##########
File path: src/server/hotspot_partition_calculator.cpp
##########
@@ -128,15 +145,44 @@ void hotspot_partition_calculator::data_analyse()
         stat_histories_analyse(data_type, hot_points);
         update_hot_point(data_type, hot_points);
     }
+    if (!FLAGS_enable_hotkey_detect) {
+        return;
+    }
+    for (int data_type = 0; data_type <= 1; data_type++) {
+        detect_hotkey_in_hotpartition(data_type);
+    }
+}
+
+void hotspot_partition_calculator::detect_hotkey_in_hotpartition(int data_type)
+{
+    for (int index = 0; index < _hot_points.size(); index++) {
+        if (_hot_points[index][data_type].get()->get_value() >= FLAGS_hot_partition_threshold) {
+            if (++_hotpartition_pool[index][data_type] >= FLAGS_occurrence_threshold) {
+                derror_f("Find a {} hot partition {}.{}",
+                         (data_type == partition_qps_type::READ_HOTSPOT_DATA ? "read" : "write"),
+                         _app_name,
+                         index);
+                send_hotkey_detect_request(_app_name,
+                                           index,
+                                           (data_type == dsn::apps::hotkey_type::type::READ)
+                                               ? dsn::apps::hotkey_type::type::READ
+                                               : dsn::apps::hotkey_type::type::WRITE,
+                                           dsn::apps::hotkey_detect_action::type::START);
+            }
+        } else {
+            _hotpartition_pool[index][data_type] =
+                std::max(_hotpartition_pool[index][data_type] - 1, 0);

Review comment:
       Why try to decrease the value of `_hotpartition_pool[index][data_type]`? Actually, I don't know the usage of `_hotpartition_pool`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org