devhub icon indicating copy to clipboard operation
devhub copied to clipboard

Slow Gitolite-Admin push (JGit) performance

Open jwgmeligmeyling opened this issue 10 years ago • 5 comments

  • [ ] The push hook is unused so we can remove it
  • [ ] We do not use Gitolite site, so we can disable it

jwgmeligmeyling avatar May 07 '15 22:05 jwgmeligmeyling

It seems that pushing to the gitolite config repository takes the most time for the request. Because we wait for the push to complete, the user has to wait for the push before the page loads. We can work around this by not waiting for the push to end and just note that processing the key might take a while. Question is, can we improve git push speed by cleaning up the git repo or specifying some additional parameters to the clone and push commands?

jwgmeligmeyling avatar May 13 '15 12:05 jwgmeligmeyling

Using the following bash script, a lot commits with keys and repositories can be created for a bare gitolite server. After running this script, pushing to the gitolite-admin repository performs really slow.

#!/bin/bash

for i in `seq 1 1000`;
do
        ssh-keygen -q -t rsa -f keydir/$i -N ""
        echo -e "repo repo-$i\n\tRW+\t\t=git\n" >> conf/gitolite.conf
        git add keydir/$i.pub
        git add conf/gitolite.conf
        git commit -m "Inserting from bash $i"
done

git push

After squashing the thousand commits together the performance didn't restore. I used the following to squash:

cd ~/git/gitolite-admin
rm -rf .git/
git init && git remote add origin ssh://git@localhost:2222/gitolite-admin
git commit -am "Initial commit"
git push -f
cd ~/git/git-server
vagrant ssh
sudo -i -u git
cd repositories/gitolite-admin
git gc --aggressive

Any idea @michaeldejong ?

jwgmeligmeyling avatar May 13 '15 13:05 jwgmeligmeyling

I don't think that squashes the commits.

As far as I know there's no rebase command which squashes all commits into one (perhaps it could be done with JGit). What you could do is do a soft git reset.

git reset --soft HEAD~1000 && git commit -m "Squashed last 1000 commits"

michaeldejong avatar May 13 '15 14:05 michaeldejong

Hmm. But do you have any idea why pushing takes so long after these commits? You're only pushing the difference / last commit right?

jwgmeligmeyling avatar May 13 '15 14:05 jwgmeligmeyling

Not sure. Probably a gitolite internal issue. See also: http://gitolite.com/gitolite/g2/bc.html

michaeldejong avatar May 13 '15 14:05 michaeldejong