1 2 Previous Next 17 Replies Latest reply on Apr 24, 2014 8:21 AM by Andy Taylor

    Hornetq client creates lots of threads per connection when using nio connector

    Manu Srivastava Newbie

      We are using hornetq (2.3.0.Final) in our messaging app and recently I found one issue. Earlier the connector/acceptor config in hornetq-configuration.xml was using old blocking io. I recently changed it to use nio since our client creates lots of connections to hornetq server (160 connections per client and we have a cluster of 15 such clients...so total is 2400).


      On the hornetq-server side things were perfect....stack trace showed a single boss thread with several workers (3*number of cores). But on the client side, the number of threads actually increased when I was expecting it to decrease. The old blocking io uses one thread per connection.....so earlier 160 connections on a single client had 160 threads. When switching to nio connectors, I was expecting that all 160 connections will be handled by one boss thread with 3*number of core worker threads (ours is a 4 core machine...so 12 worker threads). But the stack trace shows 160 boss threads and 160*12=1920 worker threads. It looks like for every connection one boss and 12 workers are being created.


      I am not sure....but here is what I think might be wrong. Since hornetq uses netty, every client connection might be creating a new NioClientSocketChannelFactory, when a single instance should have been shared across multiple connections in a single client process.


      Am I missing any configuration? And if this is an issue, is there any workaround this? Can we upgrade to the newer version to fix this?

        1 2 Previous Next