0

A fundamental ZK session question

asked 2011-09-10 14:55:51 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Hi everyone,

I've set the session timeout in zk.xml to 1 hour.

That works fine so far.

I assume that ZK holds the session in the server's RAM and the next time the user visits the zk web application, it checks if more than 1 hour has passed or not. If more than 1 hour passed, it destroys the old session, if not, it loads the app with the data from the session.

Now, I was asking myself: If a user never comes back. Does that mean that the session never gets removed from RAM?

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2011-09-11 03:54:54 +0800

Bobzk gravatar image Bobzk
444 1 8

Valmar,

I think you'll find that timeout handling is a function of the web/application server (Tomcat/Jboss etc) and not part of ZK. So Tomcat says to itself - look this seesion has been inactive for more than the timeout limit - I'll terminate it.

So in short, no the session does not remain in RAM after the timeout.

Bobzk

link publish delete flag offensive edit

answered 2011-09-11 06:58:08 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Hm, I see. Thanks for your reply.

I was asking because there seems to be a memory issue in my ZK app.
For some reasons, RAM seems to become full after 2-3 days and then the server starts to allocate virtual memory on the harddisc. All the swapping between RAM and HDD then makes the CPU go up to 120% load which makes the server really slow.

A Tomcat restart solves this issue.

I thought there are some not-necessary sessions out there which need to be removed.

link publish delete flag offensive edit

answered 2011-09-11 07:15:13 +0800

Bobzk gravatar image Bobzk
444 1 8

Is your ZK app the only thing running on Tomcat?

Also, memory will go up as time passes but it all depends on what values you have set for various pools. Memory and pool allocation in Tomcat is a science in its own right (:-)

Generally the default allocations are never enough.

Have a look at PSIPROBE to see what sessions are active, what memory is in use etc. BUT remember psiprobe will use memory/resources, so I would not use it at a busy time - it may just tip your system over the limits and cause a problem - start during low usage and se how it goes and build it up to use during peek usage as you gain experience.

Lastly, I would (but only you know your application) return to the default timeout of 30 minutes. Do you really want transactions sitting around for 60 minutes after the last use? Holding memory? Maybe even go down to 15 minutes?

link publish delete flag offensive edit

answered 2011-09-11 09:23:20 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

updated 2011-09-11 09:23:34 +0800

Hm, I am starting to suspect some threads in my app to be stuck.
Started to observe that now.

I've also set a thread pool of 3000 since each user can fire up quite some threads (usually 2-10).

Regarding the timeout setting: Some users even want 24h sessions (and more). Is there a way to persist these session to a db so that RAM won't get filled up with these?

link publish delete flag offensive edit

answered 2011-09-11 21:01:37 +0800

RichardL gravatar image RichardL
768 4

Is the long session time required to allow users to come back to something (an email) they started composing a while ago? If so, maybe you could consider auto save on a timer, such as how Wordpress does it.

link publish delete flag offensive edit

answered 2011-09-12 06:34:59 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Nope, I want the user to be auto-logged in when they come back (unless they logged out explicitly last time).

link publish delete flag offensive edit

answered 2011-09-12 07:10:59 +0800

Bobzk gravatar image Bobzk
444 1 8

Then simply set a cookie - remove it when they logoff. Cookie can even hold the position in the application they were last at and you can recreate it.

link publish delete flag offensive edit

answered 2011-09-12 11:12:43 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

Hm, that's a good idea!
Thanks for the tip. I'll give it a try.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-09-10 14:55:51 +0800

Seen: 297 times

Last updated: Sep 12 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More