Internet Cookie

Hemant KumarHemant Kumar
2 min read

Hear the Cookie so many time do not share your cookie with anyone but you already never share your cookie with anyones already ๐Ÿ˜‚ good but on the internet world also you should also never share the your cookie to anyone mean to other site. So lets know first what it is

Cookie are small text to value Set-Cookie: = <cookie-name>=<cookie-value> date store on the user/client side which helps the server to know about the user and set the preference Cookie is store on the user/client browser.

So think what we if donโ€™t use cookie so the server send a web page to the browser and connection lost and when again browser connect with the server. So two problems occurs.

  1. The server donโ€™t know nothing about the user as it not store on its side also cookie we do not using right now show the generic page

  2. Now the server have to store all the info about user store on his side which will require space and think if server have to store the info of 100K user that a very big data and that also increased the load that not the optimal way to use the server for.

And to solve problems these problems Cookies is invented "how to remember information about the user and store on the browser":

  • user info store in the cookie his perfirences, name , id, session Token, settings sometimes.

  • This will offload the server load and server use cookie to show data related to user set settings for user and analysis the data for best result and analysis.

How much data can be store in Cookies?

One can things we can store all about the user in the browser it will save the server load and also save the call server to database but as you guess its not good.

  1. Cookies are send with every request so if we sending all the data by in each request that make the request too big and one with slow internet have to wait very long.

  2. I think you guess storing the data on the browser take the user side space and if each site store on the user side. Then the user computer is the database in some term ๐Ÿช ๐Ÿ˜‚.

So 1st we cannot store all the data on the user side and 2nd the browser provide the limited no of cookies a domain have with each have a max size per cookie is 4KB.

0
Subscribe to my newsletter

Read articles from Hemant Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hemant Kumar
Hemant Kumar

๐Ÿ‘‹ Hi , I'm Hemant Kumar aka MrBlackGhost ๐Ÿ‘‹ I'm a Fullstack Developer focused on building modern, responsive web apps using React, Next.js, Tailwind CSS, and Node.js.Currently deepening my knowledge in AWS, GraphQL, and backend architecture. ๐Ÿ”ญ Working on: A smart "Read Later" app for saving articles, tweets, and videos ๐ŸŒฑ Learning: AWS, Django (Python), CI/CD pipelines ๐Ÿ› ๏ธ Tech I use: React, Next.js, Tailwind, Node.js, PostgreSQL ๐Ÿ“š Currently diving into: Cloud computing and system design ๐ŸŽฎ Fun fact: I skate in the morning and game in the evening (God of War fan ๐Ÿ‘พ) ๐Ÿ“ซ Reach me: LinkedIn | Twitter