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

database: collect database performance metrics by default #726

Merged
merged 3 commits into from
Oct 27, 2020

Conversation

ehnuje
Copy link
Contributor

@ehnuje ehnuje commented Oct 23, 2020

Proposed changes

  • Now database's read/write performance metrics are collected by default.
  • --db.no-perf-metrics can be used to disable collecting the metrics.
  • API to disable/enable collecting the metrics will be done in another PR.

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

cmd/utils/flags.go Outdated Show resolved Hide resolved
KimKyungup
KimKyungup previously approved these changes Oct 24, 2020
aidan-kwon
aidan-kwon previously approved these changes Oct 26, 2020
yoomee1313
yoomee1313 previously approved these changes Oct 26, 2020
jeongkyun-oh
jeongkyun-oh previously approved these changes Oct 26, 2020
@joowon-byun
Copy link
Contributor

Just two questions.

  1. Will there be a performance degradation, due to this PR?
  2. This might not be relevant to this PR. What happens if meter.Mark() is called before metrics.NewRegisteredMeter()? Is this an error? I am curioused because the code always call in sequence like : newDatabaseManager() -> db.Meter(). I think initializing the meters should occur before newDatabaseManager or inside it.

@ehnuje
Copy link
Contributor Author

ehnuje commented Oct 26, 2020

Just two questions.

  1. Will there be a performance degradation, due to this PR?

There is no performance degradation due to this PR.
Above figure is the one with this PR and the other one is the one without this PR.

screencapture-15-164-177-101-3000-d-KnJhY-iWz-klaytn-main-overview-2020-10-22-08_12_59 (1)
screencapture-13-125-96-237-3000-d-KnJhY-iWz-klaytn-main-overview-2020-10-22-08_13_08 (1)

  1. This might not be relevant to this PR. What happens if meter.Mark() is called before metrics.NewRegisteredMeter()? Is this an error? I am curioused because the code always call in sequence like : newDatabaseManager() -> db.Meter(). I think initializing the meters should occur before newDatabaseManager or inside it.

Panic happens when calling to the nil reference. To avoid that case, dynamoBatchWriteTimeMeter and dynamoBatchWriteSizeMeter, static variables, are initialized by NilMeter, which does nothing when Mark is called. As Put/Get/BatchWrite operations can be done after returning dbManager object, I think it is okay with the current initialization sequences. How do you think? @winnie-byun

@ehnuje ehnuje changed the title database: collect LevelDB performance metrics by default database: collect database performance metrics by default Oct 26, 2020
@joowon-byun
Copy link
Contributor

If there is no performance degradation, why did you define DBNoPerformanceMetricsFlag?

@ehnuje
Copy link
Contributor Author

ehnuje commented Oct 27, 2020

If there is no performance degradation, why did you define DBNoPerformanceMetricsFlag?

@winnie-byun Because I'm uncertain that I've tested all the possible cases. If we won't see any performance degradation for reasonable period of time, we surely can remove the flag.

@ehnuje ehnuje merged commit cdfec8b into klaytn:dev Oct 27, 2020
@ehnuje ehnuje deleted the 1019-leveldb-metrics branch October 27, 2020 05:44
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.

None yet

6 participants