when should you set maxInactivityDuration=0?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

when should you set maxInactivityDuration=0?

Stephen Pietrowicz-2
Some time ago I noticed a dropped connection, and saw an error along the lines of "Channel was inactive for too long".   I made note of various folks here and elsewhere saying that the way to prevent this from happening is adding

wireFormat.maxInactivityDuration=0

So now I've got the time to look into this, and after reading further into the documentation, I'm not sure under which circumstances I should change this parameter at all.   The inactivity threads are set up in such a way that if no messages come across after the default (30000 ms) time, a message is sent to keep the connection active.   If there's no activity because of a broken socket, the "Channel was inactive for too long" exception gets issued.

I'm really hesitant to add this to the URL since I've only seen this error once.   It used to be that sending really long messages would make this exception come up, but that was fixed several versions ago.    

Under what circumstances would you set this parameter equal to zero?

Steve
Reply | Threaded
Open this post in threaded view
|

Re: when should you set maxInactivityDuration=0?

artnaseef
Setting maxInactivityDuration to 0 disables the activity monitor.  The advantages include reducing the overhead when there are large numbers of idle connections, and eliminating forced disconnects on slow connections that are otherwise active.

These seem like minor advantages.  The overhead is really low, and can be reduced by increasing the inactivity duration.  And it is valuable to disconnect connections that are really inactive.

Note that - just because there is a setting, doesn't mean there's really a "good" reason to use it.  Often settings are added as a means to try different approaches, or to allow for backward compatibility when new features are added.  They may even be only useful when troubleshooting a problem.

Hope this helps.
Reply | Threaded
Open this post in threaded view
|

Re: when should you set maxInactivityDuration=0?

Tim Bain
As Art says, the advantages are minor, and the disadvantages (such as the
inability to detect disconnections due to network problems) are not.  So
your default should be to use a non-zero value unless you come up with a
clear reason why you think a value of zero would be better for you, and
clearly you don't have one of those at the moment.

If you start getting the "Channel was inactive for too long" log lines
regularly, then you'll need to investigate what's going on in your network
or on your brokers to figure out why keep-alives aren't making it to their
destinations in time.  Contrary to whatever you may have read, the solution
to seeing those log lines is to figure out what's going wrong to cause them
in the first place, not to turn them off and assume that everything's
fine.  But only if you're seeing them regularly; if you saw this once a
long time ago, I wouldn't worry about it -- once in a blue moon is probably
just a network hiccup, and you only need to worry about it when it becomes
a pattern.

Tim

On Tue, Dec 2, 2014 at 12:49 PM, artnaseef <[hidden email]> wrote:

> Setting maxInactivityDuration to 0 disables the activity monitor.  The
> advantages include reducing the overhead when there are large numbers of
> idle connections, and eliminating forced disconnects on slow connections
> that are otherwise active.
>
> These seem like minor advantages.  The overhead is really low, and can be
> reduced by increasing the inactivity duration.  And it is valuable to
> disconnect connections that are really inactive.
>
> Note that - just because there is a setting, doesn't mean there's really a
> "good" reason to use it.  Often settings are added as a means to try
> different approaches, or to allow for backward compatibility when new
> features are added.  They may even be only useful when troubleshooting a
> problem.
>
> Hope this helps.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/when-should-you-set-maxInactivityDuration-0-tp4688281p4688289.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: when should you set maxInactivityDuration=0?

artnaseef
Good point Tim.  One example where those log lines is important to diagnose - when a broker is running out of memory (usually due to a slow-consumer problem).
Reply | Threaded
Open this post in threaded view
|

Re: when should you set maxInactivityDuration=0?

Stephen Pietrowicz-2
Thanks!

I think I'll leave everything as it is.  Given what's going on with this particular network environment, I'd wager it was a hiccup.  I haven't seen this error since then.

Steve
Reply | Threaded
Open this post in threaded view
|

Re: when should you set maxInactivityDuration=0?

lichtin
In reply to this post by artnaseef
Hi Arthur

I'm curious as to why "broker running out of memory" correlates with "Channel was inactive for too long"?
Once in a while I see a flurry of these log lines, without being able to figure out their root cause.

artnaseef wrote
Good point Tim.  One example where those log lines is important to diagnose - when a broker is running out of memory (usually due to a slow-consumer problem).