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

RFC: various optimization targeting 'rename' and "compact' (but not only...) #621

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Commits on Dec 1, 2021

  1. cache: rcache optimization with conditional read ahead

    Monitoring the lfs_bd_read usage during time consuming operations (eg. rename)
    shows a very large of uncache reads on small (less than cache size)
    consecutive offsets.
    
    Implementing a read ahead strategy when such consecutive reads are detective
    is an effective optimization.
    invoxiaamo committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    f9f599f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    caaf63b View commit details
    Browse the repository at this point in the history
  3. utils: Measure performance of various IO and function calls

    Enabled with LFS_PERF_STATS define
    invoxiaamo committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    593b616 View commit details
    Browse the repository at this point in the history
  4. Optimization of the rename case.

    Rename can be VERY time consuming. One of the reasons is the 4 recursion
    level depth of lfs_dir_traverse() seen if a compaction happened during the
    rename.
    
    lfs_dir_compact()
      size computation
        [1] lfs_dir_traverse(cb=lfs_dir_commit_size)
             - do 'duplicates and tag update'
           [2] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[1])
               - Reaching a LFS_FROM_MOVE tag (here)
             [3] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[1]) <= on 'from' dir
                 - do 'duplicates and tag update'
               [4] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[3])
      followed by the compaction itself:
        [1] lfs_dir_traverse(cb=lfs_dir_commit_commit)
             - do 'duplicates and tag update'
           [2] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[1])
               - Reaching a LFS_FROM_MOVE tag (here)
             [3] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[1]) <= on 'from' dir
                 - do 'duplicates and tag update'
               [4] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[3])
    
    Yet, analyse shows that levels [3] and [4] don't perform anything
    if the callback is lfs_dir_traverse_filter...
    
    A practical example:
    
    - format and mount a 4KB block FS
    - create 100 files of 256 Bytes named "/dummy_%d"
    - create a 1024 Byte file "/test"
    - rename "/test" "/test_rename"
    - create a 1024 Byte file "/test"
    - rename "/test" "/test_rename"
    This triggers a compaction where lfs_dir_traverse was called 148393 times,
    generating 25e6+ lfs_bd_read calls (~100 MB+ of data)
    
    With the optimization, lfs_dir_traverse is now called 3248 times
    (589e3 lfs_bds_calls (~2.3MB of data)
    
    => x 43 improvement...
    invoxiaamo committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    d09dcda View commit details
    Browse the repository at this point in the history

Commits on Dec 10, 2021

  1. Update lfs.c

    Co-authored-by: BenBE <[email protected]>
    invoxiaamo and BenBE authored Dec 10, 2021
    Configuration menu
    Copy the full SHA
    ae1d454 View commit details
    Browse the repository at this point in the history
  2. Update lfs.c

    Co-authored-by: BenBE <[email protected]>
    invoxiaamo and BenBE authored Dec 10, 2021
    Configuration menu
    Copy the full SHA
    6f4fc80 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2022

  1. Update lfs.c

    Co-authored-by: GIldons <[email protected]>
    invoxiaamo and GIldons authored Mar 25, 2022
    Configuration menu
    Copy the full SHA
    bf33e69 View commit details
    Browse the repository at this point in the history