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.
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
> 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.
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.
Wow, very useful. Thanks.