Hi,
I have a gerrit server(3.8.3) hosting a big project(linux kernel), some users had a very low
speed when pushing up a patch, even a very simple patch.
And I found the "remote: counting objects" took a lot of time, like below:
"
GIT_TRACE=1 git push origin HEAD:refs/for/master
16:15:41.029637 git.c:455 trace: built-in: git push origin HEAD:refs/for/master
16:15:41.039893 run-command.c:668 trace: run_command: unset GIT_PREFIX; ssh -p 29418 172.16.10.40 'git-receive-pack '\''/linux/kernel'\'''
16:15:41.169691 run-command.c:668 trace: run_command: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress
16:15:41.172849 git.c:455 trace: built-in: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 80 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 323 bytes | 323.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2)
remote: Counting objects: 1991385, done
remote: Processing changes: refs: 1, new: 1, done
remote: hint: commit 670d98d: [code-owners] skipping validation of code owner config files
remote: hint: commit 670d98d: [code-owners] code-owners functionality is disabled
remote:
remote: SUCCESS
remote:
remote:
http://172.16.10.40/c/linux/kernel/+/2867 tst [NEW]
remote:
To ssh://
172.16.10.40:29418/linux/kernel * [new reference] HEAD -> refs/for/master
"
There is a very big objects number:1991385, and the most strange thing is when I copyed the whole project(in same machine), and generated a simple patch with another user, and pushing it again, it is very fast, and almost shows no "remote: counting objects xxx" message.
I did the gc periodically, and some of the configuations are :
[container]
...
heapLimit = 56g
[core]
#cache for the repo. should be the max size of one repo
packedGitLimit = 16g
packedGitWindowSize = 16k
packedGitOpenFiles = 2048
...
[gc]
startTime = Sun 02:30
interval = 3 days
and the gc_log:
"
[2024-03-10 02:58:05,988] INFO : [linux/kernel] gc config: gc.aggressive=false;
[2024-03-10 02:58:05,989] INFO : [linux/kernel] pack config: maxDeltaDepth=50, deltaSearchWindowSize=10, deltaSearchMemoryLimit=0, deltaCacheSize=52428800, deltaCacheLimit=100, compressionLevel=-1, indexVersion=2, bigFileThreshold=52428800, threads=0, reuseDeltas=true, reuseObjects=true, deltaCompress=true, buildBitmaps=true, bitmapContiguousCommitCount=100, bitmapRecentCommitCount=20000, bitmapRecentCommitSpan=100, bitmapDistantCommitSpan=5000, bitmapExcessiveBranchCount=100, bitmapInactiveBranchAge=90, searchForReuseTimeoutPT596523H14M7S, singlePack=false, minBytesForObjSizeIndex=-1
[2024-03-10 02:58:06,172] INFO : [linux/kernel] before: numberOfPackedRefs=5604, numberOfPackFiles=32, sizeOfLooseObjects=43184, numberOfLooseObjects=62, numberOfPackedObjects=11482820, numberOfBitmaps=0, numberOfLooseRefs=6, sizeOfPackedObjects=4848003783
[2024-03-10 03:14:55,690] INFO : [linux/kernel] after: numberOfPackedRefs=5609, numberOfPackFiles=2, sizeOfLooseObjects=16316, numberOfLooseObjects=19, numberOfPackedObjects=11477050, numberOfBitmaps=2091, numberOfLooseRefs=1, sizeOfPackedObjects=4838679568
"
and the related sshd_log:
"
2024-03-11T17:44:59.257+08:00] 0f3e9ad5 [SSH git-receive-pack /linux/kernel (user)] user a/1000097 git-receive-pack./linux/kernel 4ms 51749ms - 0 git/2.34.1 51000ms 51000ms 19538841112
"
the git-sizer shows:
Processing blobs: 2900232
Processing trees: 7035339
Processing commits: 1522584
Matching commits to trees: 1522584
Processing annotated tags: 4612
Processing references: 4721
| Name | Value | Level of concern |
| ---------------------------- | --------- | ------------------------------ |
| Overall repository size | | |
| * Commits | | |
| * Count | 1.52 M | *** |
| * Total size | 1.35 GiB | ***** |
| * Trees | | |
| * Count | 7.04 M | **** |
| * Total size | 19.8 GiB | ********** |
| * Total tree entries | 573 M | *********** |
| * Blobs | | |
| * Count | 2.90 M | * |
| * Total size | 116 GiB | ************ |
| | | |
| Biggest objects | | |
| * Commits | | |
| * Maximum size [1] | 72.7 KiB | * |
| * Maximum parents [2] | 66 | ****** |
| * Trees | | |
| * Maximum entries [3] | 2.59 k | ** |
| * Blobs | | |
| * Maximum size [4] | 22.8 MiB | ** |
| | | |
| Biggest checkouts | | |
| * Number of directories [5] | 5.19 k | ** |
| * Maximum path depth [6] | 13 | * |
| * Maximum path length [7] | 134 B | * |
| * Number of files [5] | 80.3 k | * |
| * Total size of files [5] | 1.24 GiB | * |
[1] 91cc53b0c78596a73fa708cceb7313e7168bb146
[2] 2cde51fbd0f310c8a2c5f977e665c0ac3945b46d
[3] d17756098208af5d31186b054f985d9ac19e465e (refs/heads/master:arch/arm/boot/dts)
[4] 0691e328d0f023b16bffee67d7db9771fc7a09c1 (refs/heads/master:drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_2_0_sh_mask.h)
[5] 216667c45120a199c4a2a4c54bc14eab4d8fcf03 (refs/heads/master^{tree})
[6] 78a269635e76ed927e17d7883f2d90313570fdbc (dae09011115133666e47c35673c0564b0a702db7^{tree})
[7] 07db354d8abc4b25fb980f8443848f4cb11dc4c2 (refs/remotes/origin/linux-4.14.y^{tree})
Please give some light, thanks.
Br,
Yingchun