tags:

views:

39

answers:

2

do sessions get persisted and retrieved when you restart a web server/application server?

+1  A: 

(Assuming here that the question refers to a "web" server)

The short answer is no: of course, you could have a plugin/module for your favorite framework to do that.

The other reason why this is no general practice: if a server dies, the user might be directed to another server (if possible) and in this case, you don't want to bring-back stale session information.

Of course I can't comment further not having more details.... please beef-up your question.

jldupont
does my answer satisfy you?
jldupont
A: 

Each web-server and runtime environment has its own (and often several) ways of storing session data. Common session stores are temporary files, databases, distributed caches such as memcached, and web-server memory.

As an example, by default PHP stores its session information in temporary files, making existing sessions available after a server restart.

Storing session information in a database or memcache will likewise result in sessions persisting after web-server restart, but with the advantage of them being available to a cluster of web-servers.

Some platforms or configurations may store the session data in web-server memory or a slab of memory shared by all web-server process. This sort of configuration will result in the session data being dropped when the web-server process is killed.

Adam Franco

related questions