-
Notifications
You must be signed in to change notification settings - Fork 25
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
增加慢日志记录 #23
base: master
Are you sure you want to change the base?
增加慢日志记录 #23
Conversation
Codecov Report
@@ Coverage Diff @@
## master #23 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 1 1
Lines 3 3
======================================
Misses 3 3 Continue to review full report at Codecov.
|
@@ -268,6 +270,12 @@ impl ClusterConfig { | |||
pub(crate) fn fetch_interval_ms(&self) -> u64 { | |||
self.fetch_interval.unwrap_or(DEFAULT_FETCH_INTERVAL_MS) | |||
} | |||
|
|||
pub fn set_slowlog_slow_than(&mut self, value: u64) { | |||
if self.slowlog_slow_than.is_none() { |
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.
这里不用判断吧?
pub cluster: String, | ||
pub cmd: String, | ||
pub start: String, | ||
pub total_dur: u128, |
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.
上128干啥。。。
} | ||
} | ||
|
||
pub fn slowlog_entry(&self, cc: Ref<ClusterConfig>) -> Option<Entry> { | ||
let cmd = self.borrow(); |
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.
这里想办法封装额。。。别copy代码
|
||
Some(Entry { | ||
cluster: cc.name.clone(), | ||
cmd: cmd.req.str_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.
entry这里,对于过多的请求不应该copy。经常有命令变慢是因为
* 过长的命令列表
* 过长的key
* 过大的返回值
这里不管不顾全copy了之后可能造成性能的进一步下降。多利用 Bytes 的 Arc 的特性,减少copy的可能
@@ -550,6 +665,7 @@ impl Command { | |||
total_tracker: None, | |||
|
|||
remote_tracker: None, | |||
remote_dur: None, |
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.
重复的比较多的时候可以考虑封装个 Default
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 p = cParams { iInsertMax: 10, ..Default::default() };
这样
No description provided.