mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Vermillard <jvermill...@gmail.com>
Subject [MINA 3.0] Idle management
Date Tue, 24 Jan 2012 11:53:24 GMT

Actually in MINA1/2 the idle is computed each second by scanning *all*
session of a service. If you have a large number of session, it could
create some student latency in the selector loop.

For trying to keep the scanning a bit more lightweight, I was thinking
about another solution :

For each session read/write event :

* we calculate what is the supposed future idle date
* we round it at the next second
* we store a reference to this session in a per Selector map like :
Map<long /*timestamp*/, Set<IoSession>> , the long is the timestamp of
the idle time (rounded at the second), this Map is an index poiting to
the list of session possibly Idle by time range
* we cleanup the previous idle reference (could be stored in the session)

Idle checker thread :

* for each second, look in the Map the session possibly idle for this timestamp
* check the session and fire idle event if needed
* delete the map entry

This algorithm will add a bit more pressure at the R/W event, but will
probably perform a lot better with a huge amount of slow session. the
idle event ill come from another thread and won't be synched with r/w

I'll try to kick-in an implementation of the two solution as plugable
filters and try to decide which one is the best idea.


View raw message