Project

General

Profile

Repository tab slow on every change (git)?

Added by Adam Sjøgren over 14 years ago

Hi.

I have just installed the Redmine package from Debian unstable (0.9.0~svn2902-1), and am playing around with connecting it to a git-repository (~20000 commits, bare disk-size: ~62MB.)

The first time I go to the Repository tab, it takes some time while Redmine gets data from git and stores it in the database (I am using PostgreSQL 8.3.) That makes a lot of sense - I can see, using "ps aux", that the git command that Redmine runs is:

git --git-dir [repo-path] log --find-copies-harder --raw --date=iso --pretty=fuller --all

This command alone takes around 12 minutes to run (and then there is some processing and inserting into the database.)

What has me puzzled is this: If I make a new commit and fetch it into the bare repo that I have configured Redmine to use, and I then go to the Repository tab, it seems that Redmine doesn't just ask for the commits since the last time it updated the database, but it runs the exact same git command shown above again.

I would have expected something like "git log --since [top hash from db]", or similar, taking much less time?

Have I missed to configure something - I may very well have as I am new to Redmine, or is this the way it is supposed to work?

Best regards & thanks,
Adam


Replies (4)

RE: Repository tab slow on every change (git)? - Added by Adam Sjøgren over 14 years ago

I just noticed that this command, i.e. removing the '--raw' option:

git --git-dir [repo-path] log --find-copies-harder --date=iso --pretty=fuller --all

finishes in 0.3 second.

With --raw it takes 12 minutes(!)

RE: Repository tab slow on every change (git)? - Added by Adam Sjøgren over 14 years ago

I guess a solution could be to change app/models/repository/git.rb fetch_changesets¹ to use 'git log' without --raw to find the total list of changesets, and then call 'git log --raw' only on the new ones, which should save a lot of time, given the above observations.

Does that make sense?

Best regards,
Adam

¹ http://www.redmine.org/projects/redmine/repository/entry/trunk/app/models/repository/git.rb#L40

RE: Repository tab slow on every change (git)? - Added by Adam Sjøgren over 14 years ago

The --find-copies-harder seems to be causing the performance problem:

--find-copies-harder
For performance reasons, by default, -C option finds copies only if
the original file of the copy was modified in the same changeset.
This flag makes the command inspect unmodified files as candidates
for the source of copy. This is a very expensive operation for
large projects, so use it with caution. Giving more than one -C
option has the same effect.
- git-log(1)

The attached patch removes the --find-copies-harder switch; I'm not sure if it has any ill effects, if so, perhaps the scheme sketched above could help?

RE: Repository tab slow on every change (git)? - Added by Eric Davis over 14 years ago

Could you file an issue for this? Adam Soltys did the recent git work so he might have some insight into which options Redmine is using and why.

Eric Davis

    (1-4/4)