Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0M12
    • Component/s: Classlib
    • Labels:
      None
    • Environment:
      SVN Revision: 829932
    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Moderate

      Description

      The logging module performs more synchronization and object allocation than necessary. In particular, getHandlers() always needs synchronization and creates an array. By adopting util.concurrent features (CopyOnWriteArrayList) and coding to the common case (when there are zero handlers) I saw a 2.5x improvement in throughput for calls to logger.log(Level, String). In a benchmark that measures calls to "logger.info", call time improved from 385000ns to 154000ns per message.

      Here's an overview of the patch:

      • Reduce the use of synchronization by adopting a CopyOnWriteArrayList for Handlers
      • Reduce object creation by reusing a 0-length handlers array in getHandlers()
      • Load handlers on logger creation rather than on receipt of the first message. This also fixes a behavioural inconsistency with the RI. I've got a test case that demonstrates this.
      • Cleanup synchronization by moving methods with "synchronized (LogManager.getManager())" blocks to the LogManager class

      I've got the patch ready to submit upstream. I'll submit it when my commit privileges are granted, unless anyone raises objections here.

        Activity

        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #535 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/535/)
        Fixing loggers to load handlers eagerly and track them with a CopyOnWriteArrayList. This improves performance and fixes a bug in our current implementation. A test for the bug is included; performance metrics are available in this JIRA:
        https://issues.apache.org/jira/browse/
        The change to CopyOnWriteArrayList also fixes some concurrency problems. Finally, I've addressed some minor readability issues. I intend to separate style from substance in forthcoming CLs...

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #535 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/535/ ) Fixing loggers to load handlers eagerly and track them with a CopyOnWriteArrayList. This improves performance and fixes a bug in our current implementation. A test for the bug is included; performance metrics are available in this JIRA: https://issues.apache.org/jira/browse/ The change to CopyOnWriteArrayList also fixes some concurrency problems. Finally, I've addressed some minor readability issues. I intend to separate style from substance in forthcoming CLs...
        Hide
        Jesse Wilson added a comment -

        Fixed with r833502.

        Show
        Jesse Wilson added a comment - Fixed with r833502.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jesse Wilson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 120h
              120h
              Remaining:
              Remaining Estimate - 120h
              120h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development