You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I did some testing using 'ab' tool.
So, ./ab -n 100000 -c 10000 -s 120 http://localhost:9999/
makes the application stop with stack trace: Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64822] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64823] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64824] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64825] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64826] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64827] Exception in thread "Thread-0" java.lang.IllegalStateException: Queue full at java.util.AbstractQueue.add(AbstractQueue.java:98) at java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:312) at com.jenkov.nioserver.SocketAccepter.run(SocketAccepter.java:44) at java.lang.Thread.run(Thread.java:748)
The text was updated successfully, but these errors were encountered:
That looks to me like a too small capacity is used for the ArrayBlockingQueue between the accepting thread and the connection managing thread. Increase capacity of that queue, and the problem will be mitigated. Or, use a blocking "put" method on the queue, so that the accepting thread is blocked until there is space in the queue for another connection.
By the way, this is not a problem of "high load" - but a problem of a high number of connections being opened (and accepted) within a very short time.
I did some testing using 'ab' tool.
So,
./ab -n 100000 -c 10000 -s 120 http://localhost:9999/
makes the application stop with stack trace:
Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64822] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64823] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64824] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64825] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64826] Socket accepted: java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:9999 remote=/0:0:0:0:0:0:0:1:64827] Exception in thread "Thread-0" java.lang.IllegalStateException: Queue full at java.util.AbstractQueue.add(AbstractQueue.java:98) at java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:312) at com.jenkov.nioserver.SocketAccepter.run(SocketAccepter.java:44) at java.lang.Thread.run(Thread.java:748)
The text was updated successfully, but these errors were encountered: