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

Implement removal of files via blocks discarding according to configured bandwidth #2303

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Commits on Jun 27, 2024

  1. file_discard_queue: implement removal of files via blocks discarding

    To avoid I/O latency spikes that are caused by too many TRIM requests
    issued to the drive over a short period of time when the filesystem
    is mounted with the online discard option and many files are removed,
    the file_discard_queue class is used.
    
    Instead of relying on the unlink operation that trims all extents of
    a file at once, the approach that utilizes blocks discarding at a
    given pace is used.
    
    When a user wants to remove a file, then file_discard_queue::enqueue_file_removal()
    needs to be called. Its main purpose is to store the information about the work
    related to file discard in the internal data of the class.
    
    Reactor will invoke file_discard_queue::try_discard_blocks() function via poller.
    The function checks if the bandwidth of discards allows another block to be
    discarded. If the bandwidth is available, then the discard is performed.
    
    The described approach ensures, that the amount of removed data remains at
    the configured level.
    
    Signed-off-by: Patryk Wrobel <[email protected]>
    pwrobelse committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    206ed65 View commit details
    Browse the repository at this point in the history
  2. file_discard_queue_test: implement basic unit tests

    This patch introduces unit tests for file_discard_queue class.
    To avoid interference between test cases, each of them manually
    triggers file_discard_queue::try_discard_blocks().
    
    In next patches file_discard_queue will be plugged into reactor
    for each shard. Then another part of tests will be added as a
    separate binary to check the full flow.
    
    Signed-off-by: Patryk Wrobel <[email protected]>
    pwrobelse committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    8b453b3 View commit details
    Browse the repository at this point in the history
  3. reactor: allow users to discard files according to configured bandwidth

    To enable usage of file_discard_queue in seastar applications,
    it had to be plugged into reactor.
    
    This patch introduces usage of file_discard_queue in reactor.
    The following changes have been implemented:
     - remove_file_via_blocks_discarding() function is available
       and allows users to discard files according to a given
       bandwidth (using file_discard_queue)
     - file_discard_queue_submission_pollfn poller was added to
       reactor's main loop to trigger the work related to discarding
       files
     - I/O properties contain two new optional parameters:
       discard_block_size and discard_requests_per_second that
       allow a user to configure the bandwidth of discards for
       a given mountpoint
    
    Signed-off-by: Patryk Wrobel <[email protected]>
    pwrobelse committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    45637c5 View commit details
    Browse the repository at this point in the history
  4. file_discard_queue_global_test: implement tests for blocks discarding…

    … removal
    
    In order to ensure that file discard queue is
    properly used by the reactor and can be configured
    via I/O properties parameters a new set of global
    tests was introduced.
    
    To avoid any interferences between test cases, they
    are run one after another in a seastar::thread.
    
    The test cases verify the full flow including usage
    of global utility functions, reactor, pollers and
    configured file discard queues. The bandwidth of
    discard operation is also verified.
    
    Signed-off-by: Patryk Wrobel <[email protected]>
    pwrobelse committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    e2ad5ba View commit details
    Browse the repository at this point in the history