-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(collector): sort out the structure of partition hotspot detection #597
Conversation
Co-authored-by: Yingchun Lai <405403881@qq.com>
Co-authored-by: Wu Tao <wutao1@xiaomi.com>
Co-authored-by: Wu Tao <wutao1@xiaomi.com>
Co-authored-by: Wu Tao <wutao1@xiaomi.com>
Co-authored-by: Wu Tao <wutao1@xiaomi.com>
int sample_count = 0; | ||
while (!temp_data.empty()) { | ||
for (const auto &partition_data : temp_data.front()) { | ||
if (partition_data.total_qps - 1.00 > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need such prerequiste? What if a partition qps is 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to prevent too many 0 elements in the queue from interfering with the accuracy of the historical data, we choose to ignore some small values
Co-authored-by: Wu Tao <wutao1@xiaomi.com>
src/server/hotspot_partition_data.h
Outdated
enum partition_qps_type | ||
{ | ||
READ_HOTSPOT_DATA = 0, | ||
WRITE_HOTSPOT_DATA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why READ_HOTSPOT_DATA
init explictly, but WRITE_HOTSPOT_DATA
no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in cpp, the enum is increased by one orderly. so we only need to init the first one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first default 0, so also can not be inited?
typedef std::vector<std::vector<std::unique_ptr<dsn::perf_counter_wrapper>>> hot_partition_counters; | ||
|
||
// hotspot_partition_calculator is used to find the hot partition in a table. | ||
class hotspot_partition_calculator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class hotspot_partition_calculator | |
class hotspot_partition_calculator : public replica_base |
replica_base
has a app_name()
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hotspot_partition_calculator stores the statistical data of the correspond table, _app_name
is for that table, not itself.
What problem does this PR solve?
This submission is mainly to merge the previous code, as part of the overall refactoring.
What is changed and how it works?
In the previous design, partition hotspot detection is designed as a 'strategic model'.
in this PR, I will deprecate the formal design, and combine
hotspot_policy
hotspot_algo_qps_variance
andhotspot_calculator
intohotspot_partition_calculator
, and change some variable names by the way.The change of data structure and function will be refactored in #592
Config changes
[pegasus.collector] - hotspot_detect_algorithm