Build priorities mechanism

Hi,

We are using TeamCity 6.5.5 (very recent, 2 days ago we were on 6.5.4) and we have recently started using the build priority mechanism.

It seemed to work at first, but lately I've found that things with the highest priority possible go the the bottom of the queue.  While looking at the documentation, I found this: (my bolding)

This setting is taken into account only when a build is added to the queue. The builds with higher priority will have more chances to appear at the top of the queue; however, you shouldn't worry that the build with lower priority won't ever run. If a build spent long enough in the queue, it won't be outrun even by builds with higher priority.


This could explain why a high priority build still get at the bottom of the queue.

Could you elaborate as to how this work (how long is "long enough" before the priorities get bypassed?), and possibly circumvented?  I would really like my higher priority configurations to run before the others, no matter how long they have been stucked in the queue.

Thanks.
7 comments
Comment actions Permalink

Hello,

you are right, priorities in the queue are not static. We recalculate builds priorities every time build is added in the queue. We use following formula:

buildPriority = timeSpentInTheQueue / estimatedBuildDuration + k * buildConfigurationPriority

So when build waits in the queue for amount of time equals to estimated build duration, its priority increased by one.

At the moment this is not possible to made all low-priority configurations wait for a no matter what long time, since their priorities grows over time. One thing you can do is to increase coefficient k by changing internal property teamcity.buildqueue.priorityWeight (its default value is 1.0). With higher value of k buildPriority depends more on initial build configuration priority and depends less on time spent in the queue.

0
Comment actions Permalink

Thanks for the precision.

How do I modify this teamcity.buildqueue.priorityWeight priority?

0
Comment actions Permalink

You can set it in the <TeamCity Data Directory>/config/internal.properties file. Put something like this there:

teamcity.buildqueue.priorityWeight = 100.0

You can find more information on TeamCity parameters here http://confluence.jetbrains.net/display/TCD65/Configuring+TeamCity+Server+Startup+Properties#ConfiguringTeamCityServerStartupProperties-internal.properties .

0
Comment actions Permalink

The page https://confluence.jetbrains.com/display/TW/Build+Queue+Priorities appears to be more recent than this thread, but both are rather old.  Is the information on that page still accurate for TeamCity 8.x.x?

In our situation, there are some low priority build configurations which have very short build durations, but long times spent in queue.  This means that with time, build queue priorities have less and less impact on queue ordering.

Assuming the page mentioned above is still accurate, does it make sense for us to adjust the teamcity.buildqueue.waitWeight parameter to 0 (or near 0), to make sure build queue priorities have a greater effect?  I realize this would increase the possibility that some build configurations at lower priorities could be starved.  Is there any other method for adjusting the way priorities are applied that would be preferred over changing this parameter?

Thanks!

0
Comment actions Permalink

Hello, Tim.

All information about the priority algorithm mentined in the documentation is actual for TeamCity 8.1.x.
So for your case you can add teamcity.buildqueue.waitWeight=0 to internal.properties file to make higher priority builds to be placed closer to the top of the queue.

Since version 6.0 this plugin is bundled with the TeamCity, so you do not need to install it.

0
Comment actions Permalink

Is this thread and documentation, still applicable with current iterations/versions of Teamcity -> TC 2018.x and 2019.x ?

0
Comment actions Permalink

Hi Christian,

 

not exactly. While the functionality is still present, it has been brought into the product without needing to deal with internal properties: https://www.jetbrains.com/help/teamcity/ordering-build-queue.html#OrderingBuildQueue-ManagingBuildPriorities

0

Please sign in to leave a comment.