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