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/17 16:46:50 UTC

[GitHub] [incubator-pegasus] Smityz commented on a change in pull request #603: feat(hotkey detection): build a fundamental framework of hotkey detection

Smityz commented on a change in pull request #603:
URL: https://github.com/apache/incubator-pegasus/pull/603#discussion_r490409485



##########
File path: src/server/hotkey_coarse_data_collector.h
##########
@@ -0,0 +1,46 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "base/pegasus_utils.h"
+
+namespace pegasus {
+namespace server {
+
+// hotkey_coarse_data_collector handles the first procedure (COARSE) of hotkey detection.
+// It captures the data without recording them, but simply divides the incoming requests
+// into a number of buckets and counts the accessed times of each bucket.
+// If the variance among the buckets exceeds the threshold, the most accessed bucket
+// is regarded to contain the hotkey.
+//
+// This technique intends to reduce the load of data recording during FINE procedure,
+// filtering what's unnecessary to catch.
+class hotkey_coarse_data_collector
+{
+public:
+    // Counts `row_cnt` for the bucket of `hash_key`.
+    void capture_data(const dsn::blob &hash_key, uint64_t size);
+
+    // returns: id of the most accessed bucket.
+    //          -1 if not hot bucket is found.
+    int analyse_data();

Review comment:
       This name is related to the overall semantics and is not recommended to be changed




----------------------------------------------------------------
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