How can I reduce memory usage when processing large JSON payloads in Mule 4?
02:12 24 Aug 2026

I’m working on a Mule 4 integration that receives fairly large JSON payloads from an external API and transforms the data using DataWeave before sending it to another system.

The flow works fine with smaller payloads, but when the payload size increases, memory usage goes up significantly and the API response becomes much slower. In some cases, the worker also starts getting close to its memory limit.

The current flow is roughly:

HTTP Listener → DataWeave Transform → API Request

The DataWeave transformation includes filtering and mapping through a large nested array.

I’ve already tried simplifying the DataWeave script and removing unnecessary variables, which helped slightly, but the memory usage is still higher than expected.

Is there a recommended way in Mule 4 to process large JSON payloads without loading the entire payload into memory?

Would streaming the payload help in this case, or are there other Mule/DataWeave configurations I should look at?

mule dataweave mulesoft mule4