[ https://issues.apache.org/jira/browse/AMQ-5269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14057830#comment-14057830 ]
ASF GitHub Bot commented on AMQ-5269: ------------------------------------- GitHub user dkulp opened a pull request: https://github.com/apache/activemq/pull/33 [AMQ-5269] Update NIO based transports to use a Select mechanism Update NIO based transports to use a Select mechanism for the accepts instead of the blocking select. Cuts about 10 minutes off the activemq-stomp tests, drops the NIO test execution time down to equal to the non-NIO based tests. You can merge this pull request into a Git repository by running: $ git pull https://github.com/dkulp/activemq AMQ-5269 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq/pull/33.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #33 ---- commit 52ef9745d9bafbeab940ed4937c014be3abc9655 Author: Daniel Kulp <dk...@apache.org> Date: 2014-07-10T14:57:44Z [AMQ-5269] Update NIO based transports to use a Select mechanism for the accepts instead of the blocking select. Cuts about 10 minutes off the activemq-stomp tests, drops the NIO test execution time down to equal to the non-NIO based tests. ---- > NIO transports using blocking accept calls, very slow shutdown > -------------------------------------------------------------- > > Key: AMQ-5269 > URL: https://issues.apache.org/jira/browse/AMQ-5269 > Project: ActiveMQ > Issue Type: Bug > Components: Transport > Affects Versions: 5.10.0 > Reporter: Daniel Kulp > Assignee: Daniel Kulp > Attachments: AMQ-5269.patch > > > Currently, all the TCP based transports are using the old blocking style of > socket.accept() to accept connections. This works "OK" except that for > sockets that have a channel associated with them, the socket.close() doesn't > cause it to return immediately. It still waits for the SoTimeout which is > currently set a 2 seconds. That can cause 2 second delays for any shutdown > which causes long, unnecessary delays, particularly in the tests. > One possible "fix" is to drop the socket.setSoTimeout(2000) call to something > much smaller. However, that would turn the accept thread into a more "busy > wait" scenario which is undesirable. > A better fix is to change the accepts for the sockets that have a > ServerSocketChannel to use the NIO based selectors for the accept operations. > The selector.disable()/selector.close() allows the socket and everything to > close immediately. The result is that the NIO based tests now take the same > amount of time as the non-NIO based tests (for which socket.close() causes > the accept to return immediately). > Pull request forthcoming. -- This message was sent by Atlassian JIRA (v6.2#6252)