directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <trus...@gmail.com>
Subject Re: Mina threading
Date Thu, 21 Apr 2005 01:30:18 GMT
Hi,

2005/4/21, Jean-Fran├žois Daune <daune.jf@daune-consult.com>:
> Trustin Lee wrote:
> 
> >Hi!  It's been long time to see you.
> >
> >2005/4/18, daune.jf@daune-consult.com <daune.jf@daune-consult.com>:
> >
> >
> >>Hi Trustin,
> >>
> >>sorry to bug you using you e-mail, but I have not found a mailing list/user
> >>forum for the Mina project.
> >>
> >>
> >
> >Our web site is out-of-date.  I update the site so it should be update
> >sooner or later by apache infra team.
> >
> >Subscription: dev-subscribe@directory.apache.org
> >Archive: http://directory.apache.org/mailing-lists.html
> >
> >
> >
> >>My first question is: do you consider Mina stable enough for switch ?
> >>
> >>
> >
> >You can just retain your message and message recognizer
> >implementation.  So the cost to switch to MINA and vice versa should
> >be easy.  I think MINA is very stable.  The only one worry is the
> >possibility of API change.  There were several API changes although
> >they were all easy to follow.
> >
> >
> 
> Just to let know, I have just switched my Netty2 application to Mina.
> It just took me about 3 hours of work.
> 
> During load tests, I encountered some hard-to-reproduce errors
> (unexpected close...) with Netty2.
> Now, the code work perfectly fine at higher load.
> 
> In addition, I personnally feel more comfortable with the Mina code
> (separation of I/O and protocol layers)
> 
> It is a definitive improvement.
> 
> Congratulations for this great piece of work !

Thanks! :)

> >>My second issue is about Mina threading model.
> >>
> >>I built my server using the Reverser sample as a basis. From code reading, I
can
> >>see that there are the following threads:
> >>
> >>- one SocketAcceptor thread
> >>- one SocketIoProcessor thread
> >>- one IoThreadPoolFilter thread per connection
> >>- one ProtocolThreadPoolFilter thread per connection
> >>
> >>My understanding is that unless maximum pool size is set for IoThreadPoolFilter
> >>and ProtocolThreadPoolFilter, their pool can be extended without limit.
> >>
> >>Unfortunately, I don not really understand what each thread is there for.
> >>
> >>This is important for me to really understand what's behind the scene.
> >>
> >>Is there a design document that explains this ?
> >>
> >>
> >
> >The size of IoThreadPoolFilter and ProtocolThreadPoolFilter is
> >automatically adjusted by thelselves, and therefore it is not
> >one-to-one relationship.  Idle connections doesn't take any threads
> >because their implementation is leader-followers thread pool.  It
> >increases the number of active thread when it is busy, and decreases
> >when idle.  You can set the maximum number of active threads and
> >maximum idle time for active threads.  It is much more flexible and it
> >requires less human configuration.  Sounds cool? ;)
> >
> >There is a link to PDF file in JavaDoc of ThreadPoolFilters which
> >explains the internals of leader-followers thread pool.  So If you
> >want to know what's going on behind the scene, you could read it up.
> >
> >
> 
> I know about the leader-follower (I actually have the POSA2 book) But it
> does not mandate management of the pool.
> When the leader becomes processing thread elects the next leader, if
> there is no more threads in the pool, my understanding is that a new
> thread is created and added to the pool, unless a maximum number of
> threads is set for the pool. Is it right ?

Right.

> And if so, what happens if maximum is reached and last thread becomes
> processing thread ?

Event is queued until any processing thread is idle.

> I also wonders if the thread pool size can decrease at some point in
> time ? I mean whether idle threads stop after some time so that the pool
> size reaches a nominal pool size.

Yes, the number of threads decreases when thread is idle for a long
time (you can specify it).  The minimum number of threads is 1 (only
leader).

I hope this answer helps you.

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/

Mime
View raw message