Skip to content
代码片段 群组 项目
  • Stan Hu's avatar
    23efa56b
    Speed up project exports by moving the archive to the cache dir · 23efa56b
    Stan Hu 创作于
    As described in
    https://github.com/carrierwaveuploader/carrierwave#large-files,
    CarrierWave will first copy a file into the cache and then copy the
    file to its final store.
    
    Previously the `move_to_cache` value was always set to `false`, which
    meant that CarrierWave would always copy the generated archive file
    (e.g. `/path/tmp/work`) to the cache dir
    (e.g. `/path/tmp/cache`). Since both paths are on the same filesystem,
    this copy is unnecessary and slows down the generation of project
    exports.
    
    To ensure files are moved instead of copied, we can just inherit from
    the GitlabUploader implementation of `move_to_cache`, which returns
    `true` if it's a local file, `false` otherwise. We have to be careful
    to only allow this optimization for project/group exports because
    imports might be importing a static template.
    
    For my test with the Linux kernel, this changed saved 47 seconds of
    unnecessary I/O with a 3.4 GB archive.
    
    Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/349425
    
    Changelog: performance
    23efa56b
    历史
    Speed up project exports by moving the archive to the cache dir
    Stan Hu 创作于
    As described in
    https://github.com/carrierwaveuploader/carrierwave#large-files,
    CarrierWave will first copy a file into the cache and then copy the
    file to its final store.
    
    Previously the `move_to_cache` value was always set to `false`, which
    meant that CarrierWave would always copy the generated archive file
    (e.g. `/path/tmp/work`) to the cache dir
    (e.g. `/path/tmp/cache`). Since both paths are on the same filesystem,
    this copy is unnecessary and slows down the generation of project
    exports.
    
    To ensure files are moved instead of copied, we can just inherit from
    the GitlabUploader implementation of `move_to_cache`, which returns
    `true` if it's a local file, `false` otherwise. We have to be careful
    to only allow this optimization for project/group exports because
    imports might be importing a static template.
    
    For my test with the Linux kernel, this changed saved 47 seconds of
    unnecessary I/O with a 3.4 GB archive.
    
    Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/349425
    
    Changelog: performance
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。