Dear All,
We have Server developed using MINA 2.0.16 where it connects
to two other systems say System-A and System-B.
The connectivity with both these system is persistence which means our
server connects and create only single session with each of these systems
and on the same session multiple message exchanges (Request/Response)
happens.
The current flow of message is as below:
Once we connect with System-B and have persistence connection (single
session), System-B will send us message which we have to process in our
server and then send processed message to System-A then get response from
System-A and then pass it back to System-B
We have provision that if load increases we can have multiple instances of
System-A and our server can establish persistence connection (single
session) with each of these System-A instances and manage the load.
We are facing problem with load coming from System-B to our server as it is
coming on single session and we could see that the read/write on the session
are slowed down and lot of queue build-up is happening for read/write.
Below is the code for establishing the Connectivity with System-B where we
have not added the ExecutorFilter
SocketAddress socketAddress = new InetSocketAddress(this.hostName,
this.port);
NioSocketConnector connector = new NioSocketConnector();
connector.setConnectTimeoutMillis(30 * 1000L);
connector.getSessionConfig().setTcpNoDelay(true);
connector.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,this.echoTime)
;
this.connector.setHandler(systemBHandler); // systemBHandler is our
IoHandler implementationfor System-B
IoFilter codecFilter = new
ProtocolCodecFilter((ProtocolCodecFactory)systemBProcFactory);//
systemBProcFactory is our Codec Implementation
DefaultIoFilterChainBuilder chain = this.connector.getFilterChain();
chain.clear();
chain.addLast("codec", codecFilter);
https://cwiki.apache.org/confluence/display/MINA/Configuring+Thread+Model
>From this link we could understand as below
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).
Do we need to add the ExecutorFilter for above mentioned NioSocketConnector
to System-B so that I/O processor thread will only do the I/O job and all
other business logic will be given to worker threads in ExecutorFilter.
Is there any way to increase the number of threads for my I/O to do the
read/write as we have restriction to create only one session with System-B.
If we add ExecutorFilter with IoEventType for read/write then will that
make the read/write faster with System-B on same single session.
Or we add ExecutorFilter with default IoEventType (All Events) will that
make the read/write faster with System-B on same single session.
Pls help us understand the working on ExecutorFilter in above scenario where
NioSocketConnector has only single session to do all the read/write with
huge load of almost 60-70 messages per second with average message size of
3-4KiloBytes.
Currently we have server having 16 Core with 64 GB RAM.
Thanks And Regards,
Nitin Phuria
Confidentiality Disclaimer: "The information contained in this electronic
message (email) and any attachments to this email are intended for the
exclusive use of the addressee(s) and access to this email by anyone else is
unauthorized. The email may contain proprietary, confidential or privileged
information or information relating to Integra Group. If you are not the
intended recipient, please notify the sender by telephone, fax, or return
email and delete this communication and any attachments thereto, immediately
from your computer. Any dissemination, distribution, or copying of this
communication and the attachments thereto (in whole or part), in any manner,
is strictly prohibited and actionable at law. The recipient acknowledges
that emails are susceptible to alteration and their integrity cannot be
guaranteed and that Company does not guarantee that any e-mail is virus-free
and accept no liability for any damage caused by any virus transmitted by
this email."
--
*Confidentiality Disclaimer**: "The information contained in this
electronic message
(email) and any attachments to this email are intended
for the exclusive use of
the addressee(s) and access to this email by
anyone else is unauthorized. The
email may contain proprietary,
confidential or privileged information or
information relating to Integra
Group. If you are not the intended recipient,
please notify the sender by
telephone, fax, or return email and delete this
communication and any
attachments thereto, immediately from your computer. Any
dissemination,
distribution, or copying of this communication and the
attachments thereto
(in whole or part), in any manner, is strictly prohibited
and actionable at
law. The recipient acknowledges that emails are susceptible
to alteration
and their integrity cannot be guaranteed and that Company does
not
guarantee that any e-mail is virus-free and accept no liability for any
damage caused by any virus transmitted by this email."*