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

Skipping Levels during compaction #11

Closed
simerplaha opened this issue Jun 10, 2018 · 3 comments
Closed

Skipping Levels during compaction #11

simerplaha opened this issue Jun 10, 2018 · 3 comments

Comments

@simerplaha
Copy link
Owner

simerplaha commented Jun 10, 2018

Segments that do not overlap with existing Segment in the Level should be skipped and pushed to the next Level when pushForward flag is set to true in the configuration.

In some cases this can reduce IO and increase overall database performance.

The logic to skip Segments is required here. Currently Segments are forwarded only when both the current Level and next Level are empty.

@simerplaha
Copy link
Owner Author

simerplaha commented Feb 16, 2019

Another reason this is needed is because SwayDB implements a multi folder structure where all Segments are placed in their dedicated Levels folder instead of a flat single folder for all Segments.

Multiple folders were chosen for the following advantages:

  • Each Level works independently and there is no tight coupling between Levels. This is useful if new Level implementations were added.
    For example: If we were to implement an S3Level where all Segment are pushed to S3 then this would be implemented as an extension and plugged in without modifying any existing code.
  • Distributing Segments to multiple disks became easy to implement.
  • With dedicated folders it also becomes easy to visual compaction progress. We can simply look at the folders to see pending and completed compactions.

Multiple folders also bring in this one disadvantage which this issue can resolve.

  • Currently each Segment if not overlapping with any of the upper Level's Segments is copied into each Level during compaction which adds extra IO. Enabling pushForward configuration Levels can be skipped but this requires that next Level should be empty.

Implementation of this issue will resolve wasted IO during copy by pushing Segments directly to the lowest non overlapping Level giving the same advantage as a flat folder structure.

@simerplaha simerplaha added the core label Mar 2, 2019
@simerplaha
Copy link
Owner Author

#84 should be considered when implementing this.

@simerplaha
Copy link
Owner Author

Implemented on master with a new compaction implementation. Will be released in v0.9.

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

No branches or pull requests

1 participant