27
votes

I want to set up a Jenkins Master that will let slaves do all the the builds.

  • The master is just a traffic cop, getting SVN hook triggers and kicking off slave builds.
  • There will be about 10 Java Maven build jobs in this setup.
  • I wish to run the Jenkins master on a hosted server that has limited resources (RAM).
  • I will run the slaves on some nicely loaded machines on my own network.

So my question is how little RAM could I get away with allocating to the Master Jenkins instance? 256M? 384M? 512M? Other?

I cannot seem to find this specific info in the Jenkins docs.

5
Appreciate the input! Just to clarify... Master is separate hardware from Slaves. No Builds on the Master. All Builds are on Slaves (where I have ample RAM, DISK and CPU). I will be trying this with the 512M JVM for the Master and let you know how it goes.William Parkinson

5 Answers

21
votes

A coworker asked me the same question and my first answer was that 1-2 GB should be enough. Later I discovered this entry from the Jenkins documentation:

Have a beefy machine for Jenkins master & do not run slaves on the master machine. Every slave has certain memory allocated in the master JVM, so the bigger the RAM for the master, the better it is. We typically hear customers allocate 16G or so.

Source: https://docs.cloudbees.com/docs/cloudbees-core/latest/traditional-install-guide/system-requirements

9
votes

I don't think there is a rule of thumb for this. Our master uses 2G and we have 6 slaves. We have close to 60 jobs - most of them maven. We have never had memory issues in the past. And our slaves are always busy (I always see some job or the other being kicked off).

You could start with 512M and see how it works. If you see memory issues increase the memory. That is the only way I can think of. But to monitor the memory of your master use the Jenkins Monitoring Plugin. This plugin integrates JavaMelody and lets you monitor the JVM of your master and even slaves. Good luck!

8
votes

As of mid-2016, the official documentation says

Memory Requirements for the Master

The amount of memory Jenkins needs is largely dependent on many factors, which is why the RAM allotted for it can range from 200 MB for a small installation to 70+ GB for a single and massive Jenkins master. However, you should be able to estimate the RAM required based on your project build needs.

Each build node connection will take 2-3 threads, which equals about 2 MB or more of memory. You will also need to factor in CPU overhead for Jenkins if there are a lot of users who will be accessing the Jenkins user interface.

It is generally a bad practice to allocate executors on a master, as builds can quickly overload a master’s CPU/memory/etc and crash the instance, causing unnecessary downtime. Instead, it is advisable to set up slaves that the Jenkins master can delegate build jobs to, keeping the bulk of the work off of the master itself.

2
votes

I have a Jenkins master with a few dozens of jobs and slaves. But I don't run builds or tests on Master. Based on my observation the memory consuption is not that big. It rarely went more than 2 or 3 GB. Also I believe it depends on the memory size option you specifiy to the java process of Jenkins. I would recommend at least 2GB RAM in your case. You could always load balance the builds to slaves if you need.

0
votes

It depends on what you are building, how often you are running builds, and how fast you need them to build. From my experience you need 1 GB per concurrent build, but this can vary depending on how resource intensive your build is. Monitor your memory usage under it's heaviest load and if the memory usage gets between 70-80% or more add more memory, it's around 30-40% or less allocate less.

Also keep an eye on disk usage, about 4 years ago had a TeamCity build server that kept falling to it's knees, that problem turned out to be the master and the salves where all virtual servers sharing the same attached storage and the disks couldn't keep up. More of a problem with the VM environment but still something to keep in mind.