Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1179

Log4j performance documentation




      Reorganize and extend performance data on the site.

      Async Loggers Manual Page
      Should be more focussed. Proposed changes:
      Link to Location section in Performance page from Async Loggers page "Location, location, location..." section.
      Similarly, move "Throughput of Logging With Location (includeLocation="true")" table with throughput results to general Performance page. UPDATE: replaced with new data from JMH benchmark.
      Move "FileAppender vs. RandomAccessFileAppender" section to general Performance page. (Again, keep anchors and link to new section on Performance page to avoid breaking links.)
      Rewrite opening paragraph of Async Logger manual page to remove reference to RandomAccessFile appender
      Rewrite section on Latency

      • The histogram shows service time (more useful for users is response time: service time + wait time).
      • Bar chart diagram on "average latency" is nonsense. Latency is not a normal distribution so terms like "average latency" don't make sense. Remove this. (A histogram showing the full range of percentiles does make sense.)
      • Bar chart diagram with max of 99.99% of observations is better than average but still has large drawbacks: this is service time (omitting the crucial wait time) and how high are the peaks in the 0.01% we did not report? Better to remove this and instead show a histogram with the full range of percentages.

      Performance Page
      Briefly explain about various aspects of "performance": peak measured throughput (what kind of bursts can we deal with?), sustained throughput, and response time (service time + wait time).

      2. Then show how Log4j 2 compares to the alternatives (Logback, Log4j-1.2 and JUL) on all these three performance dimensions.

      3. Finally, document some performance trade-offs for Log4j 2 functionality.

      2. Comparison to alternative logging libraries
      Peak throughput comparison Async Loggers vs async appenders for bursty logging.
      Response time comparison of Async Loggers vs async appenders
      Parameterized messages: use these JMH benchmark results? (Looks like parameterized messages are currently quite expensive...)

      compare performance impact of including location between logging libraries

      For various appenders, compare Log4j2 to alternatives with regards to max sustained throughput (and separately, response time).
      File Appender max sustained thoughput
      File Appender response time comparison
      Socket appender (TCP/UDP)
      Syslog appender (TCP/UDP)

      3. Log4j 2 functionality performance trade-offs
      Compare performance of Log4j 2 appenders (File, RandomAccess File, MemoryMapped File, Console, Rewrite, other?). Use the same layout for comparison. Perhaps the PatternLayout with the %d [%t] %p %c - %m%n pattern.
      Cost of various APIs/wrappers (SLF4J, Log4j1, JUL, Commons Logging)
      Compare performance all layouts (CSV, Gelf, HTML, JSON, Pattern, RFC-5424, Serialized, Syslog, XML). Perhaps for log events with and without Throwable. TBD: any layout options to compare? (It may be good to document which features have a performance cost.)
      Cost of various Pattern Layout options. Are there any converters that are particularly expensive (other than location)?
      JDBC appenders? - different JDBC drivers and target databases may have very different performance. May become a big project. We could do a quick comparison of the JDBC appender to the JDK Derby DB compared against FileAppender just to get an idea of max sustained throughput?

      Of the existing Performance page sections:

      Briefly mention that disabled logging has no measurable cost, but de-emphasize this section by moving it down the page.
      I like the part about the filters because it a) compares Log4j 2 to Logback and b) considers multithreaded applications. I'll turn this into a JMH test and show the result as a bar chart.


        1. ParamMsgThrpt1T.png
          59 kB
          Remko Popma
        2. ParamMsgThrpt2T.png
          61 kB
          Remko Popma
        3. ParamMsgThrpt4T.png
          57 kB
          Remko Popma
        4. FilterPerformanceComparison.png
          25 kB
          Remko Popma
        5. MarkerFilterCostComparison.png
          21 kB
          Remko Popma
        6. ThreadContextFilterCostComparison.png
          18 kB
          Remko Popma

        Issue Links



              rpopma Remko Popma
              rpopma Remko Popma
              0 Vote for this issue
              3 Start watching this issue