tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: active session counting, redux
Date Thu, 07 Aug 2003 18:49:42 GMT


>every time the list increases, it increases by 2 - one with a long
>alphanumeric session id, and one with a blank one (and i don't know why
>that is, either, and need to figure it out as well). after 5 minutes
>(the timeout) the list decreases by 1 - the blank one. so over time the
>list is not getting pared down. the listener is only removing the
>session with a "blank" id from the list.


>what i don't know is, are these sessions also staying in memory? oh,
>btw, that is the objective of this entire exercise. how's that for
>burying the lead?

Tomcat destroys the sessions when they timeout.  At that time, unless
you have some sort of static/singleton object holding references to
them, they will be garbage-collected.

>as a side question, where does tomcat store sessions? (i am not
>configuring a PersistentManager to store them in the db.)

In memory when they're active.  On file (SESSIONS.ser in the work
directory for the webapp) by default when restarting.  The session
manager is a configurable and extensible component, like others in
tomcat, so you can modify this behavior.

>my overarching design goal: are sessions dragging down the site's
>performance. side goal: display things like "number of users currently
>on the site", on the site.

To see session statistics for yourself, you can use tomcat's manager app
sessions command.  See

If you want to display this information to users, you will need a
listener.  I prefer a simple HttpSessionListener keeping a static set of
session IDs, and that's it.  That implementation always starts from zero
when the server restarts, which may be inaccurate if any sessions are
persisted and then restored when the server is restarted, but it works
for me.

Yoav Shapira

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

View raw message