Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3324

JAXRSUtils: Avoid calling Message unless it'll be logged

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.2
    • 2.3.3
    • JAX-RS
    • JDK 1.6

    • Novice

    Description

      Our performance and reliability testing has shown that Message.toString() is called many times in JAXRSUtils.selectResourceClass and JAXRSUtils.findTargetMethod. It takes up 2.5% of our CPU when these messages aren't even being logged. An image from the profiler showing this hotspot is attached.

      According to our tests, if you pre-check if the message is loggable (e.g., if (LOG.isLoggable(Level.FINE))) and logging is set to the default level, the throughput is increased by 2% and the CPU time is reduced by an equal amount. The lines where this change would have the most impact are indicated in the image.

      Attachments

        1. CXF.Message.Hotspot.png
          34 kB
          Ka-Lok Fung

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            kfung Ka-Lok Fung
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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