SourceTransformer should cache DocumentBuilder & TransformerFactory
-------------------------------------------------------------------

                 Key: SM-2069
                 URL: https://issues.apache.org/jira/browse/SM-2069
             Project: ServiceMix
          Issue Type: Improvement
    Affects Versions: servicemix-utils-1.5.0
         Environment: http://svn.apache.org/repos/asf/servicemix/utils/trunk
            Reporter: Jonathan Anstey


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

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

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

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

Reply via email to