linux java8 x64,
Jenkins 2.274 - released 5 Jan 2021 and 2.277.1
Having a large number of offline executors causes massive slowdown in hudson.model.Queue. The maintain method is holding the queue lock over 80% of the time in some cases.
Steps to reproduce:
- install jenkins + job-dsl-plugin + matrix-project-plugin + ssh-slaves-plugin + workflow-durable-task-step (Pipeline: nodes and processes)
- create a ssh node with 500 executors, add some random labels "a b c d e f g h i"
- mark the node offline using configure->availability->"bring online according to schedule"
- create the jobs using job dsl below
- wait for the jobs to start, observe the sluggish queue, fire up jvisualvm to analyze
It seems each "parked executor" causes a Queue$JobOffer to be created, which is turn triggers some getCauseOfBlockage analysis. This seems to do blockedItems * buildableItems operations which can get quite slow for a large job queue.
How it was found: We have ~80 nodes with 10 executors each. We took half of them offline during a hardware migration. Soon our jobs filled the queue with 2000 items. Jenkins started timing out due to queue lock contention - a single maintain() call took around 60sec.