Hi Trustin,

Yes i did try to follow the Thread model tutorial. As is evident, its not
clear to me :)

I seem to have missed to understand, One Connector tied with one I/O
handler. Thanks for clearing that up for me.
now, for every session that  is created by calling connector.connect(), i
need to attach some application specific data. 
Would it be ok to wait on the ConnectFuture object to join() and then add
the data to the session attachment ?
(i ask because, connection setup may take a while and in the meantime i
would have received more requests to forward)

I can imagine its not easy to put up with silly questions :) 
appreciate your patience.

vishal


Trustin Lee wrote:
> 
> 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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Managing-large-number-of-Connectors-tf4942096s16868.html#a14186786
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

Reply via email to