Thanks for quick response .[?] what I understood is we need to add Io Processors first and then if at all we want to run IoProcessor with MultiThread then we need to provide a Threadpool Executor. Correct me If I am wrong.
On Tue, Jun 30, 2009 at 5:50 PM, Ashish <[email protected]> wrote: > On Tue, Jun 30, 2009 at 5:13 PM, Emmanuel Lecharny<[email protected]> > wrote: > > Kumar Phani wrote: > >> > >> I want to know how to configure the ThreadPool Executor in > >> Acceptor,exactly > >> what I need is acceptor needs to take 'n' requests simultaneoulsy. > >> > > > > Ok, so when you define your acceptor, you can provide a number of > > IoProcessor to use, depending on the number of processor you have. The > > Executor is a bit different beast : it's used if you have a long > processing > > part somewhere in your chain, and want to decople this part from the > > processing of faster request. Not sure that you need it, it all depends > on > > your application. > > > > Basically, the number of IoProcessor defaults to Nb CPU * 2 + 1. You can > > change that by using the NioSocketAcceptor( int nbProcessor ) if you want > to > > have more processor in the pool. > > I thought default size is number of processor + 1 > > Just trying to put in the missing pieces in my understanding > > > > > You have to know that a processor is associated with a Selector, so once > a > > session has been registred within a IoProcessor, eveery message received > or > > sent on this session will be processed by this IoProcessor. If you have > some > > lengthly operation affecting one special message, then this IoProcessor > will > > wait until this processing is done before processing the next incoming or > > outgoing event. However, all the other sessions associated with another > > IoProcessor will be processed in parallel. > > Hmm, so in a way session is sticky to an IoProcessor. Also, in this > case the messages shall be queued I guess? > > > > > Last, not least, if you want an IoProcessor not to be stuck while > processing > > a request, just add an executor in the chain, so a pool of thread will be > > used to process the messages, instead of the IoProcessor thread. > > This is to obtain parallelism and if order is not important. To ensure > Order will OrderedThreadPoolExecutor be of any help? > > > > > In any case, before using an Executor, I would engage you to make your > > server working with the default configuration, because it's most likely > be > > enough for your need. Once you have reach a point where your needs aren't > > met with the default config, then either increase the number of > IoProcessor, > > or add an executor to the chain : > > > > filterChainBuilder.addLast("threadPool", *new* ExecutorFilter > > < > http://mina.apache.org/report/trunk/xref/org/apache/mina/filter/executor/ExecutorFilter.html > >(Executors.newCachedThreadPool())); > > // Here, we use an ubound thread pool. > > > > Hope it helps. > > > > > >> > >> > >> > >> On Tue, Jun 30, 2009 at 2:58 PM, Emmanuel Lecharny > >> <[email protected]>wrote: > >> > >> > >>> > >>> Kumar Phani wrote: > >>> > >>> > >>>> > >>>> Hi , > >>>> > >>>> Now I am using the Apache Mina Framework.But I want to enhance the > Code > >>>> to > >>>> handle multiple requests by the Server(which is implemented in MINA > for > >>>> communication).Its very urgent so quick response is appreciable. > >>>> > >>>> > >>>> > >>> > >>> Hey, you can post as many time as you want, but you won't get any help > >>> with > >>> such a vague question... > >>> > >>> > >>> > >>> > >>> -- > >>> -- > >>> cordialement, regards, > >>> Emmanuel Lécharny > >>> www.iktek.com > >>> directory.apache.org > >>> > >>> > >>> > >>> > >> > >> > > > > > > -- > > -- > > cordialement, regards, > > Emmanuel Lécharny > > www.iktek.com > > directory.apache.org > > > > > > > > > > -- > thanks > ashish > > Blog: http://www.ashishpaliwal.com/blog > My Photo Galleries: http://www.pbase.com/ashishpaliwal >
