spring-bootjvmheap-memoryspring-cloudspring-actuator

High memory usage in JVM level - org.springframework.boot.actuate.autoconfigure.metrics.AutoConfiguredCompositeMeterRegistry


we had a Spring boot upgrade from 2.3.0.RELEASE to 2.5.13 spring cloud version we are using is spring-cloud-sleuth( 2.0.0.RELEASE) and upgraded to spring-cloud-dependencies (version-2020.0.5) After Upgrade heap memory usage is increasing heavily , from heapdump analysis seeing that below Object is accumulating in memory. "org.springframework.boot.actuate.autoconfigure.metrics.AutoConfiguredCompositeMeterRegistry "

If anyone faced/knows about the issue or please help me to understand what could be the possible reason for this issue. Eclipse analyser result image

Please let me any other information required regarding this issue.


Solution

  • From a little digging in internet i got a post which helped me to identify issue.

    Avoid Spring Boot’s WebClient with uriBuilder for performing web requests.

      webClient .get() 
              .uri(uriBuilder -> uriBuilder.path("/v2/products/{id}")
              .build(productId))
    

    use the following for constructing a URI instead: it will avoid this memory leak.

     webClient .get()
           .uri("/v2/products/{id}", productId))
    

    Sharing here the post for wider audience.