git clone, push, pull is very slow in Huge repository

7,085 views
Skip to first unread message

hs20...@gmail.com

unread,
May 23, 2012, 12:55:01 AM5/23/12
to Repo and Gerrit Discussion

Hi all.

When cloning a repository, it takes about 18minutes.
push takes 10 minutes, pull takes 18minutes.

The repository's size was 8G. Now it's under 1G after git gc and
prune.
But the time required has been implemented a little bit.
The time for cloning is 10 minutes. (push : 4minutes, )

I think that's already a big problem.

The gerrit version is 2.1.7
The git repository has 45 branches and many groups for managing
permissions.

THE IMPORTANT THING :
The only users that get the permission to each branch are experiencing
the problem.
ex) the user(having speed problem) : Read Access : refs/heads/gb-dev-
branch
ex) the user(no problem) : Read Access : refs/*
Those have read permissions to all branches are good to work.

Has anybody experienced the same problem ?
Thank you in advance.

Magnus Bäck

unread,
May 23, 2012, 9:00:52 AM5/23/12
to Repo and Gerrit Discussion
On Wednesday, May 23, 2012 at 00:55 EDT,
"hs20...@gmail.com" <hs20...@gmail.com> wrote:

> When cloning a repository, it takes about 18minutes.
> push takes 10 minutes, pull takes 18minutes.
>
> The repository's size was 8G. Now it's under 1G after git gc and
> prune.
> But the time required has been implemented a little bit.
> The time for cloning is 10 minutes. (push : 4minutes, )

The long fetch time isn't surprising, but I don't understand the
excessive push time.

> I think that's already a big problem.
>
> The gerrit version is 2.1.7
> The git repository has 45 branches and many groups for managing
> permissions.
>
> THE IMPORTANT THING :
> The only users that get the permission to each branch are experiencing
> the problem.
> ex) the user(having speed problem) : Read Access : refs/heads/gb-dev-
> branch
> ex) the user(no problem) : Read Access : refs/*
> Those have read permissions to all branches are good to work.

For users having access to all refs, Gerrit can just serve the git
as-is. When a user doesn't have read access to all refs, Gerrit must
repack the git on the fly for each request. For a 1 GB git I'm not
surprised this takes a few minutes.

I assume you have ample RAM and CPU and that the git is stored on a
local drive rather than accessed via NFS or something equally slow.

To get around this type of problem one can set up replication slaves to
which only a subset of the refs are replicated. That way Gerrit won't
have to repack the gits when a client connects. Of course, this means
that users have to choose which server to connect to and it doesn't
scale if the number of read access combinations is too big.

--
Magnus Bäck
ba...@google.com

Eric Anderson

unread,
May 23, 2012, 10:48:31 AM5/23/12
to Magnus Bäck, Repo and Gerrit Discussion
Yeah. We just hit this. We had read on refs/heads/* instead of refs/*

I suggest you make a different repo for those branches that are special and keep them in sync some how

--Eric Anderson

Sent from a mobile device
> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en

Shawn Pearce

unread,
May 23, 2012, 12:17:12 PM5/23/12
to hs20...@gmail.com, Repo and Gerrit Discussion
On Tue, May 22, 2012 at 9:55 PM, hs20...@gmail.com
<hs20...@gmail.com> wrote:
>
> When cloning a repository, it takes about 18minutes.
> push takes 10 minutes, pull takes 18minutes.
>
> The repository's size was 8G. Now it's under 1G after git gc and
> prune.
> But the time required has been implemented a little bit.
> The time for cloning is 10 minutes. (push : 4minutes, )
>
> I think that's already a big problem.
>
> The gerrit version is 2.1.7
> The git repository has 45 branches and many groups for managing
> permissions.
>
> THE IMPORTANT THING :
> The only users that get the permission to each branch are experiencing
> the problem.
> ex) the user(having speed problem) : Read Access : refs/heads/gb-dev-
> branch

Try upgrading Gerrit to the latest release. We have had a lot of
performance improvements for per-branch permissions in the 2.2 series
that is not in the 2.1.7 release.

Shawn Pearce

unread,
May 23, 2012, 12:19:01 PM5/23/12
to Repo and Gerrit Discussion
On Wed, May 23, 2012 at 6:00 AM, Magnus Bäck <ba...@google.com> wrote:
> On Wednesday, May 23, 2012 at 00:55 EDT,
>     "hs20...@gmail.com" <hs20...@gmail.com> wrote:
>
>> When cloning a repository, it takes about 18minutes.
>> push takes 10 minutes, pull takes 18minutes.
>>
>> The repository's size was 8G. Now it's under 1G after git gc and
>> prune.
>> But the time required has been implemented a little bit.
>> The time for cloning is 10 minutes. (push : 4minutes, )
>
> The long fetch time isn't surprising, but I don't understand the
> excessive push time.

Its actually the same problem, Gerrit is trying to figure out what
refs are available for the user, and trying to confirm the user hasn't
done something evil during the push by trying to get access to an
object they aren't supposed to have access to. This extra security
checking takes more time.

> For users having access to all refs, Gerrit can just serve the git
> as-is. When a user doesn't have read access to all refs, Gerrit must
> repack the git on the fly for each request. For a 1 GB git I'm not
> surprised this takes a few minutes.

This isn't true. Gerrit always repacks a repo to serve a client. What
is expensive is filtering the set of branches the user can see, to
make sure they are only shown branches they have read access for.

Magnus Bäck

unread,
May 24, 2012, 9:58:04 AM5/24/12
to Repo and Gerrit Discussion
On Wednesday, May 23, 2012 at 12:19 EDT,
Shawn Pearce <s...@google.com> wrote:

> On Wed, May 23, 2012 at 6:00 AM, Magnus Bäck <ba...@google.com> wrote:

[...]

> > For users having access to all refs, Gerrit can just serve the git
> > as-is. When a user doesn't have read access to all refs, Gerrit must
> > repack the git on the fly for each request. For a 1 GB git I'm not
> > surprised this takes a few minutes.
>
> This isn't true. Gerrit always repacks a repo to serve a client. What
> is expensive is filtering the set of branches the user can see, to
> make sure they are only shown branches they have read access for.

Oh, so a repack always takes place but for a recently repacked git the
operation is fairly quick (but non-zero) since not that much needs to be
expunged and not many deltas need to be recalculated?

--
Magnus Bäck
ba...@google.com

Shawn Pearce

unread,
May 24, 2012, 9:59:52 AM5/24/12
to Repo and Gerrit Discussion
Yes.

hschoi

unread,
May 24, 2012, 11:01:39 PM5/24/12
to repo-d...@googlegroups.com
Thanks a lot.
I'll make another repository to split a branch.

And then I have a plan to upgrade gerrit to 2.3 series next month. 

I'm looking forward to be implemented.


2012년 5월 24일 목요일 오후 10시 59분 52초 UTC+9, Shawn Pearce 님의 말:
Reply all
Reply to author
Forward
0 new messages