Details
-
Bug
-
Resolution: Fixed
-
None
-
1.7.x
-
None
-
Operating System: All
Platform: All
-
major
-
P1
-
298
Description
I'm analyzing degraded performance in a new release of out web application.
The application has relatively high throughput (>4k requests/s). We're seeing increased contention on the lock-guarded "loggerMap" in SLF4JLogFactory.
The change that introduced this contention is that some of the libraries we're using (Spring, in this particular case) apparently have started creating Logger instances in request-scoped objects in new versions, increasing the volume of calls to SLF4JLogFactory.getInstance().
The top of the call stack of threads waiting for the lock in question looks like shown below.
Given that SLF4J targets Java 5+, it seems that some of the util.concurrent constructs could be used to make logger retrieval lock-free for the common cases.
-----------
http-/0.0.0.0:8080-187 [BLOCKED] CPU time: 3s
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(String)
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(Class)
org.apache.commons.logging.LogFactory.getLog(Class)
org.springframework.util.ConcurrencyThrottleSupport.<init>()
org.springframework.core.task.SimpleAsyncTaskExecutor$ConcurrencyThrottleAdapter.<init>()
org.springframework.core.task.SimpleAsyncTaskExecutor$ConcurrencyThrottleAdapter.<init>(SimpleAsyncTaskExecutor$1)
org.springframework.core.task.SimpleAsyncTaskExecutor.<init>(String)
org.springframework.web.context.request.async.WebAsyncManager.<init>()
org.springframework.web.context.request.async.WebAsyncUtils.getAsyncManager(ServletRequest)
org.springframework.web.servlet.FrameworkServlet.processRequest(HttpServletRequest, HttpServletResponse)
org.springframework.web.servlet.FrameworkServlet.doPost(HttpServletRequest, HttpServletResponse)
javax.servlet.http.HttpServlet.service(HttpServletRequest, HttpServletResponse)
org.springframework.web.servlet.FrameworkServlet.service(HttpServletRequest, HttpServletResponse)
javax.servlet.http.HttpServlet.service(ServletRequest, ServletResponse)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
-----------