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

Garbage-free ThreadContext map

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5
    • 2.7
    • API
    • None

    Description

      The current ThreadContext map and stack implementations allocate temporary objects. This ticket is to investigate and track the work for alternative implementations that are garbage-free.

      Both DefaultThreadContextMap and DefaultThreadContextStack are copy-on-write data structures: each modification replaces the ThreadLocal object with a modified copy. The advantage of this approach is that there is no need to make a copy for each LogEvent.

      Also, DefaultThreadContextMap uses a JDK map, the JDK collections tend to allocate a lot of temporary objects.

      Attachments

        1. v2_ThreadContextPut.png
          31 kB
          Remko Popma
        2. v2_ThreadContextGet.png
          31 kB
          Remko Popma
        3. v2_InjectWithoutConfigProperties.png
          39 kB
          Remko Popma
        4. v2_InjectWithConfigProperties.png
          43 kB
          Remko Popma
        5. v2_DataStructOpsPerfSmallDataSet.png
          41 kB
          Remko Popma
        6. v2_DataStructOpsPerfMediumDataSet.png
          49 kB
          Remko Popma
        7. ThreadContextPut.png
          46 kB
          Remko Popma
        8. InjectWithoutConfigProperties.png
          35 kB
          Remko Popma
        9. InjectWithConfigProperties.png
          36 kB
          Remko Popma
        10. DataStructOpsPerfSmallDataSet.png
          43 kB
          Remko Popma
        11. DataStructOpsPerfMediumDataSet.png
          49 kB
          Remko Popma

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: