I am working on a mule application that fetches hundreds of thousands of records from database, do a map to change the structure of the incoming records using dataweave and insert the data in Salesforce. The steps I follow are:
- fetch all the records (> 100k) from db at once and store it in a mule variable "vars.fetchedRecords"
- using a for each component to process these "fetchRecords" in batches of size say 10k
- inside for each, I am using a Dataweave transformer where i use a var to hold the new mapped objects list
How to optimize this process? Will holding so many records in variables impact the performance of the application? Is there a better approach for this?