当前位置:网站首页>Cookie and session comparison
Cookie and session comparison
2022-07-07 12:57:00 【LC181119】
cookie and session The same and the different :
- cookie Usually generated on the server , But it can also be generated on the client ,session It is generated on the server
- session Save the data information on the server side , It could be memory , file , Database and other forms ,cookie Save the data in the client's memory or file
- Single cookie The saved data cannot exceed 4K, Each site cookie There is a limit to the number of , such as IE8 by 50 individual 、Firefox by 50 individual 、Opera by 30 individual ;session Stored on the server , There is no capacity limit
- cookie Stored locally by the user , Can be easily accessed and modified , Low security ;session Store on server , To compare safety
- cookie There is a conversation cookie And persistent cookie, A session whose lifecycle is the browser session cookie Save in cache , Close the browser window and disappear , persistent cookie Saved on hard disk , Know that the set expiration time is exceeded ; With the server session Storage pressure increases , It will be cleaned regularly as needed session data
- session There is a lot of data in , Only will sessionID This item can be passed cookie Send to client for retention , The next time the client accesses , In the request message cookie It'll carry it automatically sessionID, So as to communicate with the session Association
cookie shortcoming :
1、 Use cookie To deliver the message , With cookie The increase of the number and the number of visits , It takes up a lot of network bandwidth , Imagine if cookie Occupy 200 byte , If one day PV There are hundreds of millions , How much bandwidth does it take ?
2、cookie Is not safe , because cookie It's stored on the client side , So these cookie It can be accessed , Settings can be added through plug-ins 、 modify cookie. So from that perspective , We're going to use sesssion,session Is to save data on the server , Only by cookie Pass a sessionId nothing more , therefore session More suitable for storing user privacy and important data
session shortcoming :
1、 Not easy to share across multiple servers , have access to session binding ,session Copy ,session Shared solutions
2、session Stored in the server , therefore session Too much will consume the performance of the server
cookie and session Each has its own advantages and disadvantages , In large Internet Systems , Use alone cookie and session It's not possible
边栏推荐
- 达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
- 2022 polymerization process test question simulation test question bank and online simulation test
- Day26 IP query items
- layer弹出层的关闭问题
- File operation command
- test
- 【从 0 开始学微服务】【02】从单体应用走向服务化
- Master formula. (used to calculate the time complexity of recursion.)
- Lingyunguang of Dachen and Xiaomi investment is listed: the market value is 15.3 billion, and the machine is implanted into the eyes and brain
- 广州市召开安全生产工作会议
猜你喜欢
![[statistical learning method] learning notes - support vector machine (I)](/img/3f/56db88d717d7cd6624b3d0867146e9.png)
[statistical learning method] learning notes - support vector machine (I)

关于 appium 如何关闭 app (已解决)

Common knowledge of one-dimensional array and two-dimensional array

Master公式。(用于计算递归的时间复杂度。)

.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst

Lingyunguang of Dachen and Xiaomi investment is listed: the market value is 15.3 billion, and the machine is implanted into the eyes and brain

《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?

“新红旗杯”桌面应用创意大赛2022

Talk about four cluster schemes of redis cache, and their advantages and disadvantages

Leetcode skimming: binary tree 20 (search in binary search tree)
随机推荐
Day-19 IO stream
Day-24 UDP, regular expression
ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
3D content generation based on nerf
Smart cloud health listed: with a market value of HK $15billion, SIG Jingwei and Jingxin fund are shareholders
Aike AI frontier promotion (7.7)
【从 0 开始学微服务】【01】什么是微服务
【无标题】
【无标题】
[statistical learning method] learning notes - support vector machine (Part 2)
2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
关于 appium 启动 app 后闪退的问题 - (已解决)
Cryptography series: detailed explanation of online certificate status protocol OCSP
飞桨EasyDL实操范例:工业零件划痕自动识别
[learn microservices from 0] [03] explore the microservice architecture
What if does not match your user account appears when submitting the code?
Four functions of opencv
Users, groups, and permissions
Master公式。(用于计算递归的时间复杂度。)
Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo