Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins running at very high CPU usage

Tags:

I recently upgraded from Jenkins 1.6 to 2.5. After I did this, I noticed very high CPU usage, sometimes over 300% (there are only 4 cores, so I don't think it could go over 400%). I'm not sure where to begin debugging this, but here's a thread dump and some screenshots from top/htop

htop htop

top: top

like image 462
Matt Korostoff Avatar asked May 19 '16 22:05

Matt Korostoff


People also ask

How reduce Jenkins memory usage?

One is to make sure you're rotating your build history or discarding your old builds. That helps reduce Jenkins' memory footprint, which improves performance. We recommend keeping 30 to 60 days of build history, but you should configure this on a per-job basis.

How much RAM does Jenkins need?

System Requirements for Jenkins Installation Following are the software and hardware requirements for installing Jenkins: Minimum hardware requirements: 256 MB of RAM. 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)

How do I monitor Jenkins slaves?

For Jenkins slaves: The report for the nodes is available at http://yourhost/monitoring/nodes. Charts aggregated for all nodes of memory, cpu, system load average, number of running builds, build queue length, build times by period. Detailed statistics of the build times and of the build steps by period.


1 Answers

As it turned out, my issue was that several jobs had thousands of old builds. This was fine in Jenkins 1.6 but it's a problem in 2.5 (I guess maybe Jenkins tries to load all the builds into memory when you view the job overview page). To fix it, I just deleted most of the old builds from the problem jobs using this strategy and then reloaded jenkins. Worked like a charm!

I also set the "discard old builds" plugin to keep only the 50 most recent builds, to prevent this from happening again.

like image 172
Matt Korostoff Avatar answered Sep 21 '22 16:09

Matt Korostoff