Make Jenkins use more efficient Java 8 Base64 Decoder for ConsoleNotes

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      We've observed that high CPU load for one user reading consoleText via Run#doConsoleText, which showed a bottleneck in decoding Base64:

      at org.apache.commons.codec.binary.BaseNCodec.decode(BaseNCodec.java:387)
      {{ at org.apache.commons.codec.binary.Base64.decodeBase64(Base64.java:697)}}
      {{ at hudson.util.UnbufferedBase64InputStream.read(UnbufferedBase64InputStream.java:41)}}
      {{ at hudson.util.UnbufferedBase64InputStream.read(UnbufferedBase64InputStream.java:53)}}
      {{ at java.io.DataInputStream.read(Unknown Source)}}
      {{ at java.io.DataInputStream.readFully(Unknown Source)}}
      {{ at hudson.util.IOUtils.skip(IOUtils.java:87)}}
      {{ at hudson.console.ConsoleNote.skip(ConsoleNote.java:286)}}
      {{ at hudson.console.PlainTextConsoleOutputStream.eol(PlainTextConsoleOutputStream.java:68)}}
      {{ at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)}}
      {{ at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)}}
      {{ at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:74)}}
      {{ at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1793)}}
      {{ at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1769)}}
      {{ at org.apache.commons.io.IOUtils.copy(IOUtils.java:1744)}}
      {{ at hudson.model.Run.doConsoleText(Run.java:2090)}}

      Looking at the implementation here, Java 8 provides a much much efficient Base64 decoder implementation, which has been benchmarked as 2x-3x as fast:

      http://java-performance.info/base64-encoding-and-decoding-performance/

      https://aws.amazon.com/blogs/developer/follow-up-on-base64-codec-performance/

      JENKINS-43780 should cover most of the uses of the Trilead Base64 implementations

            Assignee:
            Sam Van Oort
            Reporter:
            Sam Van Oort
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: