You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Juan Palacios <jp...@atlassian.com> on 2018/03/25 23:55:55 UTC
Detecting non-idle but non-active either sessions
Hi
I was hoping I could get some support analysing a change I'd like to make
to our MINA integration.
Our application limits the total number of sessions it will open
concurrently to keep high load from hurting our performance.
However we've noticed recently that some of our users are configuring
ControlPersist + KeepAlive settings for their clients. This keeps sessions
alive for extended periods of time (we've seen sessions going for days).
I was wondering if there was a way of detecting sessions which are
*only* producing
keep alive traffic and terminating them after a certain period of time. The
goal is to prevent these users from exhausting the pool of available
sessions.
Thanks
Re: Detecting non-idle but non-active either sessions
Posted by Jonathan Valliere <jo...@emoten.com>.
Are you referring to TCP sockets or some kind of protocol over TCP? In
MINA idle and non-active are same thing. Either data is received on the
socket or not. If data isn’t received and the idle timer is configured,
then idle events are dispatched and the IoHandler can use that event to
take the next step; such as closing the session.
On Sun, Mar 25, 2018 at 7:55 PM, Juan Palacios <jp...@atlassian.com>
wrote:
> Hi
> I was hoping I could get some support analysing a change I'd like to make
> to our MINA integration.
>
> Our application limits the total number of sessions it will open
> concurrently to keep high load from hurting our performance.
>
> However we've noticed recently that some of our users are configuring
> ControlPersist + KeepAlive settings for their clients. This keeps sessions
> alive for extended periods of time (we've seen sessions going for days).
>
> I was wondering if there was a way of detecting sessions which are
> *only* producing
> keep alive traffic and terminating them after a certain period of time. The
> goal is to prevent these users from exhausting the pool of available
> sessions.
>
> Thanks
>
Re: Detecting non-idle but non-active either sessions
Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 26/03/2018 à 01:55, Juan Palacios a écrit :
> Hi
> I was hoping I could get some support analysing a change I'd like to make
> to our MINA integration.
>
> Our application limits the total number of sessions it will open
> concurrently to keep high load from hurting our performance.
>
> However we've noticed recently that some of our users are configuring
> ControlPersist + KeepAlive settings for their clients. This keeps sessions
> alive for extended periods of time (we've seen sessions going for days).
>
> I was wondering if there was a way of detecting sessions which are
> *only* producing
> keep alive traffic and terminating them after a certain period of time. The
> goal is to prevent these users from exhausting the pool of available
> sessions.
You can set a idle timeout that will trigger an event if a session is
idling for more than a given time, in IoSessionConfig :
/**
* Sets idle time for the specified type of idleness in seconds.
* @param status The status for which we want to set the idle time
(One of READER_IDLE,
* WRITER_IDLE or BOTH_IDLE)
* @param idleTime The time in second to set
*/
void setIdleTime(IdleStatus status, int idleTime);
Then the IoHandler interface has a method allowing you to manage an idle
session :
/**
* Invoked with the related {@link IdleStatus} when a connection
becomes idle.
* This method is not invoked if the transport type is UDP; it's a
known bug,
* and will be fixed in 2.0.
*
* @param session The idling session
* @param status The session's status
* @throws Exception If we get an exception while processing the
idle event
*/
void sessionIdle(IoSession session, IdleStatus status) throws Exception;
This event is generated when a sessin is idling more than the configured
TIEMOUT you set in the config.
--
Emmanuel Lecharny
Symas.com
directory.apache.org