gonzalo diethelm wrote:
Implementing everything with a single thread means that we use one
selector to handle the accept and the session. possible, but then, why
using MINA ? You can do that with a simple SocketServer, a selector and
a few glue around it.

The idea with MINA was to create a scalable NIO framework, easy enough
to use. Doing that on a single thread would kill the initial design...
...
Well, it's impossible to design a system which fits all the needs. Also
I don't really see the problem you are trying to fix with this 'one
thread to manage everything'. You are the first person on the mailing
list in 3 years to expose such a need. Do you have some technical
constraints that limit you to using only one thread ?

More than a need, I am trying to grasp the design objectives for MINA. I come 
from a C++ experience, where sometimes you will want to choose to have 
everything running in one single thread, doing all the multiplexing yourself, 
and sometimes you will want to use threads, maybe associating one thread with 
one connection, or pooling your threads because their creation and destruction 
can be expensive.
Basically, MINA was designed as a SEDA based framework (even if this target has been lost in the meantime, somehow ...). Sicne then, it has aevolved a bit.

The internal design was done in otder to decouple the concerns as much as possible. So you have a thread handling incoming connections, N processor, each of them having a selector, to process the incoming and outgoing events (read and write) each processor being associated with a thread, and as you can add an Executor filter in the chain, you can also have N threads to handle the load (this construction is the only remaining SEDA flavor in the framework).

All those threads are intended to offer a better scalability, but that has still to be proven :)

But more than that, and many persons are questioning the scalability, it's a damn simple framework when it comes to quickly design a server, letting you to focus on what matters : the codec and the handler.

At some point in the future, though, considering other aspects than ease of use, we may have to tune the design to allow one user to select the best solution. We are far from this point ... :/
I have used the C++ ACE framework in the past, and it does give the designer 
the choice regarding which threading model to follow. Mind you, I am NOT saying 
that ACE is better than MINA, or that C++ is better than Java. I WANT to use 
MINA; I also would like to learn the extent of my choices / constraints set by 
the framework, and the reasons why it provides those choices /constraints, and 
not others.

I hope I brought a bit of light in the dark :)

fell free to ask more !

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


Reply via email to