// 相关选项 // @db_bench_tool.cc:783 DEFINE_bool(DOTA_enabled, false, "Whether trigger the DOTA framework"); DEFINE_bool(FEA_enable, false, "Trigger FEAT tuner's FEA component"); DEFINE_bool(TEA_enable, false, "Trigger FEAT tuner's TEA component"); DEFINE_int32(SILK_bandwidth_limitation, 200, "MBPS of disk limitation"); DEFINE_bool(SILK_triggered, false, "Whether the SILK tuner is triggered"); DEFINE_double(idle_rate, 1.25, "TEA will decide this as the idle rate of the threads"); DEFINE_double(FEA_gap_threshold, 1.5, "The negative feedback loop's threshold"); DEFINE_double(TEA_slow_flush, 0.5, "The negative feedback loop's threshold"); DEFINE_double(DOTA_tuning_gap, 1.0, "Tuning gap of the DOTA agent, in secs "); DEFINE_int64(random_fill_average, 150, "average inputs rate of background write operations"); DEFINE_bool(detailed_running_stats, false, "Whether record more detailed information in report agent");
auto thread_stat = LocateThreadStates(current_score); auto batch_stat = LocateBatchStates(current_score);
AdjustmentTuning(change_list_ptr, current_score, thread_stat, batch_stat); // decide the operation based on the best behavior and last behavior // update the histories last_thread_states = thread_stat; last_batch_stat = batch_stat; tuning_rounds++; }
// @DOTA_tuner.cc:195 voidDOTA_Tuner::AdjustmentTuning(std::vector<ChangePoint> *change_list, SystemScores &score, ThreadStallLevels thread_levels, BatchSizeStallLevels batch_levels){ // tune for thread number /* 注: 这里得到状态 */ auto tuning_op = VoteForOP(score, thread_levels, batch_levels); // tune for memtable /* 注: 这里根据状态(tuning_op)更新数据库设置列表(change_list) */ FillUpChangeList(change_list, tuning_op); }
voidFEAT_Tuner::DetectTuningOperations(int/*secs_elapsed*/, std::vector<ChangePoint> *change_list){ // first, we tune only when the flushing speed is slower than before auto current_score = this->ScoreTheSystem(); if (current_score.flush_speed_avg == 0) return ; scores.push_back(current_score); if (scores.size() == 1) { return; } this->UpdateMaxScore(current_score); if (scores.size() >= (size_t)this->score_array_len) { // remove the first record scores.pop_front(); } CalculateAvgScore();
current_score_ = current_score;
if (current_score_.flush_speed_avg >0 ){ TuningOP result{kKeep, kKeep}; if (TEA_enable) { result = TuneByTEA(); } if (FEA_enable) { TuningOP fea_result = TuneByFEA(); result.BatchOp = fea_result.BatchOp; } FillUpChangeList(change_list, result);
// SST sizes should be controlled to be the same as memtable size memtable_size_cp.value = std::to_string(target_value); sst_size_cp.value = std::to_string(target_value);
// calculate the total size of L1 uint64_t l1_size = current_opt.level0_file_num_compaction_trigger * current_opt.min_write_buffer_number_to_merge * target_value;