Hi Paul,

On 2/16/07, Paul Chen <[EMAIL PROTECTED]> wrote:
Hi, folks,

I have a server with multiple SocketAcceptors listening on 5 different
socket ports. And I create 5 acceptors the following way.

-----
 int NUMBER_CPU = Runtime.getRuntime().availableProcessors();
 Executor ioExecutor = Executors.newFixedThreadPool(NUMBER_POOL_THREADS);
 SocketAcceptor acceptor = new SocketAcceptor(NUMBER_CPU, ioExecutor);
 ...
 acceptor.bind(...);
-----

Repeating the above statement 5 times.

But my machine has only 2 CPUs (NUMBER_CPU=2). Before I dive into
serious performance experiments, I'd love to learn from you guys
what's the best or recommended parameters to new the SocketAcceptors
in this situation?

Repeating the above statements 5 times means that the number of
required threads is (2 + 1) * 5.  Please refer to the following
document for detailed information on configuring the thread model.

http://mina.apache.org/configuring-thread-model.html

For the situation you are facing, I recommend you

1) to create only one acceptor and bind many times.
2) not to share one thread pool with the acceptor and the
ExecutorFilter.  If you really want to do that, please don't use a
fixed thread pool.

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to