No, the number of threads in your thread pool does not limit the number
of concurrent clients. That's actually one of the big benefits of using
MINA. Since everything is event based you can use a small number of
threads to handle a larger number of connections.
Please, try to set the max pool size to a small number (5-10 maybe) and
see if this has any impact on the performance.
/Niklas
Alessandro Torrisi wrote:
But in this way I will limit users max number in the hub server I think...
Is there any way to have a significant increase of performance ?
Regards,
Alex.
Niklas Therning wrote:
Alessandro Torrisi wrote:
Hi ! I'm developing a free and opensource Direct Connect software
(P2P server). Now that protocol implementation is quite complete I'm
testing with lot of connections.
When connections are made in a concurrent way (50-100 a time), the
server seems to be blocked...
Can I do something to improve performance, adjusting some parameter
or applying some programming pattern directly on Mina ? I've listened
about Thread Pools on SocketAcceptor and IoThreadPool but I didn't
find any tutorial or documentation, is it possible to directly
configure these ones ?
Yes. By default the maximum thread pool size equals Integer.MAX_VALUE.
It can be changed but this has changed bewteen MINA 0.8 and 0.9.
In 0.8, when using SimpleServiceRegistry, you can configure the
maximum pool size like this:
IoThreadPoolFilter f = (IoThreadPoolFilter)
reg.getIoAcceptor(TransportType.SOCKET).getFilterChain().get("threadPool");
f.setMaximumPoolSize(10);
In 0.9 its not that easy since the ThreadPoolFilter used by
SimpleServiceRegistry isn't accessible until a session has been
created. You could try to extend SimpleServiceRegistry and configure
the protected threadPoolFilter yourself:
public class MyServiceRegistry extends SimpleServiceRegistry {
public MyServiceRegistry() {
super();
threadPoolFilter.setMaximumPoolSize(10);
}
}
And then instead of using SimpleServiceRegistry you use
MyServiceRegistry.
Both of these approaches will use a thread pool of at most 10 threads.
HTH
/Niklas