While running a load test on Tomcat on a linux server, say with 100 users, I'm able to see more than 250 sessions. Does the active Sessions/maxActive correspond to the number of users logged in?
I know that a user can open multiple connections to the server, just as how different browsers do. But why active sessions indicator always exceeds the number of concurrent users of the load test?
The number of active sessions is from the number of sessionIDs which the server will recognize and has nothing to do with any user logging in mechanism you may have programmed.
Think about it. It has to be this way because sessions live beyond a single request/response cycle. After sending a response, the server has no way of knowing if the session can be dropped unless:
1. you program a call to session invalidate() -or-
2. the session inactive interval is exceeded
Pooja Mehta wrote: doesn't the session end when the user logs off or closes the browser? In our load test, we are clearing cookies and cache after every iteration (which consists of logout).
Logging off and closing the browser are different. When you close the browser,t he server has no way of knowing you did that. Therefore, the session is still there until it times out. Similarly, the server doesn't know you are clearing the cookies and cache in the browser.
If you an actual logout button/link your page that goes to the server and calls session.invalidate(), it should be removing the session.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Pooja Mehta wrote:
What is not clear to me is, doesn't the session end when the user logs off or closes the browser? In our load test, we are clearing cookies and cache after every iteration (which consists of logout).
The servlet container has no concept of "logout" your code for the user logout must invalidate the HttpSession directly.
Joined: May 30, 2013
Thank you for your reply. It's little clear now.
In my understanding, a logout should/must invalidate the session. In my case, all the users are logging out, before starting a new iteration.
Does that mean, that the application logout is not invalidating the sessions?