-
Improvement
-
Resolution: Fixed
-
Minor
-
jenkins 2.481 java 17 16-core 32 GB memory server
An executor has a significant idle time after completing a task before receiving the next task.
My Jenkins has thousands of items in the queue, and they are all buildable.
An executor has a few seconds of idle time before it gets the next item to execute. When the queue reaches 20,000, there's even a few minutes of idle time.But when the queue is only a few hundred, the time is only a few hundred milliseconds.
I see this class with comments like this.
I can alleviate this problem by splitting the queue across multiple machines, but is there any other way I can reduce this idle time on one machine? This duration may be more appropriate to call scheduling time.
UPDATE 2025-01-23
Through source code analysis I find the lock in Executor.java.
jenkins/core/src/main/java/hudson/model/Executor.java at master · jenkinsci/jenkins · GitHub
Object task uses Queue.withLock(), and it needs lock in Queue.
Recently I added some logs warpped this sentence in Executor.run(), method starts immediately after distribute in Queue.maintain() but it waits the release of Queue.lock to create task.
If the loop in Queue.maintain() is not finished, it will not be able to obtain the timing of execution.