Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda