aspose file tools*
The moose likes Performance and the fly likes Tomcat sessions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Tomcat sessions" Watch "Tomcat sessions" New topic
Author

Tomcat sessions

Pooja Mehta
Greenhorn

Joined: May 30, 2013
Posts: 4
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

Joined: Mar 22, 2000
Posts: 12805
    
    5
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

Joined: May 30, 2013
Posts: 4
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

Joined: May 26, 2003
Posts: 30762
    
156

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12805
    
    5
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

Joined: May 30, 2013
Posts: 4
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,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat sessions