JAXRSUtils: Avoid calling Message unless it'll be logged
--------------------------------------------------------

                 Key: CXF-3324
                 URL: https://issues.apache.org/jira/browse/CXF-3324
             Project: CXF
          Issue Type: Improvement
          Components: JAX-RS
    Affects Versions: 2.3.2
         Environment: JDK 1.6
            Reporter: Ka-Lok Fung
            Priority: Minor
             Fix For: 2.3.3


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.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to