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

Optimize the cost of writing metrics #420

Closed
djshow832 opened this issue Dec 23, 2023 · 0 comments · Fixed by #467
Closed

Optimize the cost of writing metrics #420

djshow832 opened this issue Dec 23, 2023 · 0 comments · Fixed by #467
Assignees
Labels
enhancement New feature or request

Comments

@djshow832
Copy link
Collaborator

djshow832 commented Dec 23, 2023

Development Task

When running sysbench point select, the CPU cost of adding metrics of CPS and duration per cmd is about 5%. We can try to optimize it.

For example:

  • Store the result of WithLabelValues(...) to avoid calling it every time
  • Only increase the CPS in an atomic value and write the value into metrics every second by a dedicated goroutine
  • Replace time.Now() with runtime.nanotime()

metrics_profile

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

Successfully merging a pull request may close this issue.

1 participant