I am running Websockets on Jetty 9.2.7 with Cometd 3.
When the client (browser) starts, the sockets work fine for sometime and suddenly on some event they start to poll.
It accepts HTTP requests at this stage and I have noticed it accepts new sockets also but not sure why the other clients poll instead of holding on to the connection.
How can we prevent this? This is literally killing my application behavior.
We get about 300,000 requests a day. Here is the server configuration:
minThreads : 100, maxThreads : 1500, acceptors: default , idleTimeout: 60000
open files can be 65535. Other OS configuration as per Jetty documentation look fine.
net.core.rmem_max = 212992
net.core.wmem_max = 212992
net.ipv4.tcp_rmem = 4096 87380 6291456
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.somaxconn = 4096
I enabled server dump but could not find much of a clue. It does not look like a problem with Load because the server's behavior is not consistent.
If you look at the number of requests we were getting till 9.31, it was in 100s. The sudden spike in the number is because the clients started to poll. Its certain that the server will stop responding in some time.
What is interesting is, in the peak hours, the numbers look a lot different. The server starts to poll upon 3000+ requests.
We get some requests that are taking 18 seconds to complete. We get about 20,000 of them a day.Some requests take 5 seconds to complete and we get about 200,000 of such requests a day. Could the requests with high latency be causing the problem? Even if that does, The frequency of high latency requests is way more compared to what is shown in the screenshot. But the server stands them for a really long time than what just happened?
What is the problem? The Code? the server? Server Configuration? I am totally lost and we are considering to change the platform as the same code worked with no issues on jetty 8 a couple of months ago. This is the situation ever since we migrated.
Please suggest.
Thanks!
| +- 159 qtp364089744-159 TIMED_WAITING IDLE
| +- 160 qtp364089744-160 TIMED_WAITING IDLE
| +- 162 qtp364089744-162 TIMED_WAITING IDLE
java.net.SocketTimeoutException: Timeout on Read
at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onReadTimeout(AbstractWebSocketConnection.java:526)
at org.eclipse.jetty.io.AbstractConnection.onFillInterestedFailed(AbstractConnection.java:173)
at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillInterestedFailed(AbstractWebSocketConnection.java:496)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback$1.run(AbstractConnection.java:582)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Thank you!
| +- 544 qtp173911631-544 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
| +- 545 qtp173911631-545 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
2015-03-05 10:04:15.972:WARN:oejs.ServletHandler:qtp173911631-549: /js/cometd3/jquery/jquery-2.1.1.js
java.io.IOException: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:234)
at org.eclipse.jetty.server.HttpOutput.sendContent(HttpOutput.java:572)
at org.eclipse.jetty.servlet.DefaultServlet.sendData(DefaultServlet.java:955)
at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:533)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:224)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Caused by:
org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:216)
at org.eclipse.jetty.server.HttpOutput.sendContent(HttpOutput.java:572)
at org.eclipse.jetty.servlet.DefaultServlet.sendData(DefaultServlet.java:955)
at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:533)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:224)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)