Hi Vishal,

On Dec 4, 2007 7:02 PM, Vishal_Jain <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> Am having a bit of confusion and appreciate any help from the community.
>
> i want to manage a large number of connectors (which would connect to
> different web servers). Am experimenting with Mina 2 and use the
> AsyncHttpClient like code. Would we benefit in terms of performance/latency
> if i were to add a ExecutorFilter ?

It depends on what you do in your IoHandler implementation.  If it's
pure CPU logic, then you don't need an ExecutorFilter.

> and if yes, am a bit confused about how to specify the executorfilter to the
> connector. There seem to be two ways to associate the socket with an
> ExecutorFilter/Executors;
> 1.connector.getFilterChain().addLast("threadPool", new
> ExecutorFilter(Executors.newCachedThreadPool()));
> 2. connector = new
> SocketConnector(Runtime.getRuntime().availableProcessors() + 1,
> Executors.newCachedThreadPool());
>
> are they equivalent ? and shouldn't i be using the same ExecutorFilter (in
> 1) for every connector's filter chain that i create ?
> and similarly, shouldn't i be passing the same Executor object while
> creating the connector ?

They are different from each other.  Are you sure you read the thread
model tutorial?  One connector (or one acceptor) takes one connector
(or one acceptor) thread, so creating 100 connectors will create 100
connector threads + 100 (or more) I/O worker threads.  I'd recommend
you to create only one connector and reuse it if all connections are
categorized to the same service category; an IoService is essentially
a logical grouping of sessions with the same IoHandler.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to