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

Parallelize vertical compactions inside a single group #5936

Closed
wants to merge 22 commits into from

Commits on Dec 1, 2022

  1. Parallelize vertical compactions

    The current compaction implementation allocates one goroutine per compaction
    stream. This means that compaction can run as fast as the slowest stream.
    As a result, as soon as one stream starts to fall behind, the all other streams
    can become affected. In addition, despite setting a high compact-concurrency,
    CPU utilization can still be low because of the one-goroutine-per-stream limit.
    
    The compaction algorithm also prioritizes vertical compactions over horizontal ones.
    As soon as it detects any overlapping blocks, it will compact those blocks and reevaluate
    the plan in a subsequent iteration.
    
    This commit enables parallel execution of vertical compactions within a single compaction
    stream. It does that by first changing the Planner interface to allow it to return multiple
    compaction tasks per group instead of a single one. It also adapts the algorithm for detecting
    overlapping blocks to be able to detect multiple independent groups. These groups are then
    returned as distinct compaction tasks and the compactor can execute them in separate goroutines.
    
    By modifying the planner interface, this commit also enables parallelizing
    horizontal compactions in the future.
    
    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 1, 2022
    Configuration menu
    Copy the full SHA
    912172b View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2022

  1. Run all tasks independently

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    d71c4d1 View commit details
    Browse the repository at this point in the history
  2. Use errutil.MultiError instead of cortex MultiError

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    c911229 View commit details
    Browse the repository at this point in the history
  3. Add test case for progress calculator

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    afe27df View commit details
    Browse the repository at this point in the history
  4. Remove ULID return value

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    321efdc View commit details
    Browse the repository at this point in the history
  5. Iterate through all errors for a compaction group

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    31885e1 View commit details
    Browse the repository at this point in the history
  6. Add test case for large index size

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    86af2a8 View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2022

  1. Parametrize concurrency inside single group

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 3, 2022
    Configuration menu
    Copy the full SHA
    1248a96 View commit details
    Browse the repository at this point in the history
  2. Change test name

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 3, 2022
    Configuration menu
    Copy the full SHA
    09bdb1a View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2022

  1. Limit concurrency of tasks to global concurrency

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    b58d2bf View commit details
    Browse the repository at this point in the history
  2. Improve flag description

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    c804045 View commit details
    Browse the repository at this point in the history
  3. Fix linter

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    d754370 View commit details
    Browse the repository at this point in the history
  4. Add vertical compaction check

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    24fd336 View commit details
    Browse the repository at this point in the history
  5. Adjust e2e tests to not account for empty planning cycles

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    a808840 View commit details
    Browse the repository at this point in the history
  6. Run make docs

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    7c6dba5 View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2022

  1. Automatically infer group concurrency

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 7, 2022
    Configuration menu
    Copy the full SHA
    a7d4a7b View commit details
    Browse the repository at this point in the history
  2. Run make docs

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 7, 2022
    Configuration menu
    Copy the full SHA
    f476edb View commit details
    Browse the repository at this point in the history
  3. Fix tests

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 7, 2022
    Configuration menu
    Copy the full SHA
    2662961 View commit details
    Browse the repository at this point in the history
  4. Distribute tasks in round-robin manner

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 7, 2022
    Configuration menu
    Copy the full SHA
    407e98a View commit details
    Browse the repository at this point in the history
  5. Add e2e test for parallel compaction

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 7, 2022
    Configuration menu
    Copy the full SHA
    25705dc View commit details
    Browse the repository at this point in the history
  6. Plan at least one task from each group

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 7, 2022
    Configuration menu
    Copy the full SHA
    e3e94c6 View commit details
    Browse the repository at this point in the history

Commits on Dec 12, 2022

  1. Clean up scheduling

    Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
    fpetkovski committed Dec 12, 2022
    Configuration menu
    Copy the full SHA
    ea766ad View commit details
    Browse the repository at this point in the history