You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Nauman Ahmad Khan <Na...@multiq.com> on 2022/11/16 11:21:14 UTC

Delay in message arrival, please help urgent

Hi,

I have built a server based on MINA. Sometimes the message arrives late. Client is only telnet so there is nothing in between. Following are the setup settings. Can anyone please highlight if a setting is missing or a wrong setting is set? The setup/init code is below.

int processorCount = Runtime.getRuntime().availableProcessors();
if (processorCount <= 0) { processorCount = 8;}
NioSocketAcceptor acceptor = new NioSocketAcceptor(processorCount);
TextLineCodecFactory codec = new TextLineCodecFactory(Charset.forName("utf-8"));
codec.setDecoderMaxLineLength(1000 * 1024);
codec.setEncoderMaxLineLength(1000 * 1024);

acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(codec));
acceptor.getFilterChain().addLast("threadPool", new ExecutorFilter(new OrderedThreadPoolExecutor(1000, 1000)));
acceptor.getFilterChain().addLast("executor1", new ExecutorFilter(1000, 1000));

acceptor.getSessionConfig().setReadBufferSize(2048);
acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10);
acceptor.getSessionConfig().setTcpNoDelay(true);
acceptor.setBacklog(5000);
acceptor.bind(new InetSocketAddress(port));


Regards
nak

Re: Delay in message arrival, please help urgent

Posted by Emmanuel Lécharny <el...@gmail.com>.
Hi,

first, can you tell which MINA version you are using? Also what is your 
environment (OS, Java version, machine configuration - number of cores, 
type of CPU, frequency, ram-)

Is there any valid reason to create two thread pool of 1000 threads? 
That sounds overkilling to me. Also are you sure you want to limit the 
read buffer size to 2048, Considering you have set the max en/decoder 
line to 1M ?

On 2022/11/16 12:21, Nauman Ahmad Khan wrote:
> Hi,
> 
> I have built a server based on MINA. Sometimes the message arrives late. Client is only telnet so there is nothing in between. Following are the setup settings. Can anyone please highlight if a setting is missing or a wrong setting is set? The setup/init code is below.
> 
> int processorCount = Runtime.getRuntime().availableProcessors();
> if (processorCount <= 0) { processorCount = 8;}
> NioSocketAcceptor acceptor = new NioSocketAcceptor(processorCount);
> TextLineCodecFactory codec = new TextLineCodecFactory(Charset.forName("utf-8"));
> codec.setDecoderMaxLineLength(1000 * 1024);
> codec.setEncoderMaxLineLength(1000 * 1024);
> 
> acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(codec));
> acceptor.getFilterChain().addLast("threadPool", new ExecutorFilter(new OrderedThreadPoolExecutor(1000, 1000)));
> acceptor.getFilterChain().addLast("executor1", new ExecutorFilter(1000, 1000));
> 
> acceptor.getSessionConfig().setReadBufferSize(2048);
> acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10);
> acceptor.getSessionConfig().setTcpNoDelay(true);
> acceptor.setBacklog(5000);
> acceptor.bind(new InetSocketAddress(port));
> 
> 
> Regards
> nak
> 

-- 
*Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
T. +33 (0)4 89 97 36 50
P. +33 (0)6 08 33 32 61
emmanuel.lecharny@busit.com https://www.busit.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org