opened
arunans23
username_0
**Description:**
<!-- Give a brief description of the issue -->

PayloadFactory mediator performance has significantly reduced in EI 6.6.0. You can try out by calling the following sequence.

```
<sequence name="payload-factory-seq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <property description="Set PAYLOAD_FACTORY_TEST_PARAMETER1" expression="json-eval($.PARAMETER1)" name="PAYLOAD_FACTORY_TEST_PARAMETER1" scope="default" type="STRING"/>
    <property description="Set PAYLOAD_FACTORY_TEST_PARAMETER2" expression="json-eval($.PARAMETER2)" name="PAYLOAD_FACTORY_TEST_PARAMETER2" scope="default" type="STRING"/>
    <property description="Set PAYLOAD_FACTORY_TEST_PARAMETER3" expression="json-eval($.PARAMETER3)" name="PAYLOAD_FACTORY_TEST_PARAMETER3" scope="default" type="STRING"/>
    <payloadFactory media-type="xml">
        <format>
            <TECHNICAL_PARAMETERS xmlns="">
                <PARAMETER1>$1</PARAMETER1>
                <PARAMETER2>$2</PARAMETER2>
                <PARAMETER3>$3</PARAMETER3>
            </TECHNICAL_PARAMETERS>
        </format>
        <args>
            <arg evaluator="xml" expression="$ctx:PAYLOAD_FACTORY_TEST_PARAMETER1" xmlns:ns="http://org.apache.synapse/xsd"/>
            <arg evaluator="xml" expression="$ctx:PAYLOAD_FACTORY_TEST_PARAMETER2" xmlns:ns="http://org.apache.synapse/xsd"/>
            <arg evaluator="xml" expression="$ctx:PAYLOAD_FACTORY_TEST_PARAMETER3" xmlns:ns="http://org.apache.synapse/xsd"/>
        </args>
    </payloadFactory>
</sequence>

```

This is due to the increase in time when initiating a [DocumentBuilder](https://github.com/wso2/wso2-synapse/blob/v2.1.7-wso2v143/modules/core/src/main/java/org/apache/synapse/mediators/transform/PayloadFactoryMediator.java#L683).

**Suggested Labels:**
<!-- Optional comma separated list of suggested labels. Non committers can’t assign labels to issues, so this will help issue creators who are not a committer to suggest possible labels-->

**Suggested Assignees:**
<!--Optional comma separated list of suggested team members who should attend the issue. Non committers can’t assign issues to assignees, so this will help issue creators who are not a committer to suggest possible assignees-->

**Affected Product Version:**

**OS, DB, other environment details and versions:**    

**Steps to reproduce:**


**Related Issues:**
<!-- Any related issues such as sub tasks, issues reported in other repositories (e.g component repositories), similar problems, etc. -->
PayloadFactory mediator performance degraded
issue