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

增加慢日志记录 #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

增加慢日志记录 #23

wants to merge 3 commits into from

Conversation

vegetarianz
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Aug 4, 2020

Codecov Report

Merging #23 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 961aae6...82b014a. Read the comment docs.

@@ -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() {
Copy link
Owner

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,
Copy link
Owner

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();
Copy link
Owner

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(),
Copy link
Owner

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,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重复的比较多的时候可以考虑封装个 Default

Copy link
Owner

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() }; 

这样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants