Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
Reading Soap Request XML containing 20MB of doc file content in a xml tag/Attribute into Spring Integration application using around 500MB memory

In our application, we are using Spring Integration/Soap Web Service and Spring Boot. We have flow in Spring integration which receives a input XML which has a tag called <content> which contains the data of the Document which we need to upload. Since it is spring Integration we receive this XML data as Source Object. we are converting this Source object into String xml. I see that the memory usage in JVM shoots upto 500MB when this Source to String transformation is happening though the content of the xml is just 20MB. Also in Visual VM I see huge memory usage by char [].

I have even tried with marshaller and marshaller inbound gateway but same issue.

**<int-ws:inbound-gateway id="uploadDocuments"
                            request-channel="uploaddoc" error-channel="errorChannel"
                            header-mapper="xyz"
                            marshaller="abcjaxbmarshaller"
                            unmarshaller="abcjaxbmarshaller"/>**

I even wrote a simple Filter just to see if the issue is related to Spring Integration but what i found is when i am reading the xml from the ServletRequest into String object the memory shoots up again to around 500MB.

@Component
public class UploadDocumentFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException { // TODO Auto-generated method stub

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest) request;
        String test = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
        System.out.println("the input is " + test);

    }

    @Override
    public void destroy() { // TODO Auto-generated method stub

    }

}

The request xml is Base64 encoded. I am not able to justify the increase in size for 20MB file to 500MB usage of memory. Could someone please explain me why there is so much rise in memory and the possible solution to this ?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!