Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Jenkins Masters using a Shared Slave pool

I am trying to scale Jenkins for a large organization. Is there a way to have multiple Jenkins masters share a slave pool? For example, if I had 200 Jenkins Masters and I want them to share the same set of 50 Linux slaves.

That is, assuming each slave only has 1 executor, if Master A submits a job to the slave pool and it is running on Slave 1, if Master B submits a job to the slave pool, it would try to run on one of the other free slaves, since Slave 1 is already occupied.

I know multiple masters could share a single slave if I configured the slave to have a new workspace and executor for each master. However, I want to be able to set the slave up once, instead of having a slave.jar running on the slave for each master.

Cloudbees Op Center appears to provide this functionality, but looking for a way to do this with the Open Source version. If not, how difficult do you think it would be to extend Jenkins to have this functionality? I have Java development experience and have done a little work with Jenkins plugin development.

Thanks,

like image 313
mpstack Avatar asked Jul 06 '14 19:07

mpstack


People also ask

Can Jenkins have multiple masters?

One Big Jenkins master vs Multiple Jenkins masters Your resource utilization will be higher with One Big Master, as you can use the same set of slaves to serve a large projects and even out their spiky load. With multiple masters, each Jenkins needs to have a reasonable number of slaves.

Can Jenkins master and slave in the same machine?

This cannot be done by a single Jenkins server. It is recommended not to run different jobs in the same system that required a different environment. In such scenarios where we need a different machine with a different environment that takes the specific job from the master to build.

How many ways we can connect slaves in Jenkins?

There are two ways of authentication for setting up the Linux Jenkins slave agents. Using ssh keys.

What is master slave architecture what is the use of master slave in Jenkins?

Jenkins Master and Slave ArchitectureThe Jenkins master acts to schedule the jobs, assign slaves, and send builds to slaves to execute the jobs. It will also monitor the slave state (offline or online) and get back the build result responses from slaves and the display build results on the console output.


2 Answers

As you've noted it's not hard to share slaves between masters, just setup multiple workspaces and each master will install it's own slave jar. The trick is to share resources properly.

One such resource manager is Apache Mesos. A Jenkins Mesos plugin exists enabling the creation of slaves on a managed cluster.

This approach is very new and Ebay have blogged on how they've evolved their Jenkins setup to use Mesos:

  • Ebay CI solutin part 1
  • Ebay CI solution part 2

Hope this helps.

like image 109
Mark O'Connor Avatar answered Oct 24 '22 11:10

Mark O'Connor


There is a Gearman Plugin developed by Open Stack to handle sharing slaves by multiple masters.

like image 41
chrish Avatar answered Oct 24 '22 10:10

chrish