Skip to content

Conversation

@michaelsproul
Copy link
Member

@michaelsproul michaelsproul commented Nov 16, 2020

Proposed Changes

In an attempt to fix OOM issues and database consistency issues observed by some users after the introduction of compaction in v0.3.4, this PR makes the following changes:

  • Run compaction less often: roughly every 1024 epochs, including after long periods of non-finality. I think the division check proposed by Paul is pretty solid, and ensures we don't miss any events where we should be compacting. LevelDB lacks an easy way to check the size of the DB, which would be another good trigger.
  • Make it possible to disable the compaction on finalization using --auto-compact-db=false
  • Make it possible to trigger a manual, single-threaded foreground compaction on start-up using --compact-db
  • Downgrade the pruning log to DEBUG, as it's particularly noisy during sync

I would like to ship these changes to affected users ASAP, and will document them further in the Advanced Database section of the book if they prove effective.

@michaelsproul michaelsproul added A0 consensus An issue/PR that touches consensus code, such as state_processing or block verification. ready-for-review The code is ready for review database labels Nov 16, 2020
Copy link
Member

@paulhauner paulhauner left a comment

Choose a reason for hiding this comment

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

Looks good, only two comments/suggestions.

@paulhauner paulhauner added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Nov 16, 2020
@michaelsproul michaelsproul removed the consensus An issue/PR that touches consensus code, such as state_processing or block verification. label Nov 16, 2020
@michaelsproul michaelsproul added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Nov 16, 2020
@michaelsproul
Copy link
Member Author

I'm going to test sync on an HDD to see if this resolves issues, but I'm also happy to merge this in the meantime, as I think all these improvements are generally helpful, even if they don't 100% solve the OOM issue.

@paulhauner paulhauner added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Nov 17, 2020
@michaelsproul
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Nov 17, 2020
## Proposed Changes

In an attempt to fix OOM issues and database consistency issues observed by some users after the introduction of compaction in v0.3.4, this PR makes the following changes:

* Run compaction less often: roughly every 1024 epochs, including after long periods of non-finality. I think the division check proposed by Paul is pretty solid, and ensures we don't miss any events where we should be compacting. LevelDB lacks an easy way to check the size of the DB, which would be another good trigger.
* Make it possible to disable the compaction on finalization using `--auto-compact-db=false`
* Make it possible to trigger a manual, single-threaded foreground compaction on start-up using `--compact-db`
* Downgrade the pruning log to `DEBUG`, as it's particularly noisy during sync

I would like to ship these changes to affected users ASAP, and will document them further in the Advanced Database section of the book if they prove effective.
@michaelsproul
Copy link
Member Author

on second thoughts...

bors r-

I want to do some more testing. I suspect based on Dankrad's reports that the compaction is still too frequent during sync (23 compactions during Medalla sync is still a lot): #1917 (comment)

@bors
Copy link

bors bot commented Nov 17, 2020

Canceled.

Copy link
Member

@paulhauner paulhauner left a comment

Choose a reason for hiding this comment

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

Looks good! We spent a fair bit of time chatting about this out-of-band and I think the present compaction timing is good for now.

Merge it!

@michaelsproul
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Nov 17, 2020
## Proposed Changes

In an attempt to fix OOM issues and database consistency issues observed by some users after the introduction of compaction in v0.3.4, this PR makes the following changes:

* Run compaction less often: roughly every 1024 epochs, including after long periods of non-finality. I think the division check proposed by Paul is pretty solid, and ensures we don't miss any events where we should be compacting. LevelDB lacks an easy way to check the size of the DB, which would be another good trigger.
* Make it possible to disable the compaction on finalization using `--auto-compact-db=false`
* Make it possible to trigger a manual, single-threaded foreground compaction on start-up using `--compact-db`
* Downgrade the pruning log to `DEBUG`, as it's particularly noisy during sync

I would like to ship these changes to affected users ASAP, and will document them further in the Advanced Database section of the book if they prove effective.
@bors
Copy link

bors bot commented Nov 17, 2020

@bors bors bot changed the title Refine compaction [Merged by Bors] - Refine compaction Nov 17, 2020
@bors bors bot closed this Nov 17, 2020
@michaelsproul michaelsproul deleted the refine-compaction branch November 17, 2020 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A0 database ready-for-merge This PR is ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants