On Wed, Dec 14, 2011 at 2:10 PM, Emmanuel Lecharny <elecha...@gmail.com> wrote:
> Hi,
>
> we discussed off line with Julien about Idle session support. Here is a sum
> up of what we talked about, and we may have to make some choice.
>
> First of all, it's absolutely mandatory to be able to manage idle sessions,
> in order to kill them, for instance. So we must offer a mechanism by which
> the application developer can handle this.
>
> In MINA 2, if a session is idle for more than a given amount of time
> (configurable), either on read, write or both, then an event is fired on the
> chain, up to the handler.
>
> This is done in the selector loop. The problem with this approach is that
> it's extremely expensive, and most certainly the worst possible solution to
> deal with idle sessions, when it comes to manage hundred or thousands of
> idle sessions. Another issue is that because it's really awfully costly, the
> quantum between two detection is one second. Last, not least, this one
> second os not very precise for a session, as if the session was created
> between two checks, then the delay between the last check and the session
> creation adds up. In other words, we can wait up to one more second to
> detect that a session is idle.
>
> We have some better ideas :
> - first, not all the sessions can be controlled. We need a list of session
> registered for an idle check
> - second, and more important, we must have a dedicated thread
> - last, not least, this mechanism should be optional. Ie, when the session
> is created, it's up to the application to tell that the session must be
> checked for idleness, by registering it into the idleController.
>
> We should also allow a more fine grained control, like 100ms, and even, it
> could be made configurable.
>
> thoughts ?
>

The current mechanism is pretty wrong, and cannot resolve idle time
lesser than 1sec.

We should do something not mandatory and efficient, I'm thinking about
a time-period HashMap of list of session to check (we should update it
for each session I/O events), and a timer checking every X ms the list
of session in the map for this time index.
Well I 'll try to clear my mind a propose a design.

Julien

Reply via email to