Page MenuHomePhabricator

git review -d always takes 24.5 seconds
Closed, DuplicatePublic

Description

And those 24.5 seconds are enough to cause me to context switch to something else and reduce productivity.

I am very curious why it so consistently takes about 24.5 seconds.

time git review -d 233097 -v
2015-08-22 12:45:56.001840 Running: git config --get gitreview.scheme
2015-08-22 12:45:56.007235 Running: git config --get gitreview.hostname
2015-08-22 12:45:56.010915 Running: git config --get gitreview.port
2015-08-22 12:45:56.014977 Running: git config --get gitreview.project
2015-08-22 12:45:56.018858 Running: git log --color=never --oneline HEAD^1..HEAD
2015-08-22 12:45:56.025864 Running: git remote
2015-08-22 12:45:56.030034 Running: git branch -a --color=never
2015-08-22 12:45:56.040424 Running: git config --get remote.gerrit.pushurl
2015-08-22 12:45:56.045527 Running: git config --get remote.gerrit.url
2015-08-22 12:45:56.050256 Running: git config --list
Found origin Push URL: ssh://nikerabbit@gerrit.wikimedia.org:29418/mediawiki/extensions/Translate.git
Query gerrit ssh://nikerabbit@gerrit.wikimedia.org:29418/mediawiki/extensions/Translate.git --current-patch-set change:233097
2015-08-22 12:45:56.055792 Running: ssh -xp29418 nikerabbit@gerrit.wikimedia.org gerrit query --format=JSON --current-patch-set change:233097
{"project":"mediawiki/extensions/Translate","branch":"master","topic":"selected/languagefilter","id":"I664aad7d8d1fd3f6963debd23f278412798721bd","number":"233097","subject":"Show the selected language at the top left, even though it has no results.","owner":{"name":"Phoenix303","email":"divyalife526@gmail.com","username":"phoenix303"},"url":"https://gerrit.wikimedia.org/r/233097","commitMessage":"Show the selected language at the top left, even though it has no results.\n\nChange-Id: I664aad7d8d1fd3f6963debd23f278412798721bd\n","createdOn":1440233760,"lastUpdated":1440234990,"sortKey":"00374aac00038e89","open":true,"status":"NEW","currentPatchSet":{"number":"2","revision":"8c1157751cd5048eba02d2bcddbb4ed3abdd2e0f","parents":["d30af8384ae3c45e19c2fb30848e00c4a44969b2"],"ref":"refs/changes/97/233097/2","uploader":{"name":"Phoenix303","email":"divyalife526@gmail.com","username":"phoenix303"},"createdOn":1440234913,"author":{"name":"Phoenix303","email":"divyalife526@gmail.com","username":"phoenix303"},"isDraft":false,"approvals":[{"type":"Verified","description":"Verified","value":"1","grantedOn":1440234922,"by":{"name":"jenkins-bot","email":"","username":"jenkins-bot"}}],"sizeInsertions":12,"sizeDeletions":-4}}
{"type":"stats","rowCount":1,"runTimeMilliseconds":33}
Downloading refs/changes/97/233097/2 from gerrit
2015-08-22 12:46:07.362694 Running: git fetch gerrit refs/changes/97/233097/2
2015-08-22 12:46:20.029773 Running: git checkout -b review/phoenix303/selected/languagefilter FETCH_HEAD
Branch review/phoenix303/selected/languagefilter already exists - reusing
2015-08-22 12:46:20.042071 Running: git for-each-ref --format=%(upstream) refs/heads/review/phoenix303/selected/languagefilter
2015-08-22 12:46:20.049446 Running: git checkout review/phoenix303/selected/languagefilter
2015-08-22 12:46:20.077709 Running: git reset --hard FETCH_HEAD
Switched to branch "review/phoenix303/selected/languagefilter"

real    0m24.273s
user    0m0.224s
sys     0m0.217s

Event Timeline

Nikerabbit raised the priority of this task from to Needs Triage.
Nikerabbit updated the task description. (Show Details)
Nikerabbit added a project: Gerrit.
Nikerabbit added a subscriber: Nikerabbit.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 22 2015, 10:48 AM
Nemo_bis added a subscriber: Nemo_bis.EditedAug 22 2015, 10:51 AM

Hm, 4-6 s here. Can it depend on the kind of ssh key you're using?

$ time git review -d 233097 -v
2015-08-22 12:49:22.850722 Running: git log --color=never --oneline HEAD^1..HEAD
2015-08-22 12:49:22.862409 Running: git remote
2015-08-22 12:49:22.870914 Running: git branch -a --color=never
2015-08-22 12:49:22.893165 Running: git remote show -n gerrit
Found origin Push URL: ssh://nemobis@gerrit.wikimedia.org:29418/mediawiki/extensions/Translate.git
2015-08-22 12:49:22.913268 Running: ssh -x -p 29418 nemobis@gerrit.wikimedia.org gerrit query --format=JSON --current-patch-set change:233097
Downloading refs/changes/97/233097/2 from gerrit
2015-08-22 12:49:24.486606 Running: git fetch gerrit refs/changes/97/233097/2
2015-08-22 12:49:29.141344 Running: git checkout -b review/phoenix303/selected/languagefilter FETCH_HEAD
Switched to branch "review/phoenix303/selected/languagefilter"

real    0m6.704s
user    0m0.699s
sys     0m0.596s
$ git review --version
git-review version 1.23

I noticed if I disable ControlMaster it is somewhat faster. The time it takes is approximately 2 × ControlPersist, possibly also five seconds for ConnectTimeout but more likely it is just the actual processing time.

The problem is that Gerrit upload-pack sends all references (e.g. refs/changes/*) as can be shown by setting the env variable GIT_TRACE_PACKET=1.

So that is a duplicate of T103990: Gerrit upload-pack send ALL references causing massive network I/O on common operations.

The problem is that Gerrit upload-pack sends all references (e.g. refs/changes/*) as can be shown by setting the env variable GIT_TRACE_PACKET=1.

Yes, however that doesn't explain the numbers. (Especially as Nikerabbit's connection is faster than mine.)