-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hotkey): build a fundamental framework of hotkey detection (#603)
- Loading branch information
Showing
7 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
Submodule rdsn
updated
4 files
+7 −0 | include/dsn/dist/replication/replication_app_base.h | |
+6 −0 | src/replica/replica.cpp | |
+2 −0 | src/replica/replica.h | |
+1 −1 | src/replica/replica_stub.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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 "hotkey_collector.h" | ||
|
||
namespace pegasus { | ||
namespace server { | ||
|
||
// TODO: (Tangyanzhao) implement these functions | ||
void hotkey_collector::handle_rpc(const dsn::replication::detect_hotkey_request &req, | ||
dsn::replication::detect_hotkey_response &resp) | ||
{ | ||
} | ||
|
||
void hotkey_collector::capture_raw_key(const dsn::blob &raw_key, int64_t weight) | ||
{ | ||
// TODO: (Tangyanzhao) Add a judgment sentence to check if it is a raw key | ||
} | ||
|
||
void hotkey_collector::capture_hash_key(const dsn::blob &hash_key, int64_t weight) {} | ||
|
||
} // namespace server | ||
} // namespace pegasus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// 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. | ||
|
||
#pragma once | ||
|
||
#include <dsn/utility/string_view.h> | ||
#include <dsn/dist/replication/replication_types.h> | ||
|
||
namespace pegasus { | ||
namespace server { | ||
|
||
// hotkey_collector is responsible to find the hot keys after the partition | ||
// was detected to be hot. The two types of hotkey, READ & WRITE, are detected | ||
// separately. | ||
// | ||
// +--------------------+ +----------------------------------------------------+ | ||
// | Replcia server | | Hotkey collector | | ||
// | | | +-----------------------------------------------+ | | ||
// | +----------------+ | | | Corase capture | | | ||
// | | | |--> | +----------+ | | | ||
// | | RPC received | || | | | Data | | | | ||
// | | | || | | +-----+----+ | | | ||
// | +-------+--------+ || | | | | | | ||
// | | || | | +---------------+----v--+-------+---------+ | | | ||
// | v || | | | |Hot | | | | | | | ||
// | +-------+--------+ || | | |Bucket |Bucket |Bucket |Bucket |Bucket | | | | ||
// | | Replication | || | | +-----------+-----------------------------+ | | | ||
// | | (only on the | || | | | | | | ||
// | | write path)) | || | +--------------|--------------------------------+ | | ||
// | +-------+--------+ || | +--v---+ | | ||
// | | || | | Data | | | ||
// | v || | +------+ | | ||
// | +-------+--------+ || | +-----|-------+-------------+ | | ||
// | | | || | +------|-------------|-------------|---------+ | | ||
// | | Capture data ---| | | Fine |capture | | | | | ||
// | | | | | | | | | | | | ||
// | +-------+--------+ | | | +----v----+ +----v----+ +----v----+ | | | ||
// | | | | | | queue | | queue | | queue | | | | ||
// | v | | | +----+----+ +----+----+ +----+----+ | | | ||
// | +-------+--------+ | | | | | | | | | ||
// | | | | | | +----v-------------v-------------v------+ | | | ||
// | | Place data | | | | | Analsis pool | | | | ||
// | | to the disk | | | | +-----------------|---------------------+ | | | ||
// | | | | | +-------------------|------------------------+ | | ||
// | +----------------+ | | v | | ||
// | | | Hotkey | | ||
// +--------------------+ +----------------------------------------------------+ | ||
|
||
class hotkey_collector | ||
{ | ||
public: | ||
// TODO: (Tangyanzhao) capture_*_key should be consistent with hotspot detection | ||
// weight: calculate the weight according to the specific situation | ||
void capture_raw_key(const dsn::blob &raw_key, int64_t weight); | ||
void capture_hash_key(const dsn::blob &hash_key, int64_t weight); | ||
void handle_rpc(const dsn::replication::detect_hotkey_request &req, | ||
/*out*/ dsn::replication::detect_hotkey_response &resp); | ||
}; | ||
|
||
} // namespace server | ||
} // namespace pegasus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters