-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Performance Diagnosis Enhancements #12362
Comments
ref #12362 PerfFlags provides more fine-grained PerfContext collecting. In this way, we only collect the duration we really care about. Theoretically, it reduces the overhead of collecting PerfContext compared to using PerfLevel::EnableTime. This commit only changes the raftstore part. The read pool part will be done later. The default value of raftstore.perf-level is changed to Uninitialized. The config is not documented before, so I think the change is not so important to change the default value. Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
…2432) ref #12362 This commit enables some more perf flags about reading, such as block read time, DB mutex wait time. So, it enables us to find out the root cause of more performance issues. It also includes some refactorings of unifying the functions of capturing PerfContext in tikv_kv into engine_rocks because engine specific functions should be hidden in engine_* as much as possible. This is the first step that removes statistics from tikv_kv, and later code referencing directly to the engine_rocks should be also removed. Signed-off-by: Yilin Chen <sticnarf@gmail.com>
…kv#12432) ref tikv#12362 This commit enables some more perf flags about reading, such as block read time, DB mutex wait time. So, it enables us to find out the root cause of more performance issues. It also includes some refactorings of unifying the functions of capturing PerfContext in tikv_kv into engine_rocks because engine specific functions should be hidden in engine_* as much as possible. This is the first step that removes statistics from tikv_kv, and later code referencing directly to the engine_rocks should be also removed. Signed-off-by: Yilin Chen <sticnarf@gmail.com> Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
ref #12362 This commit measures the read duration spent on reading (e.g. write conflict checks). This fixes the missing part of scheduler commands and may help diagnosis when scheduler reading takes a long time. This commit also changes some now_coarse to now. now_coarse has a precision of 10ms on many systems, so it may not meet our precision requirement. Instant::now is fast enough to be called in these cases. Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ref tikv#12362 This commit measures the read duration spent on reading (e.g. write conflict checks). This fixes the missing part of scheduler commands and may help diagnosis when scheduler reading takes a long time. This commit also changes some now_coarse to now. now_coarse has a precision of 10ms on many systems, so it may not meet our precision requirement. Instant::now is fast enough to be called in these cases. Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ref #12362 This commit is a large refactoring that moves collecting engine PerfContext from storage and coprocessor to engine_rocks and the tracker. Now, the storage and coprocessor are mostly decoupled with a specific engine (engine_rocks). And it introduces a general trakcer mechanism to collect the metrics of a request during its whole lifetime. It will help us collect more performance critical data of a single request more easily. Signed-off-by: Yilin Chen <sticnarf@gmail.com>
ref tikv#12362 This commit measures the read duration spent on reading (e.g. write conflict checks). This fixes the missing part of scheduler commands and may help diagnosis when scheduler reading takes a long time. This commit also changes some now_coarse to now. now_coarse has a precision of 10ms on many systems, so it may not meet our precision requirement. Instant::now is fast enough to be called in these cases. Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ref #12362 This commit records perf contexts around executing txn scheduler commands. This helps us know the detail performance data of the underlying engine. Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ref #12362 Our raft implementation has its flow control mechanism to limit the inflight message number. But we're not able to know whether and when we are throttled. Then, it's hard for us to know whether we should adjust the max-inflight-msgs config. This commit tries to improve this case. It's complex to add hooks to raft-rs to know how long a message is throttled, but we can do it in the raftstore. We record the propose time, and consume it and record it in the histogram when the messages is send through the transport. If flow control takes effect, the ready will be smaller than all under-replicated logs. So, we can know if flow control takes effect. Signed-off-by: Yilin Chen <sticnarf@gmail.com>
ref #12362 This commit replaces the request_times in the raftstore callback with a tracker token. Then, the waterfall metrics of a raft command will be recorded into the tracker. Signed-off-by: Yilin Chen <sticnarf@gmail.com>
ref tikv/raft-engine#227, ref #12362 We used to record perf contexts for Raft RocksDB and KV RocksDB with the same PerfContext. But we also have raft-engine now. So, we will miss perf contexts if we still use RocksDB perf contexts. This commit adds PerfContext support to RaftEngine and distinguish it from the perf context used for applying. Then, we'll record correct perf statistics for both raft engine and KV DB. Updated raft-engine to include tikv/raft-engine#227 Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ref tikv#12362 This commit replaces the request_times in the raftstore callback with a tracker token. Then, the waterfall metrics of a raft command will be recorded into the tracker. Signed-off-by: Yilin Chen <sticnarf@gmail.com>
ref tikv/raft-engine#227, ref tikv#12362 We used to record perf contexts for Raft RocksDB and KV RocksDB with the same PerfContext. But we also have raft-engine now. So, we will miss perf contexts if we still use RocksDB perf contexts. This commit adds PerfContext support to RaftEngine and distinguish it from the perf context used for applying. Then, we'll record correct perf statistics for both raft engine and KV DB. Updated raft-engine to include tikv/raft-engine#227 Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ref #12362 TiKV client can pass request_source through Context. It is useful for us to know how many requests there are from each source. So, this commit collects the count and the total duration by request source. The source label is not added to the command type in order to avoid creating too many label combinations. Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
@OneSizeFitsQuorum Are you interested in the time breakdown inside |
Yes, I can practice on it first. But I’m curious about what is |
I was thinking Probably they are helpful to account for the long apply wait time while the apply threads are vacant. But I am also a bit worried that these metrics are too tedious in most cases. (Maybe we can define levels for metrics too.) |
ref pingcap/kvproto#965, ref #12362 This commit record the pessimistic_lock_wait time for pessimistic transactions in the waitManager. Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org>
ref pingcap/kvproto#974, ref pingcap/kvproto#978, ref #12362 This commit records read_index_propose_wait_nanos, read_index_confirm_wait_nanos and read_pool_schedule_wait_nanos Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org>
ref pingcap/kvproto#974, ref pingcap/kvproto#978, ref tikv#12362 This commit records read_index_propose_wait_nanos, read_index_confirm_wait_nanos and read_pool_schedule_wait_nanos Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org> Signed-off-by: TonsnakeLin <lpbgytong@163.com>
ref pingcap/kvproto#965, ref tikv#12362 This commit record the pessimistic_lock_wait time for pessimistic transactions in the waitManager. Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org> Signed-off-by: fengou1 <feng.ou@pingcap.com>
ref pingcap/kvproto#974, ref pingcap/kvproto#978, ref tikv#12362 This commit records read_index_propose_wait_nanos, read_index_confirm_wait_nanos and read_pool_schedule_wait_nanos Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org> Signed-off-by: fengou1 <feng.ou@pingcap.com>
) ref #12362 This commit adds `perform_read_local` fail_point so we can force the lease read to be triggered, which allows the test `test_read_execution_tracker` to pass stably. Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org>
ref #12362 Fix the returned apply write wal tracking time. Signed-off-by: cfzjywxk <lsswxrxr@163.com>
ref #12362 Signed-off-by: cfzjywxk <lsswxrxr@163.com>
ref tikv#12362 Signed-off-by: cfzjywxk <lsswxrxr@163.com> Signed-off-by: tonyxuqqi <tonyxuqi@outlook.com>
ref #12362 add log and metric in raft_client. Signed-off-by: crazycs520 <crazycs520@gmail.com>
…17070) ref #12362 Add some necessary metrics for the observability on the duration of non-blocking and blocking ingestion of external sst files when scaling. Meanwhile, it also introduces a new metric to observe the duration on the cost of clearing overlapped regions. Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
TiKV users and developers often care about performance, but it is never easy to diagnose performance issues or find performance bottlenecks.
To improve the situation, we need to fill up the missing parts of the metrics, add more details to the metrics and try to improve the way we display the metrics. And, it's better to collect performance data in the request level and send back to the client if possible, enabling analyzing tail latency causes.
Data to be collected
Below are the missing data we are going to collect. "(R)" means the data may be collected for each request, and "(M)" means they are collected as metrics.
Read
async_snapshot
is completed by the local readerasync_snapshot
propose wait durationasync_snapshot
read index wait durationGetSnapshot
durationWrite
async_write
durationBackground jobs
Internal jobs from TiDB (ref pingcap/tidb#33963)
Diagnosis helper
The performance overview dashboard displays performance critical metrics. Some representitive newly added metrics can be put on the same dashboard as well.
Smart diagnosis service may use the metrics as input and generate reports about possible cause of the problem. But this is not in the TiKV project plan AFAIK.
Existing related issues
The following issues were created before, they may be some sub-tasks of this meta-issue. We hope this issue will cover most of the problems raised by the following issues.
The text was updated successfully, but these errors were encountered: