Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-4974

Unnecesary JAXBContext creation during request processing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.2
    • None
    • jaxws
    • Axis2-jaxws

    Description

      Here at my job we've been using Axis2 since version 1.4.1

      During the design phase of our last project we decided to try JAXWS. The project is now in production, but users reported slower performance overall compared to previous versions of the same service. Another colleage reengineered the project to use ADB and tested it, obtaining a performance increase of 10x (!!). Unfortunately we cannot revert to ADB since both ADB and JAXWS generate the WSDL with slight (but incompatible) differences, which would require a code re-write on the clients' side.

      Long story short, I profiled the application and noticed that a new JAXBContext was instantiated about 4 times per client request, consuming about 60% of CPU time, so I downloaded and debugged the axis2-jaxws module, finding what I think is a bug on the JAXBContext cache handling code.

      Around linke 272 of JAXBUtils class we find this (comments are mine):

      /272/ softRef2 = jaxbMap.get(validPackagesKey); // Get validPackagesKey from cache
      /273/ if (softRef2 != null)

      { // Key found? /*274*/ map2 = softRef.get(); /*275*/ }

      /276/ if (map2 == null)

      { // Map not found? /*277*/ map2 = new ConcurrentHashMap<ClassLoader, JAXBContextValue>(); /*278*/ softRef2 = /*279*/ new SoftReference<ConcurrentHashMap<ClassLoader, JAXBContextValue>>(map2); /*280*/ jaxbMap.put(key, softRef2); // ERROR (I think) => New map inserted with key instead of validPackagesKey!! /*281*/ }

      I recompiled the jar changing 'key' for 'validPackagesKey' on line 280, replaced the original JAR and re-tested. New JAXBContext's are only created during the first invocation and performance is now comparable to the ADB version (10 times better). We still have to make regression tests on QA to ensure that this change doesn't affect anything else, but I though I should let you know about this.

      The fully qualified name of the affected class is org.apache.axis2.jaxws.message.databinding.JAXBUtils, and the version we're currently using is Axis2-1.5.2

      Attachments

        Activity

          People

            Unassigned Unassigned
            victor.downs Victor Downs
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: