0

I have 10 build agents configured in two servers under one agent pool. Whenever the first four agents are used, the build requested is in the queue on the first four agents, but there are another six agents which are available and the builds are not queued to those agents.

It's been almost six months and agent 10 has not even once handled a build. Other agents from 5 to 10 are hardly used. Why is there this phenomenon? How can we handle this by using all the agents fairly?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
samdinesh
  • 147
  • 1
  • 3
  • 9

2 Answers2

0

TFS will auto select the available build agent in the pool when running the build. It's more like a conditional random choice. It's not able to prioritize the build agent for now. There has also been a related uservoice as below:

TFS 2015 build vNext agent prioritization

As a workaround you could specify a build agent in vNext build.

You can add a User Capability to that specific build agent. Then in the build definition you just need put in that capability as a demand (General tab).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • I have multiple teams working on so the agents cannot be tied up to any particular build. Yes this workaround might help – samdinesh Jul 31 '17 at 13:01
0

It seems like the builds are queued on the 'oldest' agents first. So if agent 10 is the last agent you created, it will only be used if the first 9 are in use, assuming they all have the same capabilities.

It does not appear to be a random selection of agents, but based on the order of creation of agents. Ironically that means that if you add a new powerful build server, those agents will be at the bottom of the queue.

The user voice suggestion in PatrickLu-MSFT's answer is to allow the agent to be prioritized.

The workaround at this moment seems to be to remove all (or some) agents and re-create them in the order you want them to be used. Which still means the last agent will be used less, but at least you can influence the distribution of the agents a bit.

We are running into this issue as well. We have six build servers with three agents each and builds are not distributed fairly. I also do not want to assign an agent per definition, but I guess we are going to have to puzzle with it.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nico
  • 627
  • 7
  • 23