Dear All,

 

                We have Server developed using MINA 2.0.16 where it has one
NIOSocketAcceptor with SSL & Codec filters in chain before it reaches
handler. We also have put a strategy that client has to send one message per
connection and after getting response or timeout client has to close the
connection. We expect a load of around 400-500 connections at any point of
time. As I read the documentation it says NIOSocketAcceptor will create
default (Number Of Core+1) I/O Processors. As I read from this link 

 

https://cwiki.apache.org/confluence/display/MINA/Configuring+Thread+Model   

 

If We didn't add any ExecutorFilter events are forwarded to an IoHandler via
method invocations. This means your business logic in your IoHandler
implementation will run in the I/O processor thread. We call this thread
model a 'single thread model'. The single thread model is known to be
adequate for low-latency network applications with CPU-bound business logic
(e.g. game servers).

 

Now in our application we have further NioSocketConnector with codec filter
as we need to further pass the received messages to another system and this
connectivity is persistent, so we connect once only and use the same
connection to exchange all the messages in same connection. As I read the
documentation it says NIOSocketConnector will create default (Number Of
Core+1) I/O Processors.  So we created NIOSocketConnector object as
NioSocketConnectorconnector = NioSocketConnector (1); so that it creates
only one i/o processor. Is this correct?

 

Since we have certain business logic in Acceptor handler that further needs
to connect to another system via NioSocketConnector + some database
operations we understand that we need to add ExecutorFilter after
CodecFilter to ensure we keep Acceptor i/o processes free to get further new
connections from clients and hand it over to worker threads in
ExecutorFilter.

 

Now the confusion for us is that Do we need to add ExecutorFitler at
NiOSocketConnector also? 

 

When we add ExecutorFilter to Acceptor how many threads will be created in
pool. The code is one line

 

   chainBuilder.addLast("threadPool", new
ExecutorFilter(Executors.newCachedThreadPool()));

 

Pls help us understand the working on ExecutorFilter and how it will work
when the handler of Acceptor has further connectivity with third system via
NioSocketConnector.

 

Thanks And Regards,

Nitin Phuria

 

 

Reply via email to