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

ReadHeadersInterceptor performances improvement

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7.13, 3.0.2, 3.1
    • Component/s: JAX-WS Runtime
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      It has been noticed by running some benchmarks that CXF performances could possibly be improved when dealing of SOAP messages with no SOAP headers. The ReadHeadersInterceptor builds a DOM Document for each SOAP message; while that's fine if there actually are headers in the message, it looks like a waste of time and memory if the message has no header. The document has big memory footprint, which ends up in high heap memory pressure when running our benchmarks. The final result is performance penalty.

      I've been reasoning on a solution for starting parsing the message with StAX (envelope and header part only, as per the PartialXMLStreamReader already in place), buffering the stream events and optionally generating the DOM doc if a soap header is actually found.

      The initial patch is attached; some local tests show that the patched ReadHeadersInterceptor performance (processing time) is ~16% better than the current one for messages with no headers and ~3% worse for messages with 2 not trivial headers.
      Ideally, we could switch this patched processing method by default and give the user a mean for disabling it (prop in the message/exchange ?). Moreover, we could automatically disable it whenever WS-* interceptors are installed in the chain (as WS-Security, WS-Addressing, WS-RM, etc. all imply headers being added to the messages).
      In terms of memory allocation, the patched version is dramatically better for messages with no headers.

        Attachments

        1. headers-perf.diff
          25 kB
          Alessio Soldano

          Issue Links

            Activity

              People

              • Assignee:
                asoldano Alessio Soldano
                Reporter:
                asoldano Alessio Soldano
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: