Is it possible to configure maxActiveSessions and maxInactiveInterval?

1,057 views
Skip to first unread message

Christopher Tiwald

unread,
Dec 8, 2011, 6:59:34 PM12/8/11
to memcached-se...@googlegroups.com
I'm attempting to configure the maxActiveSessions and
maxInactiveInterval of msm for my application, but am not sure what
the correct method is to change them, if it's possible at all. I tried
via context.xml, but the change didn't appear to take:

<Context path="" docBase="" debug="0" reloadable="false"
allowLinking="true" workDir="/usr/local/tomcatwork">
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
   memcachedNodes="n1:memcached1:11211 n2:memcached2:11211
n3:memcached3:11211 n4:memcached4:11211"
   maxActiveSessions="25000"
   maxInactiveInterval="900"
   requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"
   />

Is it possible to change these? If so, what is the correct method?

Thanks,
Christopher Tiwald

Martin Grotzke

unread,
Dec 10, 2011, 3:47:29 PM12/10/11
to memcached-se...@googlegroups.com
Hi Christopher,

the maxActiveSessions should be configurable like in your configuration,
I also just checked this and it works. If it does not for you we have to
dig deeper.

I also just checked the maxInactiveInterval setting and saw that it's
overwritten (in manager.setContainer(Context), which is called after
setMaxInactiveInterval) with the session timeout value. The
implementation in msm does the same as the stock tomcat StandardManager.
To achive what you want you should configure the session-timeout in your
web.xml.
If you'd really prefer to set the maxInactiveInterval in your manager
configuration I (we) could discuss this with the tomcat devs.

Cheers,
Martin

signature.asc

Christopher Tiwald

unread,
Jan 30, 2012, 1:17:46 PM1/30/12
to memcached-session-manager
On Dec 10 2011, 3:47 pm, Martin Grotzke
<martin.grot...@googlemail.com> wrote:
> I also just checked the maxInactiveInterval setting and saw that it's
> overwritten (in manager.setContainer(Context), which is called after
> setMaxInactiveInterval) with the session timeout value. The
> implementation in msm does the same as the stock tomcat StandardManager.
> To achive what you want you should configure the session-timeout in your
> web.xml.

Apologies for the delayed response. That's interesting, but also
unexpected. Here's what I've observed:

1) Running tomcat 7.0.16 (and the affiliated memcached-session-manager
libraries) on RHEL 6.1.
2) When no maxActiveSessions variable is configured, the machines ramp
up to, say, 35000 active sessions over the course of two hours. The
number of sessions appears to monotonically increase. At least I
haven't noticed it drop during this ramp up period. Similarly, the
number of loaded classes increases monotonically.
3) After 2 hours, the total number of activeSessions stabilizes.
Thousands of classes are unloaded every MarkSweep GC, and the machine
stays stable.

The total loaded classes and memory footprint of the JVM process
generally seem pegged to the number of activeSessions, a behavior that
wasn't as obvious on tomcat 6.0.18 running an identical copy of the
application. To test, I've been trying to bring about that stabilizing
point earlier. I thought I might be able to by reducing
maxInactiveInterval (which appears to be 2 hrs by default). In
retrospect, that sounds like the wrong thing to configure. I think I'm
just trying to increase the expiration rate, but am not quite sure how
to go about doing it.

Martin Grotzke

unread,
Jan 30, 2012, 5:26:53 PM1/30/12
to memcached-se...@googlegroups.com
On 01/30/2012 07:17 PM, Christopher Tiwald wrote:
> On Dec 10 2011, 3:47 pm, Martin Grotzke
> <martin.grot...@googlemail.com> wrote:
>> I also just checked the maxInactiveInterval setting and saw that it's
>> overwritten (in manager.setContainer(Context), which is called after
>> setMaxInactiveInterval) with the session timeout value. The
>> implementation in msm does the same as the stock tomcat StandardManager.
>> To achive what you want you should configure the session-timeout in your
>> web.xml.
>
> Apologies for the delayed response. That's interesting, but also
> unexpected. Here's what I've observed:
>
> 1) Running tomcat 7.0.16 (and the affiliated memcached-session-manager
> libraries) on RHEL 6.1.
> 2) When no maxActiveSessions variable is configured, the machines ramp
> up to, say, 35000 active sessions over the course of two hours.
How do you determine this? Via jmx activeSessions attribute of the
manager? How does the attribute "expiredSessions" change over time?

> The
> number of sessions appears to monotonically increase. At least I
> haven't noticed it drop during this ramp up period. Similarly, the
> number of loaded classes increases monotonically.
> 3) After 2 hours, the total number of activeSessions stabilizes.
> Thousands of classes are unloaded every MarkSweep GC, and the machine
> stays stable.
>
> The total loaded classes and memory footprint of the JVM process
> generally seem pegged to the number of activeSessions, a behavior that
> wasn't as obvious on tomcat 6.0.18 running an identical copy of the
> application. To test, I've been trying to bring about that stabilizing
> point earlier. I thought I might be able to by reducing
> maxInactiveInterval (which appears to be 2 hrs by default).

Default session timout is 30 minutes (in StandardContext: private int
sessionTimeout = 30;).

If your sessions time out after 2 hours instead of 30 minutes there's
s.th. wrong with your setup.

The number of loaded classes increasing together with the number of
active sessions sounds weird (also unloading of thousands of classes).

Do you know / can you find out which classes are unloaded?
Does this also happen, when you don't use jconsole or stuff (see
http://stackoverflow.com/questions/3873635/java-concurrentmarksweep-garbage-collector-not-removing-all-garbage)?

Have the latest jvm and tomcat versions running?

Do you experience the same also without msm=


> In
> retrospect, that sounds like the wrong thing to configure. I think I'm
> just trying to increase the expiration rate, but am not quite sure how
> to go about doing it.

First I'd try to find out why the number of active sessions and loaded
classes is increasing that much.


Cheers,
Martin

signature.asc
Reply all
Reply to author
Forward
0 new messages