What is a session id – TroubleinthepeaceS

Session, Cookie, Cache perhaps these are the 3 concepts that are mentioned frequently for programmers. When I first started to practice web development, I often confused these concepts, I didn’t know when. then I should use session, when should I use cookies, what is cache used for…. Once there was only a small function to save the user’s action history on the browser, I put it in the Session and threw it all for my mentor to review, and of course, I got scolded very badly…. “Do you know what a session is?” “Do you know what a cookie is?”, “Do you know that stuffing everything into a session like this will eat up a lot of server memory?”….. Yes I didn’t know anything about those concepts at all. , I use it indiscriminately and only care so that the function I make can run without caring what I use is for the right purpose or not? really make full use of it, and is it really optimal? Actually…you’re young, ALWAYS GO BECAUSE LIFE ALLOWS. The more wrong, the longer you remember, the more painful, the more you miss life. Let’s learn these concepts together


A session is also known as a session. In computer science, It’s simply a way of communicating between a client (here a web browser or an app on your device) and a server. A session starts when the client sends a request to the server, it persists from page to page in the application and only ends when the timeout expires or when you close the application. The session value will be stored in a file on the server. Because of this, if you use session indiscriminately (like I did) it will cause the server to save a lot. Especially if that app has several million users, for example… that’s horrible. Normally, we should only store temporary information in the session such as login information, information about products in the shopping cart (for e-commerce websites)…

You are viewing: What is a session id

Each session will be allocated a unique identifier SessionID. When you end a session and start a new one, you will of course be given a different SessionID than before.

See also: What is the number of P-pole pairs – Two Questions about the number of motor pole pairs

Have you ever asked the question that “after creating a session stored on several servers, how does the system know which client the session belongs to?”. It’s easy, for each session created, they will also create a cookie file stored in your browser for that session. So just compare the cookie file on the client side sent to the server and the session file stored on the server to get an idea (ahaha)


Like sessions, cookies are also used to store temporary information. Because of this, I always get confused between the two concepts (it’s better now). Only thing, the cookie file will be transmitted from the server to the browser and stored on your computer when you access the application. Every time the user downloads the application, the browser will send a cookie to notify the application. about your previous activity


And a very important thing is to never store important, highly secure information in cookies, it can completely be modified and stolen, even can take advantage of this to attack. your web site. (Are you completely using chrome’s “editthiscookie” extension to change cookies? :v )

Each cookie usually has a certain timeout predefined by the programmer. The information stored in cookies for example, user behavior, frequency of website visits, access time… All of these are temporary information and are stored for a short period of time.

See also: What is 2-Phase Electricity – What’s the Difference Between 1-Phase, 2-Phase, 3-Phase Electricity


Cache is cache memory, a temporary storage area in the computer. It differs from cookies in that the information stored here is web documents, images, videos, HTML, etc. A fairly smart invention of people in this information technology era to reduce bandwidth load, increase loading speed, access the web. The cache consists of a copy of the Web page’s bits stored on the hard drive. The browser loads bits when you visit a certain Web page, access speed will be faster and save bandwidth when “downloading”. The cache will be stored until you manually delete it. So don’t be foolish to delete the cache when you don’t need it (I removed CCleaner on the computer a long time ago (yaoming) )

The cache is where your browser stores the copied files so you don’t have to download them again when browsing the web. VD. The first time you visit a website with a lot of images, it takes about 1 second to load the page (probably due to lack of network), But thanks to the cache, the time it takes for you to load the page can be almost It’s always okay right away.


Above is all the information about sessions, cookies and caches I share with you, hope this article will be useful for those who are new to web development and never make the same mistake as me back then. okay =))

Source: internet

About Troubleinthepeace

Troubleinthepeace specializing in synthesizing information about daily life activities

View all posts by Troubleinthepeace →

Trả lời

Email của bạn sẽ không được hiển thị công khai.