devhub-tud / devhub

DevHub is a software system designed to give students a simple practical introduction into modern software development.
15 stars 8 forks source link

Slow Gitolite-Admin push (JGit) performance #160

Open jwgmeligmeyling opened 9 years ago

jwgmeligmeyling commented 9 years ago
jwgmeligmeyling commented 9 years ago

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 commented 9 years ago

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 ?

michaeldejong commented 9 years ago

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"
jwgmeligmeyling commented 9 years ago

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

michaeldejong commented 9 years ago

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