Speed up project exports by moving the archive to the cache dir
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
Showing
Please register or sign in to comment