Arun Rahul
Arun Rahul

Reputation: 605

Faster way to process xml in mule

We are having an xml request that is very huge which contains nearly 10000 xml elements as shown below

<root>
   <message></message>
   <message></message>
   <message></message>
         .....
         .....
         .....
         .....
   <message></message>
   <message></message>
   <message></message>
</root>

In mule we are using xpath extractor in for-each processor, which is taking huge amount of time.

Is there a way where we can process huge xml files faster in mule ?

    <foreach doc:name="Foreach" batchSize="1" collection="#[xpath://message]">
        <!-- stuff -->
    </foreach>

Also changing batchSize didn't help.
Is there any other processing way which makes it faster?

Upvotes: 1

Views: 130

Answers (1)

Swathi Damaraju
Swathi Damaraju

Reputation: 51

we can achieve this by following few best practices in mule

  1. use sax parser instead of DOM for loading the xml

  2. divide the file into chunks and process the chunks parellelly

  3. if you are storing the data in several variables do not store the complete xml which may cause the memory leak

  4. remove variables at the end of each mule flow if unnecessary

Upvotes: 1

Related Questions