From: ZheNing Hu via GitGitGadget Date: Sat, 22 Oct 2022 15:46:04 GMT Subject: [PATCH] pack-objects: introduce --exclude-delta= option Message-ID: From: ZheNing Hu The server uses delta compression during git clone to reduce the amount of data transferred over the network, but delta compression for large binary blobs often does not reduce storage size significantly and wastes a lot of CPU. Git now disables delta compression for objects that meet these conditions: 1. files that have -delta set in .gitattributes 2. files that its size exceed the big_file_threshold However, in 1, .gitattributes needs to be set manually by the user, and in most cases the user does not actively set it, and it is not something that can be actively adjusted on the server aside. In 2, the big_file_threshold now defaults to 512MB, and many binary files smaller than that will be uselessly delta-compressed, and this is made worse if the server actively increases the big_file_threshold. Therefore, we need a way to be able to actively skip the delta compression of some files on the server. Introduces the `-exclude-delta=` option, which can be used to disable delta compression for objects that satisfy the pattern. Signed-off-by: ZheNing Hu --- pack-objects: introduce --exclude-delta= option While analyzing some repositories using git filter-repo -analyze, I noticed that many huge binaries in the repositories were delta-compressed without much reduction in size. $ cat .git/filter-repo/analysis/path-all-sizes.txt | more === All paths by reverse accumulated size === Format: unpacked size, packed size, date deleted, path name 23816778 23765921 2022-08-22 managed/src/universal/ybc/ybc-1.0.0-b1-linux-x86_64.tar.gz 22504398 22445676 2022-08-22 managed/src/universal/ybc/ybc-1.0.0-b1-el8-aarch64.tar.gz 11726471 6424233 2022-08-09 managed/yba-installer/yba-installer_linux_amd64 294644800 5794201 src/yb/master/catalog_manager.cc 2912780 2872186 docs/static/images/yp/tables-view-ycql.png 2992192 2634232 docs/static/images/yb-cloud/cloud-clusters-backups.png 2757095 2501915 docs/static/images/deploy/aws/aws-cf-configure-options.png ... The current solution to avoid delta compression is not very suitable for git servers. First, files that exceed the big_file_threshold are not delta compressed, but the above analysis indicates that many big binary files do not exceed the the big_file_threshold (default to 512MB). Second, there is not .gitattrbutes to disable delta compression for them, we also don't really can let repo administrators add it manually. But we can also see that the large files in these repositories often have some common characteristics: they end in ".tar.gz"or “.png". So perhaps we can take advantage of this feature and disable delta compression on the server for some common type binary files. This is currently implemented by command line parameters --exclude-delta=. But maybe we can also try passing it through git config. Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1392%2Fadlternative%2Fadl%2Fpack-object-no-try-delta-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1392/adlternative/adl/pack-object-no-try-delta-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/1392 Documentation/git-pack-objects.txt | 6 +++++- builtin/pack-objects.c | 28 +++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt index a9995a932ca..92cfee83df5 100644 --- a/Documentation/git-pack-objects.txt +++ b/Documentation/git-pack-objects.txt @@ -13,7 +13,7 @@ SYNOPSIS [--no-reuse-delta] [--delta-base-offset] [--non-empty] [--local] [--incremental] [--window=] [--depth=] [--revs [--unpacked | --all]] [--keep-pack=] - [--cruft] [--cruft-expiration=