jenkinsci / jenkinsci/lockable-resources-plugin

Lockable resources slowness in scheduling

Open
#717 2 comments 0 reactions 0 assignees View on GitHub
Clarification needed performance Triage
Dominant language
Java
Stars
99
Forks
205
Avg merge
2d 13h
Merged PRs (30d)
8

Description

### Jenkins and plugins versions report

Jenkins: Jenkins 2.462.2
Lockable resources: issue started as of version 1246.v28b_e4cc6fa_16 (new priority strategy), no issues in prior versions.

### What Operating System are you using (both controller, and any agents involved in the problem)?

Controller: jenkins:2.462.2-lts-alpine
Agent: Linux 5.15.0-69-generic #76-Ubuntu SMP using a jenkins pipeline script

### Reproduction steps

In the jenkins groovy code, I am using the lockable resources as such:
def runWrapper = lock(label: "${lock_label}", quantity: 1, variable: "LOCKED")
I am using the lockable resources with the build step plugin (to build other jobs) and without using the priority option as shown above.
The issue can be reproduced when the job is ran in a big number (number of lockable resources x 20) in parallel. The issue wasn't reporduced at 100 parallel jobs, but was shown when 1000 jobs were ran.

### Expected Results

What is expected and what has been occuring in the versions prior to 1246.v28b_e4cc6fa_16, is that the lockable resources are assigned each to a job, and whenever a job ends, the resource is released and assigned to the second job, so at all times, we have (number of lockable resources) jobs running at the same time. The lock should be released as soon as the jobs ends. Opening the Lockable resources tab in the dashboard is also expected and was happening before this version.

### Actual Results

Instead of assigning the resource to another build whenever one is completed, it takes a long time to assign another job, sometimes the whole batch ends (all the inital jobs) and still no scheduling has occured. The releasing of the lock doesn't occur as soon as the job ends, many jobs end before releasing the lock of the first one. Additionally, I cannot open the Lockable Resources tab in the jenkins dashboard, it keeps loading and takes several minutes to open.

### Anything else?

**This issue is very important since many of our pipeliens are using the parallelism combined with the lockable resources.**

### Are you interested in contributing a fix?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.