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

EC2 plugin provisions only one worker at a time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • ec2-plugin
    • None
    • 1.40

      We use the EC2 plugin to manage workers. We like to have a widely-varying number of workers, especially now that EC2 has per-second billing – so it's not an uncommon situation for us if we start several jobs at once and need to immediately spin up 10+ workers to handle them. However, the EC2 plugin seems to only allow spinning up one worker at a time.

      I've attached a log where you can see this happening. (As context, at this time we had about 20 workers running, but still had a large queue, and were trying to spin up a new worker of a particular type; we had one worker already starting up of that type and one offline worker of another type.)

      As far as I can tell, what happens is this: Jenkins decides (in NodeProvisioner) that to handle the incoming load we need to spin up 3 more workers; see the first line of the log. The EC2 plugin then calls provision() several times in sequence, once for each worker. [1] Each time, it finds that there is an existing worker already starting up, and returns that instead of starting up a new one. (In other cases, if no worker were already starting, the first round would start up a new worker, and each subsequent round would return that same worker again.)

      My limited understanding of Jenkins's NodeProvisioner suggests that it has already taken into account any workers that are already starting, and so if it tells the plugin to spin up 3 workers, the plugin should spin up 3 new workers, not counting any that are already starting. But even if that's incorrect, if there's only 1 worker already starting, the plugin should clearly spin up at least 2 more, rather than spinning up the same worker 3 times.

            francisu Francis Upton
            benkraft Ben Kraft
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: