Ashwanth: looking at `iostat -k 2` I don't see any particularly high volume of disk io. The disk is 99% idle. The disk is an SSD, and it's the same kind that was used on our old GoCD server. The disk is an AWS EBS io2 volume to be specific, and so I've used the AWS metrics to check for any signs of disk latency and the disk seems to be performing smoothly.
Chad: That's correct, we don't run agents on the GoCD server. For extra info about the rebuild methodology, we used the GoCD backup instructions as you linked to backup the old server, then restored from that backup on a new machine. Config files such as wrapper-properties.conf were restored, but it's theoretically possible that there were edits made in a way that wouldn't be captured in this backup/restore (e.g. a global git config file). Thanks for the extra clues about git material polling - I'll look into what config options are available.
A bit more debugging:
I would have to guess this git command is cpu-bound. Using `lsof -u go | grep git` to figure out what git is doing, it looks like the git commands are busy reading files like these:
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/objects/pack/pack-47a1b4f9c1abd793f7783d61b3719520e8ee174e.pack
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/objects/pack/pack-caef4ebaebbc1fccca5a2d637996f72dce2babb4.pack
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/objects/pack/pack-bf49db07ef11d2f696b8b933b3443c7f185fadd4.pack
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/objects/pack/pack-7755613d3efe8fdfcd63bfc16a62a8194b508c74.idx
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/objects/pack/pack-3fcca0d6c0dd729a6a650b87583ec5424ec7c103.idx
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/objects/pack/pack-0c24d29c94e20367351971b219ded2455aa496d3.idx
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/objects/pack/pack-bf49db07ef11d2f696b8b933b3443c7f185fadd4.idx
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/objects/pack/pack-caef4ebaebbc1fccca5a2d637996f72dce2babb4.idx
/var/lib/go-server/pipelines/flyweight/97f4c8ef-1be5-49b6-a47d-05d8db2935b3/.git/packed-refs
These look like git repos under /var/lib/go-server/pipelines/flyweight/ where GoCD is running these `git branch -r --contains <commit>` commands. I was able to copy one of these git repos and inspect it. Its size is 333M on disk, and has about 130000 commits. I confirmed that running `git branch -r --contains <commit>` with a recent commit id took about 30 seconds. Then I tried `git gc`. After that completed, the same `git branch -r --contains <commit>` took less than 1 second.