Uploaded image for project: 'ServiceMix'
  1. ServiceMix
  2. SM-2069

SourceTransformer should cache DocumentBuilder & TransformerFactory

    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      I noticed that when routing between JBI endpoints in Camel like:

      from("jbi:endpoint:serviceNamespace:serviceA:endpointA").to("jbi:endpoint:serviceNamespace:serviceB:endpointB");
      

      There is a huge overhead creating new TransformerFactory and DocumentBuilder objects. After caching these on a per thread basis I was able to get a test case down from 41.583 sec to 18.224 sec.

      To test this, apply the attached patch (cache_docbuilder.patch) to the servicemix-utils trunk, and also modify the servicemix-camel component with the attached patch (cache_docbuilder_test.patch) and run the following:

      janstey@duffman:/x1/asf/servicemix/components/trunk/engines/servicemix-camel$ mvn clean test -Dtest=SendFromCamelToJbiThenRouteToAnotherJbiComponentTest

      You may need to up surefire's Xmx as well.

      If someone is going to commit this, please only commit the code in cache_docbuilder.patch

      Attachments

        1. cache_docbuilder_test.patch
          1 kB
          Jonathan Anstey
        2. cache_docbuilder.patch
          3 kB
          Jonathan Anstey

        Activity

          People

            ffang Freeman Yue Fang
            janstey Jonathan Anstey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: