Details
Description
I created a JAX-RS 2.0 service, then I used apache benchmark to create some load on the web application. After some tests ab failed.
Completed 18000 requests apr_pollset_poll: The timeout specified has expired (70007) Total of 19997 requests completed
While the test finished and no HTTP requests hit, the application container is still consuming all available CPU time, and it has some threads like this in the thread dump:
"qtp1386911411-56" prio=10 tid=0x00007f5b3803d000 nid=0x56b8 runnable [0x00007f5b06fa8000] java.lang.Thread.State: RUNNABLE at java.util.HashMap.put(HashMap.java:498) at java.util.HashMap.putAll(HashMap.java:647) at org.apache.cxf.message.MessageImpl$1.putAll(MessageImpl.java:188) at org.apache.cxf.message.MessageImpl.calcContextCache(MessageImpl.java:212) at org.apache.cxf.message.MessageImpl.getContextualProperty(MessageImpl.java:174) at org.apache.cxf.transport.http.Headers.copyToResponse(Headers.java:430) at org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractHTTPDestination.java:617) at org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream.close(AbstractHTTPDestination.java:784) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.AbstractHTTPDestination$BackChannelConduit.close(AbstractHTTPDestination.java:720) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) - locked <0x00000000fb20efd0> (a org.apache.cxf.phase.PhaseInterceptorChain) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:83) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) - locked <0x00000000fb20f8f8> (a org.apache.cxf.phase.PhaseInterceptorChain) at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:277) - eliminated <0x00000000fb20f8f8> (a org.apache.cxf.phase.PhaseInterceptorChain) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78) - locked <0x00000000fb20f8f8> (a org.apache.cxf.phase.PhaseInterceptorChain) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:197) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:290) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:214) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:769)
The ab command used:
ab -n 20000 -c 4 http://localhost:8080/asyncresttest/s/r/person/10215670-8466-11e4-b116-123b93f75cba