Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-20965

SSH CLI -v (console output) option causes high master CPU utilization

      I trigger a lot of builds remotely using SSH based client. We use the "-s -v -w -r 5" command line options.

      When -v is enabled, the SSH command thread running in the master uses a LOT of CPU. As in a full CPU core. When -v is not enabled this thread does not use any CPU.

        1. V-CPU-support(2).zip
          41 kB
        2. V-CPU-support(3).zip
          41 kB
        3. V-CPU-support(4).zip
          41 kB
        4. V-CPU-support(5).zip
          41 kB
        5. V-NOCPU-support(1).zip
          42 kB
        6. V-NOCPU-support(2).zip
          42 kB
        7. V-NOCPU-support(3).zip
          42 kB
        8. V-NOCPU-support(4).zip
          42 kB
        9. Threads - SSH CLI with -v.png
          Threads - SSH CLI with -v.png
          213 kB
        10. Threads - SSH CLI without -v.png
          Threads - SSH CLI without -v.png
          227 kB
        11. V-CPU-support(1).zip
          41 kB

          [JENKINS-20965] SSH CLI -v (console output) option causes high master CPU utilization

          Walter Kacynski created issue -

          I could not find another issue report for this problem.

          Walter Kacynski added a comment - I could not find another issue report for this problem.
          Jesse Glick made changes -
          Labels New: performance
          Jesse Glick made changes -
          Component/s Original: cli [ 15624 ]
          Component/s Original: ssh [ 16049 ]
          Labels Original: performance New: cli performance
          Steven Christou made changes -
          Assignee New: Steven Christou [ schristou ]

          After looking at the stack trace a little more digging and I noticed that the Run.writeWholeLogTo was reading and writing the logs as much as possible even if nothing has changed in the logs. As a solution I added a Thread.sleep for 1 second which should prevent high CPU usage. See pull request: https://github.com/jenkinsci/jenkins/pull/1137.

          Steven Christou added a comment - After looking at the stack trace a little more digging and I noticed that the Run.writeWholeLogTo was reading and writing the logs as much as possible even if nothing has changed in the logs. As a solution I added a Thread.sleep for 1 second which should prevent high CPU usage. See pull request: https://github.com/jenkinsci/jenkins/pull/1137 .

          Code changed in jenkins
          User: christ66
          Path:
          core/src/main/java/hudson/model/Run.java
          http://jenkins-ci.org/commit/jenkins/82e94e5e738c988c36181d8c0ff6b9ffed846bcc
          Log:
          [FIXED JENKINS-20965] Run.writeWholeLogTo causes high CPU usage.
          Wait one second before writing to log files. Switched to while loop to
          prevent extra one second delay.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: christ66 Path: core/src/main/java/hudson/model/Run.java http://jenkins-ci.org/commit/jenkins/82e94e5e738c988c36181d8c0ff6b9ffed846bcc Log: [FIXED JENKINS-20965] Run.writeWholeLogTo causes high CPU usage. Wait one second before writing to log files. Switched to while loop to prevent extra one second delay.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/model/Run.java
          http://jenkins-ci.org/commit/jenkins/5d91ed77f7402133fd7c9e77b1a6676c6695ec5a
          Log:
          Merge branch 'JENKINS-20965' of github.com:christ66/jenkins

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/model/Run.java http://jenkins-ci.org/commit/jenkins/5d91ed77f7402133fd7c9e77b1a6676c6695ec5a Log: Merge branch ' JENKINS-20965 ' of github.com:christ66/jenkins

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html http://jenkins-ci.org/commit/jenkins/0d77f1795cf97a5e7dbd43f066ab5f97753b464b Log: JENKINS-20965 Noting merge of #1137. Compare: https://github.com/jenkinsci/jenkins/compare/761af2d2dbd2...0d77f1795cf9

            walterk82 Walter Kacynski
            walterk82 Walter Kacynski
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: