tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: two questions about the session timeout in tomcat
Date Fri, 07 Oct 2011 14:23:37 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bill,

On 10/6/2011 7:20 PM, Bill Wang wrote:
> Recently one of Tomcat application has performance issue, which get
> slow respond with high sessions.

Can you give us some numbers? At what point do things slow down, and
by how much do they slow down?

> One team member recommend me to adjust the  session timeout from 60
> minutes to 30 minutes.  I will do that, but before change it, I'd
> like to understand how the performance related with the expire
> session timeout.
> 
> <session-timeout>60</session-timeout>

I'm not sure performance will change at all when changing the session
timeout. Tomcat runs session-expiration tasks periodically, and the
performance of that has more to do with the number of total sessions
than the timeout itself.

If you have lots of sessions that must timeout instead of being
explicitly invalidated (i.e. people close their browsers instead of
logging-out), then you will have a lot of wasted memory that may
prevent the garbage collector from working efficiently. It's best to
destroy sessions as soon as they are not needed, so short session
timeouts can help with that. On the other hand, you want to give users
a reasonable amount of time to get a cup of coffee, etc. without
forcing them to re-login every time.

You'll have to determine what is an appropriate amount of time for
your users.

There is another option: selectively extend the session timeout for
certain sessions, or for certain operations. If a user enters a flow
that is expected to take a long time or the consequences of having the
session time out are frustrating (i.e. you have to re-enter tons of
data), you can change the session timeout for that one session to be
longer than the default. When the flow is over, you can re-set it back
to the default. We do that for a number of tasks in our webapp, for
instance.

> Second, currently I monitor the session count by login the admin
> interface,

Do you mean using the "manager" app?

> the manual way is not efficiency, can I run some commands to get
> the sessions number? With that I can set a cronjob and generate the
> session report easily.

If you have the manager app deployed, you can use the text or XML
interfaces from the command-line instead of the HTML interface. Simple
use of wget, curl, etc. should allow you to do this kind of thing.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6PC2gACgkQ9CaO5/Lv0PBo3gCgvV7dAylXSz1vz3jRX2jmr1lE
E9kAoMKnHUgOC5MEx31lz121tXT1aV8J
=CGz3
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message