mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic Soulier <frede...@wallaby.uklinux.net>
Subject Thread pools setup and behavior with MINA 1.0.0
Date Fri, 27 Oct 2006 12:09:05 GMT
Hi

I've got some issues with the way the thread pooling must be setup when
going for a manual configuration. I'm using MINA 1.0.0 and Java 5 (_09)
on a linux box running CentOS 4.4 (i386) with 2 x dual-core Opterons (4
cpus).

Setup #1
========
socketAcceptor = new SocketAcceptor();
socketConfig = new SocketAcceptorConfig();
socketConfig.setDisconnectOnUnbind(true);
socketConfig.setReuseAddress(true);
            
ProtocolCodecFactory socketCodec = new SocketCodecFactory(this);
socketConfig.getFilterChain().addFirst("f1", blacklistFilter);
socketConfig.getFilterChain().addAfter("f1", "f2", new
ProtocolCodecFilter(socketCodec));
socketConfig.getFilterChain().addLast("f3", new CustomMessageFilter());
socketHandler = new SocketSessionHandler();

Setup #2
========            
Executor executor1=Executors.newFixedThreadPool(socketProcessorsCount);
socketAcceptor = new SocketAcceptor(16, executor1);
socketConfig = new SocketAcceptorConfig();
socketConfig.setThreadModel(ThreadModel.MANUAL);
socketConfig.setDisconnectOnUnbind(true);
socketConfig.setReuseAddress(true);

ProtocolCodecFactory socketCodec = new SocketCodecFactory(this);
Executor executor2=Executors.newFixedThreadPool(16);
socketConfig.getFilterChain().addFirst("f0", new
ExecutorFilter(executor2));
socketConfig.getFilterChain().addAfter("f0", "f1", blacklistFilter);
socketConfig.getFilterChain().addAfter("f1", "f2", new
ProtocolCodecFilter(socketCodec));
socketConfig.getFilterChain().addLast("f3", new CustomMessageFilter());
socketHandler = new SocketSessionHandler();*/

I used Setup #1 for a while and it does work fine. My assumption in this
setup is that the socket acceptor thread pool (16 threads) is setup
automatically and that a thread pool (16 threads) is automatically setup
in the filter chain.

Bottom line is that Setup #1 works well whilst Setup #2 doesn't.

In Setup #2 when I fire up 16 clients to connect and send a bunch of
messages, it seems the 16th clients has to wait for one ioSession to be
closed before being able to go through.

What am I doing wrong here?
I want to use the manual setup to be able to configure the number of
threads used for the acceptor and the filter chain.

Thx in advance.

-- 
Frederic Soulier <frederic@wallaby.uklinux.net>
OpenPGP key available on http://www.keyserver.net
1024D/BA6700ED   49A6 8E8E 4230 8D41 1ADE  B649 3203 1DD2 BA67 00ED


Mime
View raw message