I test in a Jenkins environment two applications, appA and appB: appA needs the resource resourceA, appB needs the resource resourceB. appA and appB can run on same node, they are independent and the required specific resource are independent too.
I have two nodes connected to jenkins: node1 and node2. Each node has resourceA and resourceB, and configured with 1 executor.
Currently my two free-style jobs work fine but the nodes are underemployed regarding available CPU, RAM, network and other resources. And I want to add two other jobs to execute occasionally a test of appA or of appB in this testing environment.
So I am looking for a Jenkins job configuration to define two executors per node and to be able to execute a job for an app on a node where the executor and required resource are available.
I tried to define the node as job parameter (node and label parameter plugin) but this solution is not automatic, on job start it is necessary to specify the node.
I tried the lockable resource plugin but I did not find the way to lock the resource of node1 when the job is started on node1 or the resource of node2 if the job is started on node2
I looked matrix plugin but I think it is not automatic too
Do you know if my idea is feasible? If so, what I need?
Thank you for idea.
Best regards
Related
I am just started learning Jenkins deployment on Google Kubernetes engine. I was able to successfully deploy an application to my GKE instance. However, I couldn't figure out how to manage Nodes and Clouds.
Any tutorial or guidance would be highly appreciated.
Underlying idea behind nodes : Just one node may not be sufficient/effective to run multiple jobs so to distribute the load jobs are transferred to a different node to attain a good performance.
Prerequisites
#1 : A instance (Lets’ say it DEV) which is hosting Jenkins (git, maven, Jenkins)
#2 : A instance (Let’s call it Slave) which will be used to serve as host machine for our new node
In this machine you need to have java installed
A pass wordless connection should be established between two instances.
To achieve it enable password authentication >generate key in main machine i.e., Dev machine and copy this key into Dev machine.
Create a directory “workspace” in this machine (/home/Ubuntu/workspace)
Now Let's get started with Jenkins part -
Go to manage Jenkins> Manage nodes and cloud
By default Jenkins contains only the master node
To create a new node one could use the option “new node” available on the right side of the screen.
Provide a name to new node, mark it as permanent agent
Define remote root directory : It is the directory which is defined by you.
For e.g., a location like
“/home/Ubuntu/workspace “
Provide a label of your choice for e.g., let’s give the label as “Slave_lab”
Label = slave_lab
Now define your Launch method
Let’s select “Launch agent via execution of command on the master”
In the command put command as :
Ssh Ubuntu#private_IP_of_slave java -jar slave.jar
Note : here by #private_IP_of_slave i mean the IP of machine which will be used for our new node
Now we could process to configure jobs to be run on our new node
For that right click on your job > select configure
Under the general tab select the following
"Restrict where this project can be run" and provide the label "slave_lab"
Now when you’ll run the job it will be executed on the slave node not on the master name.
I am having problem with the executor in jenkins.
Can anyone please tell me about executor in jenkins?
Also, explain it's practical implementation.
from : Jenkins User Documentation Home - Glossary
Executor: A slot for execution of work defined by a Pipeline or Project on a Node. A Node may have zero or more Executors configured which corresponds to how many concurrent Projects or Pipelines are able to execute on that Node.
An Executor does "the work" of executing the job steps. In our configuration, we have many nodes, each one corresponding to a VM host / server. We have each node configured with one executor per core. That let's us run one job per core, which is a generally good performance balance. That gives use the ability to run n jobs in parallel on an n-core VM. There are no rules regarding the ratios, depends really on what your jobs do and where the performance issues may be.
Currently, we have two machines. One has Jenkins installed and is hosted as master in Jenkins and another one is Slave. Number of executors for both Nodes are set to 1.
I am not exactly sure how Jenkins work behind the scenes but currently when I triggered 2 build jobs simultaneously, it somehow runs only on slave node (and put another build job in queue), if I disconnect the slave and leave only master, then it would run on master(and put another build job in queue).
How to configure Jenkins so that it leverage all my available nodes (master and slave). In other words, I would like to have all available nodes consumes the queue and not just for one of the Nodes.
As I understand, you need to enable Execute concurrent builds if necessary option in your job configuration and then you will be able to run your job simultaneously on all available nodes.
In addition to the above answer. We can also restrict the job to a particular node on which it should run.
For eg
A setup of 3 servers(2 Linux and one windows )
1 Linux server acts as master
1 Linux server acts as node
1 window server as as node
If we have a job that needs to be run on the windows node you can go to the job configuration and restrict the job to run on that node using the node name or label.
Additionally, the no. of executes define the instances of the slave or master node that can be executed parallelly across different jobs.
For running same job you need to check the enable concurrent build option and assign a label having more than 1 nodes in it
Cheers,
Yash
I use Jmeter to generate a huge load to my web-server. Some slave machines are acted as Jmeter-server, another one - as Jmeter master that coordinates the load and collects statistics from slaves.
Now I'm trying to integrate this system to CI (Jenkins).
That's how I do it now. I have two separate Jenkins jobs: one of them prepares all slaves by running jmeter-server, another one runs Jmeter-master itself. All is fine with 2nd part: I successfully generate traffic and collect statistics. The issue is with 1st job. I have a huge set of slaves that can be rebooted anytime. So, I can't run the job that initiates jmeter-server once and forget about it. I need to run this job every time before Jmeter-master.
But in this case on some machines (that were not rebooted) I have multiple copies of java processes (jmeter-server copies).
So, I'm looking for a mechanism to start jmeter-server on slave nodes in a proper way.
Any ideas appreciated.
Thank you in advance!
Read this:
https://dzone.com/articles/distributed-performance
It combines:
JMeter
Maven Lazery JMeter plugin
Jenkins
All you have to do for jmeter-slaves is to start them from Jenkins using jmeter-server.sh , you might want to tweak port if you have 2 slaves on same host.
Then from controller you will reference those host machines (in this casse default port is used):
remote_hosts=test-server-1.nerdability.com,test-server-2.nerdability.com,test-server-3.nerdability.com
I have several integration tests within my Jenkins jobs. They run on several application servers, and I want to make sure that only one integration test job is run at the same time on one application server.
I would need something like a tag or variable within my jobs which create a group of jobs and then configure the logic that within that group, only one job may run at the same time.
Could I use the Exclusion plugin for that? Does anyone have experience with it?
Use the Throttle Concurrent Builds Plugin. It replaces the Locks and Latches plugin, and provides the capability to restrict the number of jobs running for specific labels.
For example: you create a project category 'Integration Test Server A' and tie jobs to it with a maximum concurrent count of 1, and a second 'Integration Test Server B' label and tie other jobs to it, both categories will only run a single concurrent build (assuming you've set a max job count of 1), and the other jobs in that category will queue until the 'lock' has cleared.
Using this method, you don't have to restrict the number of executors available on any specific Jenkins instance, and can easily add further slaves in the future without having to reconfigure all your jobs.
If I understand you right, you have a pool of application servers and it doesn't matter on what server your tests run. They only need to be the only test on that server.
I haven't seen a plugin that can do that. However, you can get easily around it. You need to configure a slave for each application server. (1 slave = 1 app server) You need to assign the same label to all slaves and every slave can only have one executor. Then you assign the jobs that run the integration tests, to run on that label. Jenkins will assign the jobs then to the next available slave (or node) that has that label.
Bare in mind that you can have more than one slave running on the same piece of hardware and even a master and a slave can coexist on the same server.
Did you check below parameter in the Jenkins -> Manage Jenkins -> Configure system
# of executors
The above parameter helps you restrict the number of jobs to be executed at a time.
A Jenkins executor is one of the basic building blocks which allow a build to run on a node/agent (e.g. build server). Think of an executor as a single “process ID”, or as the basic unit of resource that Jenkins executes on your machine to run a build. Please see Jenkins Terminology for more details regarding executors, nodes/agents, as well as other foundational pieces of Jenkins.
You can find information on how to set the number of Jenkins executors for a given agent on the Remoting Best Practices page, section Number of executors.
Source - https://support.cloudbees.com/hc/en-us/articles/216456477-What-is-a-Jenkins-Executor-and-how-can-I-best-utilize-my-executors