- cookieThe data is stored on the client’s browser and the session data is placed on the server.
- cookieIt is not very safe. Others can analyze the COOKIE stored locally and do COOKIE spoofing, considering that session should be used for security.
- sessionThere will be a server on the server for a certain time. When access increases, the performance of your server will be more occupied. COOKIE should be used to reduce server performance.
- The data saved by a single cookie can not exceed 4K. Many browsers limit the maximum storage of 20 cookie to one site.
- So the personal suggestion:
Store the important information such as the landing information as SESSION
If other information needs to be retained, it can be placed in COOKIE.
Link of this Article: Session differs from cookie in —–https://segmentfault.com/a/1190000013447750? Utm_source=tag-newest