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

Improve LoggerConfig's data structure for AppenderControl objects

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.6
    • Component/s: Core
    • Labels:
      None

      Description

      LoggerConfig#callAppenders is performance sensitive since it is called for every LogEvent. Currently the AppenderControl objects are stored in a CopyOnWriteArraySet which is a very good fit for its intended use (vastly more reads than writes, writes may happen concurrently in different threads), but the disadvantage of this data structure is that it creates a new Iterator instance each time we need to traverse its contents.

      We can do slightly better than this by storing the objects in an array and keep this array in an AtomicReference. The array can be traversed by index without allocating new objects.

        Attachments

          Activity

            People

            • Assignee:
              remkop@yahoo.com Remko Popma
              Reporter:
              remkop@yahoo.com Remko Popma
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: