user217631
user217631

Reputation: 1308

session persistence

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

Upvotes: 0

Views: 446

Answers (2)

Adam Franco
Adam Franco

Reputation: 85778

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.

Upvotes: 2

jldupont
jldupont

Reputation: 96716

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

Upvotes: 1

Related Questions