-
Notifications
You must be signed in to change notification settings - Fork 88
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
Record perf contexts to the write procedure #227
Conversation
Codecov Report
@@ Coverage Diff @@
## master #227 +/- ##
==========================================
+ Coverage 97.13% 97.22% +0.08%
==========================================
Files 30 30
Lines 9216 9368 +152
==========================================
+ Hits 8952 9108 +156
+ Misses 264 260 -4
Continue to review full report at Codecov.
|
5044f50
to
9501afe
Compare
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@sticnarf It's getting a little messy, I'm thinking something like this: It basically decouples perf context from prometheus with a new interface |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
I think |
I think it important to pass the breakdown to the followers. For each thread, it still gives mostly accurate information about how long is spent inside raft-engine for each reason. |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
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.
Update the changelog and add a simple test?
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
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.
Rest LG.
CHANGELOG.md
Outdated
@@ -10,6 +10,7 @@ | |||
|
|||
* Add `is_empty` to `Engine` API. | |||
* Add metadata deletion capability to `FileSystem` trait. Users can implement `exists_metadata` and `delete_metadata` to clean up obsolete metadata from older versions of Raft Engine. | |||
* Add `PerfContext` which records detailed time breakdown of the write process to thread-local storage. |
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.
Let's move it to new feature.
src/metrics.rs
Outdated
/// Time spent waiting for becoming the write leader. | ||
pub write_leader_wait_duration: Duration, |
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.
/// Time spent waiting for becoming the write leader. | |
pub write_leader_wait_duration: Duration, | |
/// Time spent waiting for the write group to form and get processed. | |
pub write_wait_duration: Duration, |
} | ||
let entered_time = writer.entered_time.unwrap(); | ||
ENGINE_WRITE_PREPROCESS_DURATION_HISTOGRAM | ||
.observe(entered_time.saturating_duration_since(start).as_secs_f64()); |
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.
debug assert perf_context_diff.write_wait_duration == 0.
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/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>
This PR tries to add RocksDB-like perf contexts to Raft Engine.
Now, I only add these statistics:
log_populating_nanos
write_leader_wait_nanos
log_write_nanos
log_rotate_nanos
log_sync_nanos
write_apply_nanos
I'm willing to know if there are other important metrics that is worth recording here.