Gerrit HW requirements suggestions?

3,325 views
Skip to first unread message

Vitali Lovich

unread,
Aug 10, 2010, 9:41:31 PM8/10/10
to repo-d...@googlegroups.com
Hi,

I was wondering if anyone had any rough ideas for gerrit HW requirements.  The usage model I'm looking at is ~500 active users that do just git clone/pull a few times a day each & ~100-200 active users that regularly push, merge, etc.  A handful of repositories the size of the linux kernel or bigger (in size & history length) & maybe 30 or so much smaller projects.

Presumably the requirements for mysql/postgres are lower than H2?

Thanks,
Vitali

Shawn Pearce

unread,
Aug 10, 2010, 9:56:39 PM8/10/10
to Vitali Lovich, repo-d...@googlegroups.com

Not necessarily. The metadata database is very small. For example,
even after a year and a half of operation, one of my databases is only
24 MiB when backed up. Its not very big. I wouldn't be surprised if
the opposite were true, that H2 uses less resources because the
database shares the same memory footprint as the Gerrit server, while
MySQL/PostgreSQL need their own memory for their server processes and
data caches. But H2 is harder to manage, because you cannot access
the database while the Gerrit server is running... except through `ssh
... gerrit gsql`.

Memory is everything to Gerrit, because it can't really use the kernel
buffer cache to access Git pack files because the Java mmap
implementation is cr*p. So a nice fat 8 GiB JVM heap is probably what
you'll need, which means somewhere over 9 GiB of physical memory in
the server. You want to configure the core.packedGit variables in
gerrit.config to actually use all of that memory, so that frequently
accessed repositories are in memory and not on disk. One of my bigger
servers has 16 GiB of physical memory, and I allocate an 8 GiB heap to
Gerrit.

Maybe a quad core server is fine, maybe more. A clone (almost) takes
up 1 core per concurrent clone request, for nearly the duration of the
clone. We have to perform not only Git data computation but also the
SSH encryption for the client, and that stuff takes CPU. If the
clients are on local LAN connections, the network is probably faster
than the server CPUs are.

I can say one of my servers is a tiny VPS with 256 MiB RAM / <1 CPU
and it serves a small team (~12 developers) doing periodic work just
fine. And another is 16 GiB RAM / 4 CPUs and serves closer to your
figures... but sometimes during high clone periods users have to wait.
Telling a user to get coffee while his clone is chugging along has
thus far been cheaper than buying up a ton of CPUs and having them lay
around idle most of the day.

Ping Yin

unread,
Aug 10, 2010, 10:59:12 PM8/10/10
to Shawn Pearce, Vitali Lovich, repo-d...@googlegroups.com
On Wed, Aug 11, 2010 at 9:56 AM, Shawn Pearce <s...@google.com> wrote:
> On Tue, Aug 10, 2010 at 18:41, Vitali Lovich <vlo...@gmail.com> wrote:
>
> So a nice fat 8 GiB JVM heap is probably what
> you'll need, which means somewhere over 9 GiB of physical memory in
> the server.  You want to configure the core.packedGit variables in
> gerrit.config to actually use all of that memory, so that frequently
> accessed repositories are in memory and not on disk.  One of my bigger
> servers has 16 GiB of physical memory, and I allocate an 8 GiB heap to
> Gerrit.
>

What is the default jvm heap size? How do i configure a different size? Thanks.

Shawn Pearce

unread,
Aug 11, 2010, 1:13:36 PM8/11/10
to Ping Yin, Vitali Lovich, repo-d...@googlegroups.com
On Tue, Aug 10, 2010 at 19:59, Ping Yin <pkuf...@gmail.com> wrote:
> On Wed, Aug 11, 2010 at 9:56 AM, Shawn Pearce <s...@google.com> wrote:
>> On Tue, Aug 10, 2010 at 18:41, Vitali Lovich <vlo...@gmail.com> wrote:
>>
>> So a nice fat 8 GiB JVM heap is probably what
>> you'll need,
>
> What is the default jvm heap size? How do i configure a different size? Thanks.

Default heap size is system dependent. Modern Java 1.6 releases from
Sun (err, Oracle) use some sort of rule like 1/8 of physical memory if
there are more than 2 CPUs in the system.

If you are starting Gerrit with its own gerrit.sh script you can
control the heap size by setting the container.heapLimit [1] variable
to a value, e.g.

[container]
heapLimit = 8g

[1] http://gerrit.googlecode.com/svn/documentation/2.1.4/config-gerrit.html#container

Nicholas Mucci

unread,
Aug 11, 2010, 4:09:24 PM8/11/10
to Repo and Gerrit Discussion
I'll share with you my Gerrit server configuration:

CPU: 8x Xeon 2.53GHz
RAM: 16GB
FS that Gerrit and repositories live on: 120GB (40GB in use)
JVM: 6GB max heap, 128 max permgen space (currently 3914MB cms gen in
use, 32MB permgen space in use)
OS: Ubuntu 8.04.3 (64-bit)
Java: 1.6.0_12-b04
Gerrit: 2.1.2.3
DB: PostgreSQL 8.3.7

There are ~400 users performing repo syncs, uploads, and code reviews
and ~625 projects on this instance of Gerrit. Typically there aren't
any performance issues. Sometimes I will see high CPU load, where 6
or 7 CPUs are churning on something, but rarely is the load noticeable
in the UI.

-Nick

Ping Yin

unread,
Aug 11, 2010, 10:38:37 PM8/11/10
to Shawn Pearce, Vitali Lovich, repo-d...@googlegroups.com
On Thu, Aug 12, 2010 at 1:13 AM, Shawn Pearce <s...@google.com> wrote:

> If you are starting Gerrit with its own gerrit.sh script you can
> control the heap size by setting the container.heapLimit [1] variable
> to a value, e.g.
>
>  [container]
>    heapLimit = 8g
>
> [1] http://gerrit.googlecode.com/svn/documentation/2.1.4/config-gerrit.html#container
>

That's what i need, thanks.

Jay Soffian

unread,
Aug 13, 2010, 12:44:41 PM8/13/10
to Ping Yin, Shawn Pearce, Vitali Lovich, repo-d...@googlegroups.com

I have this at the top of my config:


# N.B. Tuned per per
http://groups.google.com/group/repo-discuss/msg/269024c966e05d6a
# as follows:
# git config --file gerrit.config container.heapLimit 8g
# git config --file gerrit.config sshd.threads 24
# git config --file gerrit.config sshd.batchThreads 2
# git config --file gerrit.config core.packedGitOpenFiles 4096
# git config --file gerrit.config core.packedGitLimit 2g
# git config --file gerrit.config core.packedGitWindowSize 16k
# git config --file gerrit.config database.poolMaxIdle 16
# git config --file gerrit.config database.poolLimit 64

j.

Ping Yin

unread,
Aug 13, 2010, 11:20:17 PM8/13/10
to Jay Soffian, Shawn Pearce, Vitali Lovich, repo-d...@googlegroups.com
> I have this at the top of my config:
>
>
> # N.B. Tuned per per
> http://groups.google.com/group/repo-discuss/msg/269024c966e05d6a
> # as follows:
> #   git config --file gerrit.config container.heapLimit 8g
> #   git config --file gerrit.config sshd.threads 24
> #   git config --file gerrit.config sshd.batchThreads 2
> #   git config --file gerrit.config core.packedGitOpenFiles 4096
> #   git config --file gerrit.config core.packedGitLimit 2g
> #   git config --file gerrit.config core.packedGitWindowSize 16k
> #   git config --file gerrit.config database.poolMaxIdle 16
> #   git config --file gerrit.config database.poolLimit 64
>

Wow, very useful. Thanks.

Reply all
Reply to author
Forward
0 new messages