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

Add stats for active compactions #7281

Merged
merged 1 commit into from
Oct 18, 2016
Merged

Conversation

mark-rushakoff
Copy link
Contributor

@mark-rushakoff mark-rushakoff commented Sep 9, 2016

Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated
  • Sign CLA (if not already signed)

Adds stats to track the current number of active compactions. The existing stats for compactions were only updated after a compaction completed.

Also report on the error stats that we track. Previously they were not
emitted in the stats output.

statTSMOptimizeCompactions = "tsmOptimizeCompactions"
statTSMOptimizeCompactionsActive = "tsmOptimizeCompactionsActive"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do something similar to the query executor for this? I remember for the query executor, we decided to add tracking how many compactions were run because it would end up being zero a lot. I know TSM compactions generally run faster so this might not be an issue for them, but this might run into the same issue where a compaction runs between monitor intervals and it never gets recorded.

Although we kept both for the query executor since one was more useful for SHOW STATS. Maybe we should have both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some (many? most?) compactions will run in less than the 10-second period between writes to _internal, but we've seen systems under heavy load that have had compactions running for several minutes. The difficulty in determining the cause of the change in system load without an indicator of active compactions, was the driving motivation in adding a stat for active compactions.

What do you mean by "something similar to the query executor"? Separate counters for started vs finished?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, that's what I was thinking. Separate counters for started vs finished. This could be fine by itself though.

@mark-rushakoff
Copy link
Contributor Author

@jsternberg I moved all the logic around executing a compaction into a compactionStrategy type. I didn't realize on the first pass through, that the logic around full vs. level compactions was identical as well; now it's all in one place and ready for review.


if err == errCompactionInProgress {
time.Sleep(time.Second)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jwilder it seems like every error case has a time.Sleep - but errCompactionsDisabled seems like the only error case where we don't sleep.

Do you think it would be okay to remove the sleep calls from compactGroup and unconditionally sleep inside compactTSMLevel and compactTSMFull?

TSMFullCompactions int64
TSMFullCompactionErrors int64
TSMFullCompactionDuration int64
CacheCompactions int64 // Counter of cache compactions that have ever run.
Copy link
Contributor

Choose a reason for hiding this comment

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

Documentation ❤️

@jwilder
Copy link
Contributor

jwilder commented Oct 18, 2016

@mark-rushakoff Looks good. Needs a rebase though.

Unify logic around compaction execution to a single place.

Also report on the error stats that we track. Previously they were not
emitted in the stats output.
@mark-rushakoff mark-rushakoff merged commit 987aaa7 into master Oct 18, 2016
@mark-rushakoff mark-rushakoff deleted the mr-compaction-stats branch October 18, 2016 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants