Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

general
communitycreator

What is Session Tracking?

Mohammad Razi ul Haq

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Session Tracking tracks a user’s requests and maintains their state. It is a mechanism used to store information on specific users and in order to recognize these user’s requests when they connect to the web server.

HTTP is a stateless protocol where each request to the server is treated like a new request. However, there are ways to maintain the data for a particular user in order to serve them specific content.

There are several ways to track user sessions including cookies, URL rewriting, and hidden form fields.

If session tracking is not used, request 2 is treated as a new request without the server recognizing that it is from the same user.

Cookies

A cookie is a unique ID assigned to clients when they first visit a website. Whenever this client connects to the server again, it will send the cookie that was given earlier by the server. The server will then recognize that it is the same user.

Hidden form fields

Hidden form fields are used to insert information, e.g., a unique ID when sending a request to the server. These fields are not directly visible to the user, but each time a request is sent to the server, the unique ID is also sent as a part of the request, enabling the server to recognize the client.

URL rewriting

URL rewriting adds a unique session ID in the URL itself when it sends a request to the server. Since the session ID is part of the URL, it is directly visible to users. For example:

www.educative.io/edpresso;sessionid=123456

RELATED TAGS

general
communitycreator

CONTRIBUTOR

Mohammad Razi ul Haq

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring