I have a spring boot webflux application which calls 5 different backendservices using webclient. We have Log4j2 for logging and using MDC based logging to hold some log lables and attach it to log statements.
During perf test I am seeing sudden spike in HeapMemory over a period of time. Example for each 6 hours we are seeing spike in memory usage. When analyzing HeapDump I can see LoggerContextFactory and Logger object is occupies 20 MB and 12 MB in retained heap space. When we dig deep it shows multiple concurrentHashMap Node objects are created but all off them are pointing to either spring frame work or Logger reference.
How to identify what is causing the exact High Memory issue?
We use AsynFile appender in log4j2.xml. Also Have a LoggingFilter which extend WebFilter in which we are having custom code to Copy MDC map values.
How to approach this issue? As Heapdump is not giving any clue other than Logger framework class is occupying the more memory. Any suggestion really appriciated.
We use spring boot 3.3.x and all the latest managed versions.