Reduce Server Load

You are viewing an old version (v. 2) of this page.
The latest version is v. 11, last edited on Aug 06, 2009 (view differences | )
<< View previous version | view page history | view next version >>

Scenario

In a continuous integration environment, it is important that builds being run as frequent as possible. A server could be configured with dozens of projects, with each project having several branches, with each branch having dozens of devlopers commiting their code and request verification builds. This could impose a heavy load on the build server if all builds are running on that single machine.

Solution

You can shift build jobs from server to agents by running steps only on agent nodes. Let's take a typical build process for example, it has three steps, checkout, build, and publish. By default, all three steps have property node match condition being set to below value:

parent==null?node.isServer():(node==parent.node)

This means that if the step does not have parent (in case of the master step), it should be run on the server node; otherwise, it should be running in the same node as its parent node. The effect is that all steps are by default running on the server node. To make all steps running on agent nodes, just set the node match condition of the master step to be:

node.isAgent()

Other steps remains unchanged. When build starts, the master step will try to look for a compatible node for executing. In this case, all agents are compatible, and one of the agent will be selected based on load balancing algorithm. All other steps will use the same agent as the node match condition tells them to use the same node as their parent step.
In a real environment, it is possible that not all agent nodes are compatible with the build, and you can adjust the node match condition of the master step to filter off uncompatible nodes, for example, the expression node.isAgent() && node.getAttribute("os.name").startsWith("Linux") only accepts linux agents.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.