thanks. this was surprisingly simple :-)
On Fri, Oct 9, 2009 at 11:59 PM, Emmanuel Lecharny <[email protected]> wrote: > Hi, > > instead of creating anew connector for each new connection, just connect > using the same connector to the newly created InetSocketAddress. > > Alex Shneyderman wrote: >> >> Hi, all! >> >> I am trying to run load simulation agent, which will have to open up >> as many connections as it possibly can - I am trying to determine wht >> the upper limit will be on my laptop. I connect as follows: >> >> SocketConnectorConfig config = new SocketConnectorConfig(); >> >> config.getSessionConfig().setReuseAddress( true ); >> >> SocketConnector connector = new SocketConnector(); >> >> connector.getFilterChain().addLast( "codecs", new >> ProtocolCodecFilter( new CAGProtocolCodecFactory() ) ); >> >> SocketAddress address = new InetSocketAddress( >> cagInfo.serverControlIp(), Integer.parseInt( >> cagInfo.serverControlPort() ) ); >> >> ConnectFuture future = connector.connect( address, new >> CAGIoHandler( this, csChannelEventListener ), config ); >> >> future.join(); >> >> I observe that for every connection I make MINA creates 3 threads. so, >> there is clearly a problem since even if I am able to open as many >> connections as I would want I am currently having problem with >> threads. I thought one of the ideas behind MINA project is an >> efficient handling of threads but my thread dump tells me: >> >> 795 [main] DEBUG CAGRunner - Thread[PooledByteBufferExpirer-0; true; >> true] >> 795 [main] DEBUG CAGRunner - Thread[SocketConnector-0; false; true] >> 795 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-0.0; >> false; true] >> 795 [main] DEBUG CAGRunner - Thread[AnonymousIoService-1; true; true] >> 795 [main] DEBUG CAGRunner - Thread[SocketConnector-1; false; true] >> 795 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-1.0; >> false; true] >> 795 [main] DEBUG CAGRunner - Thread[AnonymousIoService-2; true; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnector-2; false; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-2.0; >> false; true] >> 796 [main] DEBUG CAGRunner - Thread[AnonymousIoService-3; true; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnector-3; false; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-3.0; >> false; true] >> 796 [main] DEBUG CAGRunner - Thread[AnonymousIoService-4; true; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnector-4; false; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-4.0; >> false; true] >> 796 [main] DEBUG CAGRunner - Thread[AnonymousIoService-5; true; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnector-5; false; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-5.0; >> false; true] >> 796 [main] DEBUG CAGRunner - Thread[AnonymousIoService-6; true; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnector-6; false; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-6.0; >> false; true] >> 796 [main] DEBUG CAGRunner - Thread[AnonymousIoService-7; true; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnector-7; false; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-7.0; >> false; true] >> 796 [main] DEBUG CAGRunner - Thread[AnonymousIoService-8; true; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnector-8; false; true] >> 796 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-8.0; >> false; true] >> 797 [main] DEBUG CAGRunner - Thread[AnonymousIoService-9; true; true] >> 797 [main] DEBUG CAGRunner - Thread[SocketConnector-9; false; true] >> 797 [main] DEBUG CAGRunner - Thread[SocketConnectorIoProcessor-9.0; >> false; true] >> 797 [main] DEBUG CAGRunner - Thread[AnonymousIoService-10; true; true] >> >> 3 threads per connection. I tried 20 connections as well and the >> thread number went to 60. >> >> Is it possible to control the number of threads on the client side ? >> >> Thanks, >> Alex. >> >> > > > -- > -- > cordialement, regards, > Emmanuel Lécharny > www.iktek.com > directory.apache.org > > >
