Jenkins running at very high CPU usage

前端 未结 5 1315
粉色の甜心
粉色の甜心 2021-02-18 23:59

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 40

相关标签:
5条回答
  • 2021-02-19 00:25

    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.

    0 讨论(0)
  • 2021-02-19 00:27

    Try passwing following argument to jenkins:

    -Dhudson.util.AtomicFileWriter.DISABLE_FORCED_FLUSH=true
    

    as mentioned here: https://issues.jenkins-ci.org/browse/JENKINS-52150

    0 讨论(0)
  • 2021-02-19 00:39

    I have noticed a couple of reasons for abnormal CPU usage with my Jenkins install on Windows 7 Ultimate.

    1. I had recently upgraded from v2.138 to v2.140 plus added a few additional plugins. I started noticing a problem with the Jenkins java executable taking up to 60% of my CPU time every time a job would trigger. None of the jobs were CPU bound, just grabbing data from external servers, so it didn't make any sense. It was fixed with a simple restart of the Jenkins service. I assume the upgrade just didn't finish cleanly.

    2. Java Garbage Collection was throwing errors and hogging the CPU when running with the default memory settings. It was probably overkill, but I went wild and upped the Java Heap Space for Jenkins from the default 256mb to 4gb; which solved this problem for me.

      See this solution for instructions: https://stackoverflow.com/a/8122566/4479786

    0 讨论(0)
  • 2021-02-19 00:40

    Whenever a request comes in, Jenkins will spawn some threads to serve the request. After upgrading Jenkins, it might have invoked at high throttle at that time. Plz check the CPU and memory usage of Jenkins server while the following scenarios :

    • Jenkins is idle and no other apps are running on the server.
    • Scheduled a build and no other apps are running on the server.

    And compare the behaviors which could help you out to determine whether Jenkins or running jenkins in parallel with other apps are really making trouble.

    As @vlp said, try to monitor the jenkins application via JVisualVM with Jstad configuration to hook in. Refer this link to Configure JvisualVM with Jstad.

    0 讨论(0)
  • 2021-02-19 00:47

    2.5 seems to be a development release, while 1.6 is their Long Term Support version. Thus it seems logical that you should expect some regressions when using the bleeding edge version. The bounty on this question is proof that other users are experiencing this as well. The solution is to report a bug on the Jenkins bug tracker. You can temporarily downgrade to the known good version for now.

    0 讨论(0)
提交回复
热议问题