• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat sessions

 
Pooja Mehta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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?


Thank you,
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pooja Mehta wrote:Hi,

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

See the javax.servlet.http.HttpSession interface JavaDocs

Bill


 
Pooja Mehta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you William for your reply.

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).

Please help me understand as I'm not so much aware of session handling and I'm not an expert in programming.



Regards,
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34073
335
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Bill
 
Pooja Mehta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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?


Regards,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic