There are 2 places where Mina uses multi-thread, IoProcessor(to accept new
connection) and IoHandler(to handle the event).
By default, Mina will use (cpu count + 1) threads for IoProcessor. you can
set the count as below:
 NioSocketAcceptor acceptor = new NioSocketAcceptor(10);
But, in the normal, the process of creating new connection is quick, so no
need to set this count a big number. But you can try.

As I know, IoProcessor and IoHandler are working in separate threads. So the
blocking in messageReceived() should not affect new connection.
I think you can check the logic of broadcasting. Maybe it occupied the
IoSession of client.

2011/4/12 Sam.Park <[email protected]>

>
>
> Hi
>
> I am now aware how I/O processor thread working on MINA framework. It seems
> like I/O processor thread
>
> in threadpool processing new connection event. But I am not sure how
> exactly
> it works.
>
> Below is my Codes to start Server Process :
>
> NioSocketAcceptor acceptor = new NioSocketAcceptor();
>
> acceptor.getFilterChain().addLast(
>     "protocolFilter",
>         new ProtocolCodecFilter(
>                new myCodecFactory()));
>
> acceptor.getFilterChain().addLast("threadPool", new
> ExecutorFilter(Executors.newCachedThreadPool()));
>
> Regards,
>
>
>
>
> David Latorre wrote:
> >
> > 2011/4/12 Sam.Park <[email protected]>:
> >>
> >>
> >> Thanks for reply
> >>
> >> But I am afraid i already used "ExcutorFilter"  My Code is below :
> >>
> >> acceptor.getFilterChain().addLast("threadPool", new
> >> ExecutorFilter(Executors.newCachedThreadPool()));
> >>
> >> Any Advice? or helpful link ?
> >
> > Although my knowledge of MINA is very limited, I think  that your
> > problem is that your server gets blocked while it is writing very
> > large messages, right?  This seems to be caused by the I/O processor
> > thread and thus an Executor won't help here.  Let's wait for a more
> > authoritive answer, but how are you instantiating your
> > NioSocketAcceptor?
> >
> >
> >
> >>
> >>
> >>
> >> Mavlarn Tuohuti wrote:
> >>>
> >>> It seems that you used simple thread for IoHandler. You can use a
> thread
> >>> pool as below:
> >>> acceptor.getFilterChain().addLast("exceutor", new ExecutorFilter());
> >>>
> >>> 2011/4/11 박준범 <[email protected]>
> >>>
> >>>> Hi
> >>>>
> >>>> I am writing Client/Server network program Using MiNA based on char
> >>>> server
> >>>> example.
> >>>>
> >>>> I have a problem to connect server from client . Connection Time out
> >>>> occurs
> >>>> while MINA Server broadcasts message(about 100kb)  to all
> >>>>
> >>>> connected Servers. It looks like client's connect operation blocked
> >>>> until
> >>>> broadcast operation ended. It looks like I/O Connenting handle
> >>>>
> >>>> thread wait until broadcast ends. I don't know how exactly MINA's
> >>>> threading
> >>>> model to process I/O action.
> >>>>
> >>>> Broadcast opration occurred in messageReceived method on IOHandler
> >>>> instance.
> >>>>
> >>>>
> >>>> If I increase Client Time-out property more than broadcasting time. No
> >>>> Connection Time-out occurs on client
> >>>>
> >>>> How can i get over this situation?  I'd like for client applications
> to
> >>>> connect to MINA Server concurrently while there are broadcasting
> >>>>
> >>>> I am using MINA  2.0.2 (NioSocketAcceptor ) and sun JDK 6 on CentOS
> 5.3
> >>>>
> >>>> I am not good at english. So Please excuse me for my clumsy english .
> >>>>
> >>>> Regards,
> >>>>
> >>>> Park
> >>>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/I-Wonder-Why-client-connection-timeout-occurs-while-the-MINA-server-broadcasts-message-to-connected-users.-tp31369411p31375147.html
> >> Sent from the Apache MINA User Forum mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/I-Wonder-Why-client-connection-timeout-occurs-while-the-MINA-server-broadcasts-message-to-connected-users.-tp31369411p31377781.html
> Sent from the Apache MINA User Forum mailing list archive at Nabble.com.
>
>

Reply via email to