1 2 Previous Next 17 Replies Latest reply on Apr 24, 2014 8:21 AM by ataylor Go to original post
      • 15. Re: Re: Hornetq client creates lots of threads per connection when using nio connector
        manu_1185

        After setting use-nio-global-worker-pool=true, I ran 2 tests. In first test I created 50 connections from a single connection factory and took a stack trace. In 2nd test, I created 50+50 connections from 2 different connection factories and took another stack trace. Given below are some thread stats from these files (files also attached):

         

        Manus-MacBook-Pro-2:testProject manusrivastava$ grep "HornetQ-client-global-threads" stack-1.txt -c

        1

        Manus-MacBook-Pro-2:testProject manusrivastava$ grep "HornetQ-client-netty" stack-1.txt -c

        24

        Manus-MacBook-Pro-2:testProject manusrivastava$ grep "HornetQ-client-global-threads" stack-2.txt -c

        1

        Manus-MacBook-Pro-2:testProject manusrivastava$ grep "HornetQ-client-netty" stack-2.txt -c

        24

         

        You can see, the number of threads remain same for both. It looks like it is using an overall global pool (and NOT pool per connection factory). This behavior looks ok to me...what I feel is wrong is the behavior when use-nio-global-worker-pool=false.

         

        When use-nio-global-worker-pool=false, then it should create a pool per connection factory and all connections created from the factory should share the pool. I still don't understand what you mean by "each connection uses its own pool"....why do we need a pool for each connection. Firstly, a single thread should be enough for one connection (like in blocking IO). And secondly, if each connection has a thread or a pool, then the purpose of using NIO is lost.

        • 16. Re: Hornetq client creates lots of threads per connection when using nio connector
          ataylor

          ignore that last post and let me be concise.

           

          Netty uses an event group that is used to execute stuff . if use-nio-global-worker-pool=false then each connection will use its own event group, if true then they all connections created by a factory will share one. An event group is used for events such as writes, closing etc that can happen from different client calling threads, think of pings, topology updates and client packets. As far as im aware, netty will create these threads up front.

          • 17. Re: Hornetq client creates lots of threads per connection when using nio connector
            ataylor

            also netty will use this group for callbacks for futures etc

            1 2 Previous Next