Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52571

NodeProvisioner's StandardStrategyImpl often provides more nodes than needed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • Jenkins 2.46.2, mesos plugin 0.13.1

      When some tasks needing the same kind of mesos dynamic slave enter queue almost the same time, the algorithm implemented by StandardStrategyImpl often creates more mesos nodes at last than the number of queued jobs. For example, when six jobs are triggered almost the same time, then we will see this creation sequence: 1, 1, 1, 1, 2, 2. Eight nodes are created, but we only has six jobs. 

      After exploring the jenkins source code and log, I found the reason maybe hide in this code line:

      float connectingCapacity = Math.min(state.getConnectingExecutorsLatest(), snapshot.getConnectingExecutors());

      Because of the min function, though some "connectingExecutors" is existing, "connectingCapacity" still is set the value of state.getConnectingExecutorsLatest() which often equals zero. So when running to this line:

      float excessWorkload = qlen - plannedCapacity - connectingCapacity;

      The "excessWorkload" will be set as value of qlen and ignoring some connectingExecutors. The algorithm here seems to be radical not conservative.

      So, I think that the code should be changed from Math.min() to Math.max(). 

            Unassigned Unassigned
            wuhaitong HaiTong Wu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: