Latest downloads
Projects
Documentation
Resources
Community
Upcoming
|
MINA 3.0 design
 | Due to the way Confluence modifies the pages when it opens it in the RichText editor, the presentation is totally screwed up when saving in this mode.
Until we find a way to keep the cool HTML presentation we currently have, please don't save this page if you have edited it on Rich Text format. Try to edit it in Wiki Markup instead.
Thanks ! |
Introduction
This page is intended to be a place open for discussion about MINA 3.0 features. Comments and ideas are very welcome !
Mina 3.0 design and expected features
Some thoughts about what I see important to have in MINA 3.0...
selectors usage
We should be able to define the number of selectors to use, and to define what they will be used for. For instance, atm, we have a selector in the Acceptor, plus a selector per Processor. This is not necessarily the best solution.
Chain
The current chain implemention is cumbersome. We would like to have something easier to manipulate, and also easier to debug.
- the chain should be optionally dynamic : a session can add a new filter in the chain whenever needed
- however, it should be possible to change the global chain without breaking the processing.
ede : Tricky : will this affect only new sessions or started sessions too ?
ele : All the sessions. I don't see a clear and easy to implement mechanism to protect the current sessions from such a change. Npw, as the chain is just a structure used to keep a list of filter to go through, it should be easy to guarantee that a session requesting the next filter is not affected by the change.
- we should have one chain for incoming messages, and another one for outgoing messages
- a chain may not be a list of filters. It can be a graph
vrm :
If we can keep the API simple enough, why not.
ede : This imho will greatly increase the complexity of the chain ( cycle detection mechanism ?)
ele :Yes, this is probably not the most simple thing to implement ...
Filters
- we should define two interfaces for filters : IngoingFilter and OutgoingFilter. They will expose the methods to process ingoing and outgoing messages
vrm :
The question is where to put sessionOpen/Closed/Idle in a two chains model.
ele :
As the session is managed at the upper level, such messages must be propagated from the processor to the handler, not the way around.
ede : So sessionOpen/Closed/Idle should be added to IncomingFilter. What about ExceptionCaught event ?
ele : ExceptionCaught event are not supposed to be incoming event, AFAIK...
- The SSL filter should not be a filter at all: it's a part of the underlying protocol, and the handshake should be done previously to any kind of exchange. Another option would be to move this filter in the first position in the chain.
Session
- we should have two kind of sessions : stateful and stateless. Sometime, we don't need to store any kind of information in a session
vrm :
If we create the HashMap on first additon, where is the gain ?
ele :
If a session is stateful, not creating a structure to store data which won't be added will eat less memory. We can create this container only when necessary, obviously when the session is created, but then if we have two kind of session classes, we will immediately know when to create this container.
vrm :
How to manage idle time with a stateless IoSession ?
- session should not necessarily be associated with a processor.
vrm :
+1
- If a session is stateful, then we should attach the data to the channel instead of creating a map for that
vrm :
Can you say more about that, where is the gain ?
ele :
Simplicity : no need to define a container which already exists, as you can attach Objects to the SelectionKey.
Jean-François Arcand has blogged about how dangerous it is : http://weblogs.java.net/blog/jfarcand/archive/2006/06/tricks_and_tips.html, but this is dangerous *if* one code its own server without dealing with session expiration. As we are defining a framework, this is not a problem for us.
vrm :
So you want to trash all the session hashmap and just give access to the attachement of an Object at the NIO level ?
- A session must be attached to an acceptor, allowing more than one chain if the acceptor is to deal with more than one single SocketServer
vrm :
We need to find away for running more than 1 kind of port/protocol with
the same set of Thread/Executors. I suppose it would be interesting
for ADS. On my side I run servers with 3 or 4 SocketAcceptors for
different protocols, somthing like 10 SocketConnectors for different
protocols.
Perfs aren't an issue for me actually, but it can change.
ele :
ADS deal with LDAP, DNS, Kerberos, Ntp, Dhcp. Atm, we create one NioAcceptor per protocol, a bit overkilling (not to mention that we have as many NioProcessors...
ele :
Moreover, I think that the name we are using is incorrect. An acceptor or a connector are not services, but transports. They just take care of incoming connections, sessions creation and data transfert. The real service is the implemented protocol, which is handler by the session's chain, all the filters and the handler. If we also combine the configuration with the service, we are golden.
MINA 3.0 must reflect this.
- It should be possible to close a session on a specific message reception, without having to add a listener for that
ede : use case ?
ele :Atm, if one want to close a session in a filter (black list) or in the handler, it's a bit tricky, as a listener must be added in order to close the session. This mechanism is cumbersome
codec
- we don't have stateful or stateless codecs. We should distinguish the two kinds of codec someone can use.
vrm :
+1
- we should define a collection of existing codecs
vrm :
For that we need a standard way of doing a codec on the Pojo side. I'm sure LDAP pojo for ADs are very different (and got different dependencies) of the one of Asyncweb or Vysper.
ele :
They are very different. The codec should define not only the encoder and the decoder, but the associated POJOs.
- as we can handle more than one protocol, we must add a demuxingCodec which point to the next filter, conditionally
vrm :
Here the graph ? :)
ele :
Yes
Buffer
General
This is just a starting point ...
vrm :
We need at first a great test platform for testing the different
protocols and implementation ideas (Thread/Selector/Channel
strategies). So we make choice based on facts for the engine.
|