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

Improve LoggerConfig's data structure for AppenderControl objects

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5
    • 2.6
    • Core
    • 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

            rpopma Remko Popma
            rpopma Remko Popma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: