Skip to content
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

Storages: add metrics of read thread (#9412) #9420

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dbms/src/Common/TiFlashMetrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,8 @@ static_assert(RAFT_REGION_BIG_WRITE_THRES * 4 < RAFT_REGION_BIG_WRITE_MAX, "Inva
M(tiflash_read_thread_internal_us, \
"Durations of read thread internal components", \
Histogram, \
F(type_block_queue_pop_latency, {{"type", "block_queue_pop_latency"}}, ExpBuckets{1, 2, 20}))
F(type_block_queue_pop_latency, {{"type", "block_queue_pop_latency"}}, ExpBuckets{1, 2, 20}), \
F(type_schedule_one_round, {{"type", "schedule_one_round"}}, ExpBuckets{1, 2, 20}))


/// Buckets with boundaries [start * base^0, start * base^1, ..., start * base^(size-1)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ bool SegmentReadTaskScheduler::isStop() const

std::tuple<UInt64, UInt64, UInt64> SegmentReadTaskScheduler::scheduleOneRound()
{
Stopwatch sw;
UInt64 erased_pool_count = 0;
UInt64 sched_null_count = 0;
UInt64 sched_succ_count = 0;
Expand Down Expand Up @@ -265,6 +266,7 @@ std::tuple<UInt64, UInt64, UInt64> SegmentReadTaskScheduler::scheduleOneRound()
++sched_succ_count;
SegmentReaderPoolManager::instance().addTask(std::move(merged_task));
}
GET_METRIC(tiflash_read_thread_internal_us, type_schedule_one_round).Observe(sw.elapsed() / 1000.0);
return std::make_tuple(erased_pool_count, sched_null_count, sched_succ_count);
}

Expand Down
1 change: 1 addition & 0 deletions dbms/src/Storages/DeltaMerge/SegmentReadTaskPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ void SegmentReadTaskPool::finishSegment(const SegmentReadTaskPtr & seg)
if (pool_finished)
{
q.finish();
LOG_INFO(log, "pool_id={} finished", pool_id);
}
}

Expand Down
6 changes: 3 additions & 3 deletions dbms/src/Storages/DeltaMerge/SegmentReadTaskPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,20 @@ class SegmentReadTaskPool
auto total_count = blk_stat.totalCount();
auto total_bytes = blk_stat.totalBytes();
auto blk_avg_bytes = total_count > 0 ? total_bytes / total_count : 0;
auto approximate_max_pending_block_bytes = blk_avg_bytes * max_queue_size;
auto approx_max_pending_block_bytes = blk_avg_bytes * max_queue_size;
auto total_rows = blk_stat.totalRows();
LOG_INFO(
log,
"Done. pool_id={} pop={} pop_empty={} pop_empty_ratio={} "
"max_queue_size={} blk_avg_bytes={} approximate_max_pending_block_bytes={:.2f}MB "
"max_queue_size={} blk_avg_bytes={} approx_max_pending_block_bytes={:.2f}MB "
"total_count={} total_bytes={:.2f}MB total_rows={} avg_block_rows={} avg_rows_bytes={}B",
pool_id,
pop_times,
pop_empty_times,
pop_empty_ratio,
max_queue_size,
blk_avg_bytes,
approximate_max_pending_block_bytes / 1024.0 / 1024.0,
approx_max_pending_block_bytes / 1024.0 / 1024.0,
total_count,
total_bytes / 1024.0 / 1024.0,
total_rows,
Expand Down