Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the HttpSession data stored?

HttpSession is a high level interface built on top of cookies and url-rewriting, which means that there is only a session ID is stored in client side and the data associated with it is stored in server side.

Where is the HttpSession data actually stored in the server side? In the JVM memory or somewhere else? Can I change the place where to store it, e.g. save them into an in-memory database?

If it's not in a database, is there any concurrency problem when many clients work on the same session data at the same time?

like image 860
cn1h Avatar asked Oct 25 '11 06:10

cn1h


People also ask

How do I find HttpSession?

How to get the HttpSession object ? The HttpServletRequest interface provides two methods to get the object of HttpSession: public HttpSession getSession():Returns the current session associated with this request, or if the request does not have a session, creates one.

Where are session attributes stored?

For completed session searches, session attributes are stored in the [CanisterSummary] section of the request, where they are automatically indexed.

How is HttpSession session tracking carried out?

The HttpSession interface is used to create a session between the client and server. The session is created between an HTTP Client and an HTTP Server by the servlet container using this interface. The Java Web Server keeps track of each user on the site by creating a session object of interface HttpSession.

Where is a session created and stored?

Structure of a session The session can be stored on the server, or on the client. If it's on the client, it will be stored by the browser, most likely in cookies and if it is stored on the server, the session ids are created and managed by the server.


1 Answers

It's up to the server where to store session data; the ones I'm familiar with allow some level of configuration as to where (disk, DB, memory, ...) session data is stored.

Different clients shouldn't be working on the same session data--session data is per-client. That said, a single client (like a web browser) could have multiple windows or tabs open, and yes, that can cause issues.

Clustering adds a layer of complexity/headache as session data is shared between servers.

like image 108
Dave Newton Avatar answered Nov 09 '22 03:11

Dave Newton