Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: two slaves vs. one slave two executors

Is there any difference between I create two slaves, or one slave with two executors on the same Windows server?

like image 519
Jirong Hu Avatar asked May 20 '16 20:05

Jirong Hu


2 Answers

A slave is a "machine". An executor is an "OS Process" in the slave.

So ideally we always add executors - they do the work and can run in parallel, and the simple theoretic answer to your question is "2 executors on one slave"

In practice we need to add slaves in several use cases:

  1. We need more resources (more cpu, more memory, more "machines")
  2. We need a different setting (Different OSes, Different hardware)
  3. We have global resources that would create a conflict for executors on same machine (shared browser for a UI testing process)

Make the decision based on your use case.

like image 99
Omri Spector Avatar answered Sep 23 '22 03:09

Omri Spector


Yes, there is a difference: It's about memory consumption and effort of maintenance/administration.

  • Starting a slave on a system starts a (main) process. This process costs (private) main memory to run and connects to the master.
  • Each executor is a sub-process of the main process.

It is therefore apparent that running two executors on one slave costs less memory in total compared to running two slaves (with one executor each), as there would be the memory consumption of the main process twice:

2 * Main Processes + 2 * Executors > 1 * Main Process + 2 * Executors

Moreover, administrating a slave is some more effort than just an executor: Whilst an executor has virtually nothing to worry, there are numerous things to configure for a slave. Additionally, the capabilities of the two slaves are anyhow the same (they are running on the same OS as you said), so there is little value-add to also assign it different labels.

In short, if there are no other boundary conditions, which make me do it differently, I always would prefer running two executors on one slave, as this is easier to administrate and some memory is saved.

like image 23
EagleRainbow Avatar answered Sep 22 '22 03:09

EagleRainbow