Does operation of reconnect is cheaper then keep one thread per connection?
And what will be with other connections? Should they be disconnected?
About hundreds or thousands of clients within the same JVM: is number of
clients restricted with number of available ports [0-65535] ?
----- Original Message -----
From: "Emmanuel Lecharny" <[email protected]>
To: <[email protected]>
Sent: Tuesday, July 21, 2009 12:56 PM
Subject: Re: Hundreds of clients, few threads
Lapo wrote:
Hi there,
I am relatively new to MINA and have used it for a couple of Java client
apps.
Currently I am working on a load test type application that needs to
spawn
hundreds or thousands of clients within the same JVM and connect to a
server.
The question: is there a way to run thousands of SocketConnector
instances
without running thousands of threads?
>From the first tests I've noticed that 50 connections already create 100
threads, so it's unlikely I'll be able to go in the thousands with this
threading model.
I tried passing a custom Processor to each NioSocketConnector, but still
I
get at least 1 thread per connection.
A socketConnector can manage more than one Socket connection. You can then
declare only a few of them, but with thousands of connections.
You just have to do something like :
...
connector.setHandler(handler);
for ( <loop on the nomber of wanted connections> ) {
ConnectFuture future = connector.connect(address|i]);
}
...
where the handler is common to all the connections.
Hope it helps
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org