You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Erix Yao <er...@gmail.com> on 2008/10/28 08:08:30 UTC

FtpServer thread model?

What is the thread model of the ftp server ?
Is it running in only one thread except the mina's thread pool?
I have an idea, that after the command has been analyzed, the excution of
each command should be thrown into a excutor or a thread pool, using
asynchrouse mechanism to enhance the throughout of the server.
How do you think so ?

Re: FtpServer thread model?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Erix Yao wrote:
> I see. But according to Scalable Java I/O, I think using a reactor pattern
> and SEDA will help improve the performance.
>   
MINA has been implemented based on the reactor pattern. The fact that 
you have an executorFilter at the beginning of the chain is not related 
to this pattern. It's just an enhancement.
> As far as I know, the Listener interface is acting as a reactor, using
> NioAcceptor provided by MINA, but the rest of the work except the network
> handling are excuted in the thread pool. But the excution model is still the
> first model in Scalable Java I/O. Any improvements can be done?
>   
Tuning the number of thread accordingly with the number of processor you 
use, that's pretty much all what you can do. Now, there are also most 
certainly a hell lot of perf improvement we can do in MINA itself, but 
this is not really related to a pattern.

Remember that a pattern by itself is not a guarantee for better 
performance. It's mainly a better way to decouple concerns and allow a 
better architecture.




-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: FtpServer thread model?

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Wed, Oct 29, 2008 at 11:14 PM, Emmanuel Lecharny <el...@gmail.com> wrote:
> Just remember the moto : first make it work, then make it fast :)
>
> I think that we are still on phase 1, aren't we ? ;)

We sure are.

/niklas

Re: FtpServer thread model?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Niklas Gustavsson wrote:
> On Wed, Oct 29, 2008 at 3:27 AM, Erix Yao <er...@gmail.com> wrote:
>   
>> I see. But according to Scalable Java I/O, I think using a reactor pattern
>> and SEDA will help improve the performance.
>>     
>
> As Emmanuel pointed out, MINA is based on the reactor pattern. As for
> SEDA, I'm not convinced that it's a good choice for us. Partly because
> of the increased complexity and partly because I think it would lead
> to increased latency. But, we need to measure, measure, measure before
> we know anything. At this point, I haven't done any performance
> optimizations at all. Premature optimizations and all that :-)
>   
Just remember the moto : first make it work, then make it fast :)

I think that we are still on phase 1, aren't we ? ;)

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: FtpServer thread model?

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Wed, Oct 29, 2008 at 3:27 AM, Erix Yao <er...@gmail.com> wrote:
> I see. But according to Scalable Java I/O, I think using a reactor pattern
> and SEDA will help improve the performance.

As Emmanuel pointed out, MINA is based on the reactor pattern. As for
SEDA, I'm not convinced that it's a good choice for us. Partly because
of the increased complexity and partly because I think it would lead
to increased latency. But, we need to measure, measure, measure before
we know anything. At this point, I haven't done any performance
optimizations at all. Premature optimizations and all that :-)

> As far as I know, the Listener interface is acting as a reactor, using
> NioAcceptor provided by MINA, but the rest of the work except the network
> handling are excuted in the thread pool. But the excution model is still the
> first model in Scalable Java I/O. Any improvements can be done?

The only thing I know is that lots of improvements can be done :-)

/niklas

Re: FtpServer thread model?

Posted by Erix Yao <er...@gmail.com>.
I see. But according to Scalable Java I/O, I think using a reactor pattern
and SEDA will help improve the performance.
As far as I know, the Listener interface is acting as a reactor, using
NioAcceptor provided by MINA, but the rest of the work except the network
handling are excuted in the thread pool. But the excution model is still the
first model in Scalable Java I/O. Any improvements can be done?

Re: FtpServer thread model?

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Tue, Oct 28, 2008 at 8:08 AM, Erix Yao <er...@gmail.com> wrote:
> What is the thread model of the ftp server ?
> Is it running in only one thread except the mina's thread pool?

Yes.

> I have an idea, that after the command has been analyzed, the excution of
> each command should be thrown into a excutor or a thread pool, using
> asynchrouse mechanism to enhance the throughout of the server.
> How do you think so ?

That's pretty much what will already happen. The ExecutorFilter we
insert before the handler (and also before the decoder) does mean that
the command will run independent of the network handling, in a thread
pool. Is this also what you mean or would you like to enhance this
model somehow? Please note that we have so far done very limited
benchmarking of FtpServer. We do however plan to run extensive
performance tests after 1.0 is out. After those we might find that we
can enhance the current model.

/niklas